Skip to content

Instantly share code, notes, and snippets.

@pixie-grasper
Created December 29, 2015 03:49
Show Gist options
  • Save pixie-grasper/150777a10d70f0abbbf7 to your computer and use it in GitHub Desktop.
Save pixie-grasper/150777a10d70f0abbbf7 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <vector>
std::vector<int> vec();
int main() {
auto l = vec();
for (auto i = 0ul; i < l.size(); i++) {
puts("ok.")
}
return 0;
}
.text
.file "1.cc"
.globl main
.align 16, 0x90
.type main,@function
main: # @main
.cfi_startproc
# BB#0:
pushq %rbx
.Ltmp0:
.cfi_def_cfa_offset 16
subq $32, %rsp
.Ltmp1:
.cfi_def_cfa_offset 48
.Ltmp2:
.cfi_offset %rbx, -16
leaq 8(%rsp), %rdi
callq _Z3vecv
movq 8(%rsp), %rdi
xorl %ebx, %ebx
cmpq %rdi, 16(%rsp)
je .LBB0_1
.align 16, 0x90
.LBB0_4: # %.lr.ph
# =>This Inner Loop Header: Depth=1
movl $.L.str, %edi
callq puts
incq %rbx
movq 8(%rsp), %rdi
movq 16(%rsp), %rax
subq %rdi, %rax
sarq $2, %rax
cmpq %rax, %rbx
jb .LBB0_4
.LBB0_1: # %._crit_edge
testq %rdi, %rdi
je .LBB0_3
# BB#2:
callq _ZdlPv
.LBB0_3: # %_ZNSt6vectorIiSaIiEED2Ev.exit
xorl %eax, %eax
addq $32, %rsp
popq %rbx
retq
.Lfunc_end0:
.size main, .Lfunc_end0-main
.cfi_endproc
.type .L.str,@object # @.str
.section .rodata.str1.1,"aMS",@progbits,1
.L.str:
.asciz "ok."
.size .L.str, 4
.ident "clang version 3.7.0 (tags/RELEASE_370/final 251906)"
.section ".note.GNU-stack","",@progbits
.file "1.cc"
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "ok."
.section .text.startup,"ax",@progbits
.p2align 4,,15
.globl main
.type main, @function
main:
.LFB705:
.cfi_startproc
.cfi_personality 0x3,__gxx_personality_v0
.cfi_lsda 0x3,.LLSDA705
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset 3, -16
subq $32, %rsp
.cfi_def_cfa_offset 48
movq %rsp, %rdi
.LEHB0:
call _Z3vecv
.LEHE0:
movq (%rsp), %rdi
movq 8(%rsp), %rax
subq %rdi, %rax
sarq $2, %rax
testq %rax, %rax
je .L2
xorl %ebx, %ebx
.p2align 4,,10
.p2align 3
.L3:
movl $.LC0, %edi
.LEHB1:
call puts
.LEHE1:
movq (%rsp), %rdi
movq 8(%rsp), %rax
addq $1, %rbx
subq %rdi, %rax
sarq $2, %rax
cmpq %rax, %rbx
jb .L3
.L2:
testq %rdi, %rdi
je .L11
call _ZdlPv
.L11:
addq $32, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 16
xorl %eax, %eax
popq %rbx
.cfi_def_cfa_offset 8
ret
.L7:
.cfi_restore_state
movq (%rsp), %rdi
movq %rax, %rbx
testq %rdi, %rdi
je .L6
call _ZdlPv
.L6:
movq %rbx, %rdi
.LEHB2:
call _Unwind_Resume
.LEHE2:
.cfi_endproc
.LFE705:
.globl __gxx_personality_v0
.section .gcc_except_table,"a",@progbits
.LLSDA705:
.byte 0xff
.byte 0xff
.byte 0x1
.uleb128 .LLSDACSE705-.LLSDACSB705
.LLSDACSB705:
.uleb128 .LEHB0-.LFB705
.uleb128 .LEHE0-.LEHB0
.uleb128 0
.uleb128 0
.uleb128 .LEHB1-.LFB705
.uleb128 .LEHE1-.LEHB1
.uleb128 .L7-.LFB705
.uleb128 0
.uleb128 .LEHB2-.LFB705
.uleb128 .LEHE2-.LEHB2
.uleb128 0
.uleb128 0
.LLSDACSE705:
.section .text.startup
.size main, .-main
.ident "GCC: (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4"
.section .note.GNU-stack,"",@progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment