xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ read(int, char *, int);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void copy_file(int src, int dst) {
  char buf[4096];
  ssize_t size;
  while ((size = read(src, buf, 4096)) > 0) {
    write(dst, buf, size);
  }
}


x86 assembly (clang, -O0):
<copy_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x1010(%rbp),%rsi
mov    $0x1000,%edx
call   1040 <read@plt>
mov    %eax,-0x1014(%rbp)
cmp    $0x0,%eax
jle    116e <copy_file+0x4e>
mov    -0x8(%rbp),%edi
lea    -0x1010(%rbp),%rsi
mov    -0x1014(%rbp),%edx
call   1030 <write@plt>
jmp    1131 <copy_file+0x11>
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_file>:
push   %rbp
push   %r14
push   %rbx
sub    $0x1000,%rsp
mov    %esi,%r14d
mov    %edi,%ebp
mov    %rsp,%rsi
mov    $0x1000,%edx
call   1040 <read@plt>
test   %eax,%eax
jle    1170 <copy_file+0x50>
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x1000,%edx
call   1040 <read@plt>
test   %eax,%eax
jg     1150 <copy_file+0x30>
add    $0x1000,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @copy_file(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [4096 x i8]
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
br label %7
7: ; preds = %12, %2
%8 = load i32, i32* %3
%9 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%10 = call i32 @read(i32 %8, i8* %9, i32 4096)
store i32 %10, i32* %6
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %7
%13 = load i32, i32* %4
%14 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%15 = load i32, i32* %6
%16 = call i32 @write(i32 %13, i8* %14, i32 %15)
br label %7
17: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @copy_file(i32 %0, i32 %1) {
%3 = alloca [4096 x i8]
%4 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%5 = call i32 @read(i32 %0, i8* %4, i32 4096)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %2, %7
%8 = phi i32 [ %10, %7 ], [ %5, %2 ]
%9 = call i32 @write(i32 %1, i8* %4, i32 %8)
%10 = call i32 @read(i32 %0, i8* %4, i32 4096)
%11 = icmp sgt i32 %10, 0
br i1 %11, label %7, label %12
12: ; preds = %7, %2
ret void
}
/* Variables and functions */
size_t func_f_idx(size_t a, size_t b, size_t c) {
  enum { xxx = 0, yyy, zzz, xxy, xxz, xyy, yyz, xzz, yzz, xyz };
  static const size_t idx[] = {xxx, xxy, xxz, xxy, xyy, xyz, xxz, xyz, xzz,
                               xxy, xyy, xyz, xyy, yyy, yyz, xyz, yyz, yzz,
                               xxz, xyz, xzz, xyz, yyz, yzz, xzz, yzz, zzz};
  return idx[9 * a + 3 * b + c];
}


x86 assembly (clang, -O0):
<func_f_idx>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
imul   $0x9,-0x8(%rbp),%rcx
imul   $0x3,-0x10(%rbp),%rax
add    %rax,%rcx
add    -0x18(%rbp),%rcx
lea    0xed8(%rip),%rax
mov    (%rax,%rcx,8),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<func_f_idx>:
lea    (%rdi,%rdi,8),%rax
lea    (%rsi,%rsi,2),%rcx
add    %rax,%rcx
add    %rdx,%rcx
lea    0xeeb(%rip),%rax
mov    (%rax,%rcx,8),%rax
ret

LLVM IR (-O0):
@func_f_idx.idx = internal constant [27 x i64] [i64 0, i64 3, i64 4, i64 3, i64 5, i64 9, i64 4, i64 9, i64 7, i64 3, i64 5, i64 9, i64 5, i64 1, i64 6, i64 9, i64 6, i64 8, i64 4, i64 9, i64 7, i64 9, i64 6, i64 8, i64 7, i64 8, i64 2]
define i64 @func_f_idx(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %4
%8 = mul i64 9, %7
%9 = load i64, i64* %5
%10 = mul i64 3, %9
%11 = add i64 %8, %10
%12 = load i64, i64* %6
%13 = add i64 %11, %12
%14 = getelementptr inbounds [27 x i64], [27 x i64]* @func_f_idx.idx, i64 0, i64 %13
%15 = load i64, i64* %14
ret i64 %15
}

LLVM IR (-O2):
@func_f_idx.idx = internal unnamed_addr constant [27 x i64] [i64 0, i64 3, i64 4, i64 3, i64 5, i64 9, i64 4, i64 9, i64 7, i64 3, i64 5, i64 9, i64 5, i64 1, i64 6, i64 9, i64 6, i64 8, i64 4, i64 9, i64 7, i64 9, i64 6, i64 8, i64 7, i64 8, i64 2]
define i64 @func_f_idx(i64 %0, i64 %1, i64 %2) {
%4 = mul i64 %0, 9
%5 = mul i64 %1, 3
%6 = add i64 %5, %4
%7 = add i64 %6, %2
%8 = getelementptr inbounds [27 x i64], [27 x i64]* @func_f_idx.idx, i64 0, i64 %7
%9 = load i64, i64* %8
ret i64 %9
}
/* Type definitions */
struct t_map {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ getsyx(int, int);
int /*<<< orphan*/ setsyx(int, int);
int init_status(struct t_map *map) {
  int y = 0, x = 0;
  setsyx(y, x);
  getsyx(y, x);
  return 0;
}


x86 assembly (clang, -O0):
<init_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <setsyx@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <getsyx@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_status>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
call   1040 <setsyx@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1030 <getsyx@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.t_map = type { i32 }
define i32 @init_status(%struct.t_map* %0) {
%2 = alloca %struct.t_map*
%3 = alloca i32
%4 = alloca i32
store %struct.t_map* %0, %struct.t_map** %2
store i32 0, i32* %3
store i32 0, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @setsyx(i32 %5, i32 %6)
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @getsyx(i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
%struct.t_map = type { i32 }
define i32 @init_status(%struct.t_map* nocapture readnone %0) {
%2 = tail call i32 @setsyx(i32 0, i32 0)
%3 = tail call i32 @getsyx(i32 0, i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ initFlex(char const *);
int /*<<< orphan*/ yyparse();
void mainParse(const char *_code) {
  initFlex(_code);
  yyparse();
}


x86 assembly (clang, -O0):
<mainParse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <initFlex@plt>
mov    $0x0,%al
call   1030 <yyparse@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mainParse>:
push   %rax
call   1040 <initFlex@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <yyparse@plt>

LLVM IR (-O0):
define void @mainParse(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @initFlex(i8* %3)
%5 = call i32 (...) @yyparse()
ret void
}

LLVM IR (-O2):
define void @mainParse(i8* %0) {
%2 = tail call i32 @initFlex(i8* %0)
%3 = tail call i32 (...) @yyparse()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ xos_thread_sleep(int /*<<< orphan*/);
int /*<<< orphan*/ xos_usecs_to_cycles(int /*<<< orphan*/);
int32_t xos_thread_sleep_usec(uint64_t usecs) {
  return xos_thread_sleep(xos_usecs_to_cycles(usecs));
}


x86 assembly (clang, -O0):
<xos_thread_sleep_usec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <xos_usecs_to_cycles@plt>
mov    %eax,%edi
call   1040 <xos_thread_sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xos_thread_sleep_usec>:
push   %rax
call   1030 <xos_usecs_to_cycles@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <xos_thread_sleep@plt>

LLVM IR (-O0):
define i32 @xos_thread_sleep_usec(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @xos_usecs_to_cycles(i32 %3)
%5 = call i32 @xos_thread_sleep(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @xos_thread_sleep_usec(i32 %0) {
%2 = tail call i32 @xos_usecs_to_cycles(i32 %0)
%3 = tail call i32 @xos_thread_sleep(i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ affiche_chemin_courant();
int /*<<< orphan*/ change_chemin_courant(char *);
int main(int argc, char *argv[]) {
  int i;
  affiche_chemin_courant();
  for (i = 1; i < argc; i++) {
    change_chemin_courant(argv[i]);
    affiche_chemin_courant();
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <affiche_chemin_courant@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1176 <main+0x56>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <change_chemin_courant@plt>
mov    $0x0,%al
call   1040 <affiche_chemin_courant@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <main+0x24>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <affiche_chemin_courant@plt>
cmp    $0x2,%ebp
jl     1159 <main+0x39>
mov    %ebp,%ebp
mov    $0x1,%ebx
nopl   0x0(%rax)
mov    (%r14,%rbx,8),%rdi
call   1030 <change_chemin_courant@plt>
xor    %eax,%eax
call   1040 <affiche_chemin_courant@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @affiche_chemin_courant()
store i32 1, i32* %6
br label %8
8: ; preds = %20, %2
%9 = load i32, i32* %6
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %23
12: ; preds = %8
%13 = load i8**, i8*** %5
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 @change_chemin_courant(i8* %17)
%19 = call i32 (...) @affiche_chemin_courant()
br label %20
20: ; preds = %12
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %6
br label %8
23: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @affiche_chemin_courant()
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %15
5: ; preds = %2
%6 = zext i32 %0 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 1, %5 ], [ %13, %7 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i32 @change_chemin_courant(i8* %10)
%12 = tail call i32 (...) @affiche_chemin_courant()
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %15, label %7
15: ; preds = %7, %2
ret i32 0
}
int divisors() {
  int nominator = 0;
  int denominator = 0;
}


x86 assembly (clang, -O0):
<divisors>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<divisors>:
ret

LLVM IR (-O0):
define i32 @divisors() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
define i32 @divisors() {
ret i32 undef
}
/* Type definitions */
struct _Locale_monetary {
  int dummy;
};

/* Variables and functions */
char _Locale_int_frac_digits(struct _Locale_monetary *lmon) { return 0; }


x86 assembly (clang, -O0):
<_Locale_int_frac_digits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_Locale_int_frac_digits>:
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct._Locale_monetary = type { i32 }
define signext i8 @_Locale_int_frac_digits(%struct._Locale_monetary* %0) {
%2 = alloca %struct._Locale_monetary*
store %struct._Locale_monetary* %0, %struct._Locale_monetary** %2
ret i8 0
}

LLVM IR (-O2):
%struct._Locale_monetary = type { i32 }
define signext i8 @_Locale_int_frac_digits(%struct._Locale_monetary* nocapture readnone %0) {
ret i8 0
}
int test_imm_FEuint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0xFE << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_FEuint64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x20,%rdx
and    $0xfe,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_FEuint64_highword_mem>:
testb  $0xfe,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_FEuint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 32
%6 = and i64 %5, 254
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_FEuint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 1090921693184
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
double prv_process_fpa_mul_real64(double a, double b) { return a * b; }


x86 assembly (clang, -O0):
<prv_process_fpa_mul_real64>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<prv_process_fpa_mul_real64>:
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @prv_process_fpa_mul_real64(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fmul double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @prv_process_fpa_mul_real64(double %0, double %1) {
%3 = fmul double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void **);
void Free2DArray(void **array, unsigned int nrow) {
  int row;
  for (row = 0; row < nrow; row++) {
    free(array[row]);
  }
  free(array);
}


x86 assembly (clang, -O0):
<Free2DArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1151 <Free2DArray+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <Free2DArray+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Free2DArray>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
je     1142 <Free2DArray+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <Free2DArray+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @Free2DArray(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %18, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp ult i32 %7, %8
br i1 %9, label %10, label %21
10: ; preds = %6
%11 = load i8**, i8*** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8*, i8** %11, i64 %13
%15 = load i8*, i8** %14
%16 = bitcast i8* %15 to i8**
%17 = call i32 @free(i8** %16)
br label %18
18: ; preds = %10
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
%22 = load i8**, i8*** %3
%23 = call i32 @free(i8** %22)
ret void
}

LLVM IR (-O2):
define void @Free2DArray(i8** nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %14, label %4
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = bitcast i8** %8 to i8***
%10 = load i8**, i8*** %9
%11 = tail call i32 @free(i8** %10)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
%15 = tail call i32 @free(i8** %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ RamRead32A(int, unsigned long *);
int /*<<< orphan*/ RamWrite32A(int, unsigned long);
void FlashReset(void) {
  unsigned long UlReadVal;
  RamWrite32A(0xC000, 0xD0006C);
  RamRead32A(0xD000, &UlReadVal);
  RamWrite32A(0xD000, (UlReadVal & (~0x00000010)));
}


x86 assembly (clang, -O0):
<FlashReset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xc000,%edi
mov    $0xd0006c,%esi
call   1040 <RamWrite32A@plt>
mov    $0xd000,%edi
lea    -0x8(%rbp),%rsi
call   1030 <RamRead32A@plt>
mov    -0x8(%rbp),%rsi
and    $0xffffffffffffffef,%rsi
mov    $0xd000,%edi
call   1040 <RamWrite32A@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FlashReset>:
push   %rax
mov    $0xd0006c,%esi
mov    $0xc000,%edi
call   1040 <RamWrite32A@plt>
mov    %rsp,%rsi
mov    $0xd000,%edi
call   1030 <RamRead32A@plt>
mov    (%rsp),%rsi
and    $0xffffffffffffffef,%rsi
mov    $0xd000,%edi
call   1040 <RamWrite32A@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @FlashReset() {
%1 = alloca i64
%2 = call i32 @RamWrite32A(i32 49152, i64 13631596)
%3 = call i32 @RamRead32A(i32 53248, i64* %1)
%4 = load i64, i64* %1
%5 = and i64 %4, -17
%6 = call i32 @RamWrite32A(i32 53248, i64 %5)
ret void
}

LLVM IR (-O2):
define void @FlashReset() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = tail call i32 @RamWrite32A(i32 49152, i64 13631596)
%4 = call i32 @RamRead32A(i32 53248, i64* %1)
%5 = load i64, i64* %1
%6 = and i64 %5, -17
%7 = call i32 @RamWrite32A(i32 53248, i64 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ maxSumSubArray(int *, int);
int main() {
  int arr[] = {-2, -3, 4, -1, -2, 1, 5, -3};
  maxSumSubArray(arr, 8);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed1(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x8,%esi
call   1030 <maxSumSubArray@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xef5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x8,%esi
call   1030 <maxSumSubArray@plt>
mov    $0x1,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.arr = [8 x i32] [i32 -2, i32 -3, i32 4, i32 -1, i32 -2, i32 1, i32 5, i32 -3]
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i32]
store i32 0, i32* %1
%3 = bitcast [8 x i32]* %2 to i8*
%4 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%5 = call i32 @maxSumSubArray(i32* %4, i32 8)
ret i32 1
}

LLVM IR (-O2):
@__const.main.arr = [8 x i32] [i32 -2, i32 -3, i32 4, i32 -1, i32 -2, i32 1, i32 5, i32 -3]
define i32 @main() {
%1 = alloca [8 x i32]
%2 = bitcast [8 x i32]* %1 to i8*
%3 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%4 = call i32 @maxSumSubArray(i32* %3, i32 8)
ret i32 1
}
/* Type definitions */
struct ptr_list {
  int dummy;
};
struct instruction_list {
  int dummy;
};
struct instruction {
  int dummy;
};

/* Variables and functions */
struct instruction *undo_ptr_list_last(struct ptr_list **);
struct instruction *delete_last_instruction(struct instruction_list **head) {
  return undo_ptr_list_last((struct ptr_list **)head);
}


x86 assembly (clang, -O0):
<delete_last_instruction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <undo_ptr_list_last@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delete_last_instruction>:
jmp    1030 <undo_ptr_list_last@plt>

LLVM IR (-O0):
%struct.instruction = type { i32 }
%struct.instruction_list = type { i32 }
%struct.ptr_list = type { i32 }
define %struct.instruction* @delete_last_instruction(%struct.instruction_list** %0) {
%2 = alloca %struct.instruction_list**
store %struct.instruction_list** %0, %struct.instruction_list*** %2
%3 = load %struct.instruction_list**, %struct.instruction_list*** %2
%4 = bitcast %struct.instruction_list** %3 to %struct.ptr_list**
%5 = call %struct.instruction* @undo_ptr_list_last(%struct.ptr_list** %4)
ret %struct.instruction* %5
}

LLVM IR (-O2):
%struct.instruction = type { i32 }
%struct.instruction_list = type { i32 }
%struct.ptr_list = type { i32 }
define %struct.instruction* @delete_last_instruction(%struct.instruction_list** %0) {
%2 = bitcast %struct.instruction_list** %0 to %struct.ptr_list**
%3 = tail call %struct.instruction* @undo_ptr_list_last(%struct.ptr_list** %2)
ret %struct.instruction* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ XChar2b;

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ malloc(int);
void *alloc_XChar2b(void) {
  XChar2b *_p = (XChar2b *)malloc(sizeof(XChar2b));
  if (_p == NULL)
    abort();
  return (void *)_p;
}


x86 assembly (clang, -O0):
<alloc_XChar2b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <alloc_XChar2b+0x28>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_XChar2b>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1132 <alloc_XChar2b+0x12>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @alloc_XChar2b() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = load i32*, i32** %1
%10 = bitcast i32* %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @alloc_XChar2b() {
%1 = tail call i64 @malloc(i32 4)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = inttoptr i64 %1 to i8*
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ Open(char *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc < 1) {
    fprintf(stderr, "No image name to load has been supplied");
    fflush(stderr);
    return 1;
  }
  Open(argv[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    117f <main+0x4f>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
movl   $0x1,-0x4(%rbp)
jmp    1193 <main+0x63>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <Open@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
test   %edi,%edi
jle    1142 <main+0x12>
mov    0x8(%rsi),%rdi
call   1030 <Open@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    0x2e97(%rip),%rbx
mov    (%rbx),%edi
lea    0xeae(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
call   1050 <fflush@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [40 x i8] c"No image name to load has been supplied\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 1
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = call i32 @fflush(i32 %11)
store i32 1, i32* %3
br label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @Open(i8* %16)
store i32 0, i32* %3
br label %18
18: ; preds = %13, %8
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"No image name to load has been supplied\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 1
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = tail call i32 @fflush(i32 %7)
br label %13
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @Open(i8* %11)
br label %13
13: ; preds = %9, %4
%14 = phi i32 [ 1, %4 ], [ 0, %9 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ test_after_init();
int /*<<< orphan*/ test_after_reading_everything();
int main(void) {
  test_after_init();
  test_after_reading_everything();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <test_after_init@plt>
mov    $0x0,%al
call   1040 <test_after_reading_everything@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_after_init@plt>
xor    %eax,%eax
call   1040 <test_after_reading_everything@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_after_init()
%3 = call i32 (...) @test_after_reading_everything()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_after_init()
%2 = tail call i32 (...) @test_after_reading_everything()
ret i32 0
}
/* Variables and functions */
int getchar();
int get32(void) {
  int b1 = getchar();
  int b2 = getchar();
  int b3 = getchar();
  int b4 = getchar();
  return ((b1 << 24) & 0xff000000) | ((b2 << 16) & 0xff0000) |
         ((b3 << 8) & 0xff00) | (b4 & 0xff);
}


x86 assembly (clang, -O0):
<get32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x18,%eax
and    $0xff000000,%eax
mov    -0x8(%rbp),%ecx
shl    $0x10,%ecx
and    $0xff0000,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
shl    $0x8,%ecx
and    $0xff00,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
and    $0xff,%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get32>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <getchar@plt>
shl    $0x18,%ebx
movzbl %r14b,%ecx
shl    $0x10,%ecx
or     %ebx,%ecx
shl    $0x8,%ebp
movzwl %bp,%edx
or     %ecx,%edx
movzbl %al,%eax
or     %edx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get32() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 (...) @getchar()
store i32 %5, i32* %1
%6 = call i32 (...) @getchar()
store i32 %6, i32* %2
%7 = call i32 (...) @getchar()
store i32 %7, i32* %3
%8 = call i32 (...) @getchar()
store i32 %8, i32* %4
%9 = load i32, i32* %1
%10 = shl i32 %9, 24
%11 = and i32 %10, -16777216
%12 = load i32, i32* %2
%13 = shl i32 %12, 16
%14 = and i32 %13, 16711680
%15 = or i32 %11, %14
%16 = load i32, i32* %3
%17 = shl i32 %16, 8
%18 = and i32 %17, 65280
%19 = or i32 %15, %18
%20 = load i32, i32* %4
%21 = and i32 %20, 255
%22 = or i32 %19, %21
ret i32 %22
}

LLVM IR (-O2):
define i32 @get32() {
%1 = tail call i32 (...) @getchar()
%2 = tail call i32 (...) @getchar()
%3 = tail call i32 (...) @getchar()
%4 = tail call i32 (...) @getchar()
%5 = shl i32 %1, 24
%6 = shl i32 %2, 16
%7 = and i32 %6, 16711680
%8 = or i32 %7, %5
%9 = shl i32 %3, 8
%10 = and i32 %9, 65280
%11 = or i32 %8, %10
%12 = and i32 %4, 255
%13 = or i32 %11, %12
ret i32 %13
}
int isOrOp(char c) { return '|' == c || '~' == c; }


x86 assembly (clang, -O0):
<isOrOp>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
mov    $0x1,%al
mov    $0x7c,%ecx
cmp    %edx,%ecx
mov    %al,-0x2(%rbp)
je     1131 <isOrOp+0x31>
movsbl -0x1(%rbp),%ecx
mov    $0x7e,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isOrOp>:
and    $0xfd,%dil
xor    %eax,%eax
cmp    $0x7c,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @isOrOp(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 124, %4
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 126, %8
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @isOrOp(i8 signext %0) {
%2 = and i8 %0, -3
%3 = icmp eq i8 %2, 124
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ test(double, float, long double);
int main() {
  test(3.0, 3.0F, 3.0L);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %rsp,%rax
flds   0xee0(%rip)
fstpt  (%rax)
movsd  0xece(%rip),%xmm0
movss  0xece(%rip),%xmm1
call   1030 <test@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
flds   0xee6(%rip)
fstpt  (%rsp)
movsd  0xee3(%rip),%xmm0
movss  0xed3(%rip),%xmm1
call   1030 <test@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @test(double 3.000000e+00, float 3.000000e+00, x86_fp80 0xK4000C000000000000000)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test(double 3.000000e+00, float 3.000000e+00, x86_fp80 0xK4000C000000000000000)
ret i32 0
}
/* Variables and functions */
char const *strerror(int);
const char *sockutil_strerror(int err) { return strerror(err); }


x86 assembly (clang, -O0):
<sockutil_strerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <strerror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sockutil_strerror>:
jmp    1030 <strerror@plt>

LLVM IR (-O0):
define i8* @sockutil_strerror(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i8* @strerror(i32 %3)
ret i8* %4
}

LLVM IR (-O2):
define i8* @sockutil_strerror(i32 %0) {
%2 = tail call i8* @strerror(i32 %0)
ret i8* %2
}
/* Type definitions */
struct suffix_mult {
  int dummy;
};

/* Variables and functions */
long xatoll_range_sfx(char const *, long, long, struct suffix_mult const *);
__attribute__((always_)) long xatol_range_sfx(const char *str, long l, long u,
                                              const struct suffix_mult *sfx) {
  return xatoll_range_sfx(str, l, u, sfx);
}


x86 assembly (clang, -O0):
<xatol_range_sfx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <xatoll_range_sfx@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xatol_range_sfx>:
jmp    1030 <xatoll_range_sfx@plt>

LLVM IR (-O0):
%struct.suffix_mult = type { i32 }
define i64 @xatol_range_sfx(i8* %0, i64 %1, i64 %2, %struct.suffix_mult* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca %struct.suffix_mult*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store %struct.suffix_mult* %3, %struct.suffix_mult** %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i64, i64* %7
%12 = load %struct.suffix_mult*, %struct.suffix_mult** %8
%13 = call i64 @xatoll_range_sfx(i8* %9, i64 %10, i64 %11, %struct.suffix_mult* %12)
ret i64 %13
}

LLVM IR (-O2):
%struct.suffix_mult = type { i32 }
define i64 @xatol_range_sfx(i8* %0, i64 %1, i64 %2, %struct.suffix_mult* %3) {
%5 = tail call i64 @xatoll_range_sfx(i8* %0, i64 %1, i64 %2, %struct.suffix_mult* %3)
ret i64 %5
}
void vector3d_add(double u[3], double v[3], double w[3]) {
  int i;
  for (i = 0; i < 3; i++)
    u[i] = v[i] + w[i];
}


x86 assembly (clang, -O0):
<vector3d_add>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    1156 <vector3d_add+0x56>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <vector3d_add+0x17>
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector3d_add>:
movsd  (%rsi),%xmm0
addsd  (%rdx),%xmm0
movsd  %xmm0,(%rdi)
movsd  0x8(%rsi),%xmm0
addsd  0x8(%rdx),%xmm0
movsd  %xmm0,0x8(%rdi)
movsd  0x10(%rsi),%xmm0
addsd  0x10(%rdx),%xmm0
movsd  %xmm0,0x10(%rdi)
ret

LLVM IR (-O0):
define void @vector3d_add(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
store i32 0, i32* %7
br label %8
8: ; preds = %27, %3
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %30
11: ; preds = %8
%12 = load double*, double** %5
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %12, i64 %14
%16 = load double, double* %15
%17 = load double*, double** %6
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
%21 = load double, double* %20
%22 = fadd double %16, %21
%23 = load double*, double** %4
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
store double %22, double* %26
br label %27
27: ; preds = %11
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
br label %8
30: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @vector3d_add(double* nocapture writeonly %0, double* nocapture %1, double* nocapture %2) {
%4 = load double, double* %1
%5 = load double, double* %2
%6 = fadd double %4, %5
store double %6, double* %0
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %2, i64 1
%10 = load double, double* %9
%11 = fadd double %8, %10
%12 = getelementptr inbounds double, double* %0, i64 1
store double %11, double* %12
%13 = getelementptr inbounds double, double* %1, i64 2
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %2, i64 2
%16 = load double, double* %15
%17 = fadd double %14, %16
%18 = getelementptr inbounds double, double* %0, i64 2
store double %17, double* %18
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ stringParaInt(char *, int *);
int main() {
  int x = 0;
  char s[10];
  scanf(" %[^\n]s", s);
  stringParaInt(s, &x);
  printf(" %d...", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x12(%rbp),%rsi
lea    0xeaf(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x12(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <stringParaInt@plt>
mov    -0x8(%rbp),%esi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,(%rsp)
lea    0xebd(%rip),%rdi
lea    0x6(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <stringParaInt@plt>
mov    (%rsp),%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c" %[^\0A]s\00"
@.str.1 = [7 x i8] c" %d...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%7 = call i32 @stringParaInt(i8* %6, i32* %2)
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c" %[^\0A]s\00"
@.str.1 = [7 x i8] c" %d...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @stringParaInt(i8* %4, i32* %1)
%7 = load i32, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned char *, char const *, int);
int update_mac(unsigned char *buf, const char *mac) {
  memcpy(buf, mac, 6);
  return 0;
}


x86 assembly (clang, -O0):
<update_mac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x6,%edx
call   1030 <memcpy@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_mac>:
push   %rax
mov    $0x6,%edx
call   1030 <memcpy@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @update_mac(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @memcpy(i8* %5, i8* %6, i32 6)
ret i32 0
}

LLVM IR (-O2):
define i32 @update_mac(i8* %0, i8* %1) {
%3 = tail call i32 @memcpy(i8* %0, i8* %1, i32 6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fopen(char *, char *);
int /*<<< orphan*/ perror(char *);
int main(void) {
  fopen("haha", "r");
  perror("fopen haha");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
lea    0xec3(%rip),%rsi
call   1030 <fopen@plt>
lea    0xeb9(%rip),%rdi
call   1040 <perror@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee0(%rip),%rdi
lea    0xed1(%rip),%rsi
call   1030 <fopen@plt>
lea    0xec7(%rip),%rdi
call   1040 <perror@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"haha\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"fopen haha\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @fopen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"haha\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"fopen haha\00"
define i32 @main() {
%1 = tail call i32 @fopen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int error(char *msg, int lineNo, int instNo) {
  printf("ERROR: Line %d", lineNo);
  if (instNo >= 0)
    printf(" (Address: %d)", instNo);
  printf("   %s\n", msg);
  return 0;
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%esi
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x10(%rbp)
jl     114e <error+0x3e>
mov    -0x10(%rbp),%esi
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
lea    0xee1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebp,%ebp
js     113a <error+0x2a>
lea    0xede(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"ERROR: Line %d\00"
@.str.1 = [15 x i8] c" (Address: %d)\00"
@.str.2 = [7 x i8] c" %s\0A\00"
define i32 @error(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %6
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %3
%12 = load i32, i32* %6
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %11, %3
%15 = load i8*, i8** %4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"ERROR: Line %d\00"
@.str.1 = [15 x i8] c" (Address: %d)\00"
@.str.2 = [7 x i8] c" %s\0A\00"
define i32 @error(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %1)
%5 = icmp sgt i32 %2, -1
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %2)
br label %8
8: ; preds = %6, %3
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ frecverr(char *);
int read(int /*<<< orphan*/, char *, size_t);
int noresponse(void) {
  char resp;
  if (read(STDOUT_FILENO, &resp, (size_t)1) != 1) {
    frecverr("lost connection in noresponse()");
  }
  if (resp == '\0')
    return (0);
  return (1);
}


x86 assembly (clang, -O0):
<noresponse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
lea    -0x5(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0x1,%eax
je     1154 <noresponse+0x34>
lea    0xeb1(%rip),%rdi
call   1040 <frecverr@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x0,%eax
jne    116d <noresponse+0x4d>
movl   $0x0,-0x4(%rbp)
jmp    1174 <noresponse+0x54>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<noresponse>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0x1,%eax
je     114a <noresponse+0x2a>
lea    0xebb(%rip),%rdi
call   1040 <frecverr@plt>
xor    %eax,%eax
cmpb   $0x0,0x7(%rsp)
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
@STDOUT_FILENO = global i32 0
@.str = [32 x i8] c"lost connection in noresponse()\00"
define i32 @noresponse() {
%1 = alloca i32
%2 = alloca i8
%3 = load i32, i32* @STDOUT_FILENO
%4 = call i32 @read(i32 %3, i8* %2, i64 1)
%5 = icmp ne i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @frecverr(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 0, i32* %1
br label %14
13: ; preds = %8
store i32 1, i32* %1
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@STDOUT_FILENO = global i32 0
@.str = [32 x i8] c"lost connection in noresponse()\00"
define i32 @noresponse() {
%1 = alloca i8
%2 = load i32, i32* @STDOUT_FILENO
%3 = call i32 @read(i32 %2, i8* %1, i64 1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = tail call i32 @frecverr(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = load i8, i8* %1
%9 = icmp ne i8 %8, 0
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Type definitions */
typedef size_t uint8_t;

/* Variables and functions */
uint8_t wordLength(char *string) {
  if (string == NULL) {
    return 0;
  }
  uint8_t length = 0;
  while (string[length] != ' ' && string[length] != '\0') {
    length++;
  }
  return length;
}


x86 assembly (clang, -O0):
<wordLength>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1120 <wordLength+0x20>
movq   $0x0,-0x8(%rbp)
jmp    1180 <wordLength+0x80>
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x19(%rbp)
je     1157 <wordLength+0x57>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1167 <wordLength+0x67>
jmp    1178 <wordLength+0x78>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <wordLength+0x28>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wordLength>:
xor    %eax,%eax
test   %rdi,%rdi
je     1120 <wordLength+0x20>
nopw   0x0(%rax,%rax,1)
testb  $0xdf,(%rdi,%rax,1)
je     1120 <wordLength+0x20>
add    $0x1,%rax
testb  $0xdf,(%rdi,%rax,1)
jne    1116 <wordLength+0x16>
ret

LLVM IR (-O0):
define i64 @wordLength(i8* %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %1
store i64 0, i64* %2
br label %30
8: ; preds = %1
store i64 0, i64* %4
br label %9
9: ; preds = %25, %8
%10 = load i8*, i8** %3
%11 = load i64, i64* %4
%12 = getelementptr inbounds i8, i8* %10, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 32
br i1 %15, label %16, label %23
16: ; preds = %9
%17 = load i8*, i8** %3
%18 = load i64, i64* %4
%19 = getelementptr inbounds i8, i8* %17, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 0
br label %23
23: ; preds = %16, %9
%24 = phi i1 [ false, %9 ], [ %22, %16 ]
br i1 %24, label %25, label %28
25: ; preds = %23
%26 = load i64, i64* %4
%27 = add i64 %26, 1
store i64 %27, i64* %4
br label %9
28: ; preds = %23
%29 = load i64, i64* %4
store i64 %29, i64* %2
br label %30
30: ; preds = %28, %7
%31 = load i64, i64* %2
ret i64 %31
}

LLVM IR (-O2):
define i64 @wordLength(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1, %7
%4 = phi i64 [ %8, %7 ], [ 0, %1 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
switch i8 %6, label %7 [
i8 32, label %9
i8 0, label %9
]
7: ; preds = %3
%8 = add i64 %4, 1
br label %3
9: ; preds = %3, %3, %1
%10 = phi i64 [ 0, %1 ], [ %4, %3 ], [ %4, %3 ]
ret i64 %10
}
/* Variables and functions */
int _brk(void *);
int brk(void *addr) { return _brk(addr); }


x86 assembly (clang, -O0):
<brk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <_brk@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<brk>:
jmp    1030 <_brk@plt>

LLVM IR (-O0):
define i32 @brk(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @_brk(i8* %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @brk(i8* %0) {
%2 = tail call i32 @_brk(i8* %0)
ret i32 %2
}