xunge/DecIR huggingface dataset:
/* Type definitions */
struct packet {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct packet *);
void del_pkt(struct packet *m) { free(m); }


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

x86 assembly (clang, -O2):
<del_pkt>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.packet = type { i32 }
define void @del_pkt(%struct.packet* %0) {
%2 = alloca %struct.packet*
store %struct.packet* %0, %struct.packet** %2
%3 = load %struct.packet*, %struct.packet** %2
%4 = call i32 @free(%struct.packet* %3)
ret void
}

LLVM IR (-O2):
%struct.packet = type { i32 }
define void @del_pkt(%struct.packet* nocapture %0) {
%2 = tail call i32 @free(%struct.packet* %0)
ret void
}
int move_closer(int current, int goal) {
  if (current > goal) {
    return current++;
  } else if (current < goal) {
    return current--;
  } else {
    return current;
  }
}


x86 assembly (clang, -O0):
<move_closer>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1129 <move_closer+0x29>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
mov    %eax,-0x4(%rbp)
jmp    114e <move_closer+0x4e>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1148 <move_closer+0x48>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
mov    %eax,-0x4(%rbp)
jmp    114e <move_closer+0x4e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<move_closer>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @move_closer(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = icmp sgt i32 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 1
store i32 %11, i32* %4
store i32 %10, i32* %3
br label %21
12: ; preds = %2
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i32, i32* %4
%18 = add nsw i32 %17, -1
store i32 %18, i32* %4
store i32 %17, i32* %3
br label %21
19: ; preds = %12
%20 = load i32, i32* %4
store i32 %20, i32* %3
br label %21
21: ; preds = %19, %16, %9
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @move_closer(i32 returned %0, i32 %1) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ _nx_stop_timer_thread();
void nx_kernel_shutdown(void) { _nx_stop_timer_thread(); }


x86 assembly (clang, -O0):
<nx_kernel_shutdown>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <_nx_stop_timer_thread@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<nx_kernel_shutdown>:
xor    %eax,%eax
jmp    1030 <_nx_stop_timer_thread@plt>

LLVM IR (-O0):
define void @nx_kernel_shutdown() {
%1 = call i32 (...) @_nx_stop_timer_thread()
ret void
}

LLVM IR (-O2):
define void @nx_kernel_shutdown() {
%1 = tail call i32 (...) @_nx_stop_timer_thread()
ret void
}
/* Variables and functions */
size_t strlen_utf8(char *s) {
  size_t i = 0, j = 0;
  while (s[i]) {
    if ((s[i] & 0xc0) != 0x80)
      j++;
    i++;
  }
  return j;
}


x86 assembly (clang, -O0):
<strlen_utf8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1163 <strlen_utf8+0x63>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
je     1152 <strlen_utf8+0x52>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1118 <strlen_utf8+0x18>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen_utf8>:
mov    (%rdi),%cl
test   %cl,%cl
je     112a <strlen_utf8+0x2a>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
and    $0xc0,%cl
xor    %edx,%edx
cmp    $0x80,%cl
setne  %dl
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <strlen_utf8+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @strlen_utf8(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
store i8* %0, i8** %2
store i64 0, i64* %3
store i64 0, i64* %4
br label %5
5: ; preds = %22, %1
%6 = load i8*, i8** %2
%7 = load i64, i64* %3
%8 = getelementptr inbounds i8, i8* %6, i64 %7
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %25
11: ; preds = %5
%12 = load i8*, i8** %2
%13 = load i64, i64* %3
%14 = getelementptr inbounds i8, i8* %12, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = and i32 %16, 192
%18 = icmp ne i32 %17, 128
br i1 %18, label %19, label %22
19: ; preds = %11
%20 = load i64, i64* %4
%21 = add i64 %20, 1
store i64 %21, i64* %4
br label %22
22: ; preds = %19, %11
%23 = load i64, i64* %3
%24 = add i64 %23, 1
store i64 %24, i64* %3
br label %5
25: ; preds = %5
%26 = load i64, i64* %4
ret i64 %26
}

LLVM IR (-O2):
define i64 @strlen_utf8(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %14, %4 ], [ %2, %1 ]
%6 = phi i64 [ %11, %4 ], [ 0, %1 ]
%7 = phi i64 [ %12, %4 ], [ 0, %1 ]
%8 = and i8 %5, -64
%9 = icmp ne i8 %8, -128
%10 = zext i1 %9 to i64
%11 = add i64 %6, %10
%12 = add i64 %7, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %4, %1
%17 = phi i64 [ 0, %1 ], [ %11, %4 ]
ret i64 %17
}
int null_check_bl(int bl) {
  switch (bl) {
  case 16:
  case 24:
  case 32:
    return 1;
  default:
    return -11;
  }
}


x86 assembly (clang, -O0):
<null_check_bl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x10,%eax
je     113d <null_check_bl+0x3d>
jmp    111b <null_check_bl+0x1b>
mov    -0xc(%rbp),%eax
sub    $0x18,%eax
je     113d <null_check_bl+0x3d>
jmp    112c <null_check_bl+0x2c>
mov    -0xc(%rbp),%eax
sub    $0x20,%eax
jne    1149 <null_check_bl+0x49>
jmp    113d <null_check_bl+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    1150 <null_check_bl+0x50>
movl   $0xfffffff5,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<null_check_bl>:
cmp    $0x20,%edi
ja     111d <null_check_bl+0x1d>
mov    $0x1,%eax
mov    %edi,%ecx
movabs $0x101010000,%rdx
bt     %rcx,%rdx
jae    111d <null_check_bl+0x1d>
ret
mov    $0xfffffff5,%eax
ret

LLVM IR (-O0):
define i32 @null_check_bl(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 16, label %5
i32 24, label %5
i32 32, label %5
]
5: ; preds = %1, %1, %1
store i32 1, i32* %2
br label %7
6: ; preds = %1
store i32 -11, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @null_check_bl(i32 %0) {
switch i32 %0, label %2 [
i32 16, label %3
i32 24, label %3
i32 32, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %2
%4 = phi i32 [ -11, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ iopl(int /*<<< orphan*/);
int release_io_perms(void *p) {
  iopl(0);
  return 0;
}


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

x86 assembly (clang, -O2):
<release_io_perms>:
push   %rax
xor    %edi,%edi
call   1030 <iopl@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @release_io_perms(i8* nocapture readnone %0) {
%2 = tail call i32 @iopl(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ print_inputline_nolinefeed();
int /*<<< orphan*/ printf(char *);
void print_inputline() {
  print_inputline_nolinefeed();
  printf("\n");
}


x86 assembly (clang, -O0):
<print_inputline>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <print_inputline_nolinefeed@plt>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_inputline>:
push   %rax
xor    %eax,%eax
call   1040 <print_inputline_nolinefeed@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @print_inputline() {
%1 = call i32 (...) @print_inputline_nolinefeed()
%2 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @print_inputline() {
%1 = tail call i32 (...) @print_inputline_nolinefeed()
%2 = tail call i32 @putchar(i32 10)
ret void
}
void removeSpaces(char *s) {
  char *i = s;
  char *j = s;
  while (*j != 0) {
    *i = *j++;
    if (*i != ' ') {
      i++;
    }
  }
  *i = 0;
}


x86 assembly (clang, -O0):
<removeSpaces>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1160 <removeSpaces+0x60>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     115b <removeSpaces+0x5b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1118 <removeSpaces+0x18>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<removeSpaces>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <removeSpaces+0x28>
lea    0x1(%rdi),%rax
nopw   0x0(%rax,%rax,1)
mov    %cl,(%rdi)
xor    %edx,%edx
cmp    $0x20,%cl
setne  %dl
add    %rdx,%rdi
movzbl (%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <removeSpaces+0x10>
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @removeSpaces(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
store i8 %5, i8* %7
%9 = icmp ne i8 %5, 32
%10 = zext i1 %9 to i64
%11 = getelementptr i8, i8* %7, i64 %10
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i8* [ %0, %1 ], [ %11, %4 ]
store i8 0, i8* %15
ret void
}
int buffered_random_close(void *data) {
  (void)data;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @buffered_random_close(i8* nocapture readnone %0) {
ret i32 0
}
double calculate_meters_per_second(double time_in_seconds) {
  double meters_per_second = 0.0;
  meters_per_second = (1000.0 * (5280.0 / 3282.0)) / time_in_seconds;
  return meters_per_second;
}


x86 assembly (clang, -O0):
<calculate_meters_per_second>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xee7(%rip),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_meters_per_second>:
movsd  0xef8(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @calculate_meters_per_second(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
store double 0.000000e+00, double* %3
%4 = load double, double* %2
%5 = fdiv double 0x40992319BD8AFF88, %4
store double %5, double* %3
%6 = load double, double* %3
ret double %6
}

LLVM IR (-O2):
define double @calculate_meters_per_second(double %0) {
%2 = fdiv double 0x40992319BD8AFF88, %0
ret double %2
}
int f(int a, int b) {
  if (b == 0)
    return 0;
  return a / b;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1120 <f+0x20>
movl   $0x0,-0x4(%rbp)
jmp    112a <f+0x2a>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
test   %esi,%esi
je     110a <f+0xa>
mov    %edi,%eax
cltd
idiv   %esi
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @f(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 0, i32* %3
br label %13
9: ; preds = %2
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = sdiv i32 %10, %11
store i32 %12, i32* %3
br label %13
13: ; preds = %9, %8
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = sdiv i32 %0, %1
br label %6
6: ; preds = %2, %4
%7 = phi i32 [ %5, %4 ], [ 0, %2 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ ary_xfree(char *);
void ary_cb_freecharptr(void *buf, void *userp) {
  (void)userp;
  ary_xfree(*(char **)buf);
}


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

x86 assembly (clang, -O2):
<ary_cb_freecharptr>:
mov    (%rdi),%rdi
jmp    1030 <ary_xfree@plt>

LLVM IR (-O0):
define void @ary_cb_freecharptr(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i8**
%8 = load i8*, i8** %7
%9 = call i32 @ary_xfree(i8* %8)
ret void
}

LLVM IR (-O2):
define void @ary_cb_freecharptr(i8* nocapture %0, i8* nocapture readnone %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = tail call i32 @ary_xfree(i8* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fail();
int /*<<< orphan*/ parrot(int);
int client(int (*func)(const char *arg), const char *arg) {
  int fd = func(arg);
  if (fd < 0) {
    fail();
  }
  parrot(fd);
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<client>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdi
call   *%rax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    115e <client+0x2e>
mov    $0x0,%al
call   1040 <fail@plt>
mov    -0x14(%rbp),%edi
call   1030 <parrot@plt>
mov    -0x14(%rbp),%edi
call   1050 <close@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<client>:
push   %rbx
mov    %rdi,%rax
mov    %rsi,%rdi
call   *%rax
mov    %eax,%ebx
test   %eax,%eax
jns    1146 <client+0x16>
xor    %eax,%eax
call   1040 <fail@plt>
mov    %ebx,%edi
call   1030 <parrot@plt>
mov    %ebx,%edi
call   1050 <close@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @client(i32 (i8*)* %0, i8* %1) {
%3 = alloca i32 (i8*)*
%4 = alloca i8*
%5 = alloca i32
store i32 (i8*)* %0, i32 (i8*)** %3
store i8* %1, i8** %4
%6 = load i32 (i8*)*, i32 (i8*)** %3
%7 = load i8*, i8** %4
%8 = call i32 %6(i8* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 (...) @fail()
br label %13
13: ; preds = %11, %2
%14 = load i32, i32* %5
%15 = call i32 @parrot(i32 %14)
%16 = load i32, i32* %5
%17 = call i32 @close(i32 %16)
ret i32 0
}

LLVM IR (-O2):
define i32 @client(i32 (i8*)* nocapture %0, i8* %1) {
%3 = tail call i32 %0(i8* %1)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @fail()
br label %7
7: ; preds = %5, %2
%8 = tail call i32 @parrot(i32 %3)
%9 = tail call i32 @close(i32 %3)
ret i32 0
}
/* Variables and functions */
int bar();
int foo(int a) { return bar() + a + 1; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <bar@plt>
add    -0x4(%rbp),%eax
add    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <bar@plt>
add    %ebx,%eax
add    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @bar()
%4 = load i32, i32* %2
%5 = add nsw i32 %3, %4
%6 = add nsw i32 %5, 1
ret i32 %6
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = tail call i32 (...) @bar()
%3 = add i32 %0, 1
%4 = add i32 %3, %2
ret i32 %4
}
int test_imm_97int64_lowword_mem(long long *val) {
  return ((*val) & (0x97 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_97int64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 151
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  printf("%d\n", (n = ((1 << n) + 1)) * n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%ecx
mov    $0x1,%esi
shl    %cl,%esi
add    $0x1,%esi
mov    %esi,-0x8(%rbp)
imul   -0x8(%rbp),%esi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%cl
mov    $0x1,%esi
shl    %cl,%esi
add    $0x1,%esi
mov    %esi,0x4(%rsp)
imul   %esi,%esi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = shl nuw i32 1, %4
%6 = add nuw nsw i32 %5, 1
store i32 %6, i32* %1
%7 = mul nsw i32 %6, %6
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void error(const char *msg) {
  fputs("ERROR: ", stderr);
  fputs(msg, stderr);
  fputs("\n", stderr);
  exit(1);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
lea    0xec4(%rip),%rdi
call   1030 <fputs@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e94(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%esi
lea    0xea5(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eb2(%rip),%r14
mov    (%r14),%esi
lea    0xec8(%rip),%rdi
call   1030 <fputs@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1030 <fputs@plt>
mov    (%r14),%esi
lea    0xeb6(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"ERROR: \00"
@stderr = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i8*, i8** %2
%6 = load i32, i32* @stderr
%7 = call i32 @fputs(i8* %5, i32 %6)
%8 = load i32, i32* @stderr
%9 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"ERROR: \00"
@stderr = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
define void @error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = load i32, i32* @stderr
%5 = tail call i32 @fputs(i8* %0, i32 %4)
%6 = load i32, i32* @stderr
%7 = tail call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int ssize_t;
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ mill_msleep_(int /*<<< orphan*/, char *);
int send(int, char *, int, int /*<<< orphan*/);
__attribute__((no)) void trigger(int fd, int64_t deadline) {
  mill_msleep_(
      (deadline),
      ("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
       "2022-01-22/02-19-57/repos/jimjag/mill/refs/heads/master/tests/fdwait.c"
       ":"
       "36"));
  ssize_t sz = send(fd, "A", 1, 0);
  assert(sz == 1);
}


x86 assembly (clang, -O0):
<trigger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    0xeb8(%rip),%rsi
call   1050 <mill_msleep_@plt>
mov    -0x4(%rbp),%edi
lea    0xf33(%rip),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trigger>:
push   %rbx
mov    %esi,%eax
mov    %edi,%ebx
lea    0xec4(%rip),%rsi
mov    %eax,%edi
call   1050 <mill_msleep_@plt>
lea    0xf40(%rip),%rsi
mov    %ebx,%edi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
pop    %rbx
jmp    1040 <assert@plt>

LLVM IR (-O0):
@.str = [138 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/jimjag/mill/refs/heads/master/tests/fdwait.c:36\00"
@.str.1 = [2 x i8] c"A\00"
define void @trigger(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = call i32 @mill_msleep_(i32 %6, i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %3
%9 = call i32 @send(i32 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 0)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, 1
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
ret void
}

LLVM IR (-O2):
@.str = [138 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/jimjag/mill/refs/heads/master/tests/fdwait.c:36\00"
@.str.1 = [2 x i8] c"A\00"
define void @trigger(i32 %0, i32 %1) {
%3 = tail call i32 @mill_msleep_(i32 %1, i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @send(i32 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 0)
%5 = icmp eq i32 %4, 1
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fwrite(void *, int, size_t, int /*<<< orphan*/ *);
int write(int fd, void *buf, size_t len) {
  return fwrite(buf, 1, len, (FILE *)fd);
}


x86 assembly (clang, -O0):
<write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
movslq -0x4(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fwrite@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write>:
movslq %edi,%rcx
mov    %rsi,%rdi
mov    $0x1,%esi
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
define i32 @write(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %5
%8 = load i64, i64* %6
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = call i32 @fwrite(i8* %7, i32 1, i64 %8, i32* %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @write(i32 %0, i8* nocapture %1, i64 %2) {
%4 = sext i32 %0 to i64
%5 = inttoptr i64 %4 to i32*
%6 = tail call i32 @fwrite(i8* %1, i32 1, i64 %2, i32* %5)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ GyrosBiasHandle();
int /*<<< orphan*/ UAVObjRequestUpdate(int /*<<< orphan*/);
void GyrosBiasRequestUpdate() { UAVObjRequestUpdate(GyrosBiasHandle()); }


x86 assembly (clang, -O0):
<GyrosBiasRequestUpdate>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <GyrosBiasHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjRequestUpdate@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<GyrosBiasRequestUpdate>:
push   %rax
xor    %eax,%eax
call   1030 <GyrosBiasHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjRequestUpdate@plt>

LLVM IR (-O0):
define void @GyrosBiasRequestUpdate() {
%1 = call i32 (...) @GyrosBiasHandle()
%2 = call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}

LLVM IR (-O2):
define void @GyrosBiasRequestUpdate() {
%1 = tail call i32 (...) @GyrosBiasHandle()
%2 = tail call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}
double noisy_div(double x, double y, double t) {
  if (y <= t)
    return 0;
  return x / y;
}


x86 assembly (clang, -O0):
<noisy_div>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1134 <noisy_div+0x34>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1143 <noisy_div+0x43>
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<noisy_div>:
xorpd  %xmm3,%xmm3
ucomisd %xmm1,%xmm2
jae    1112 <noisy_div+0x12>
divsd  %xmm1,%xmm0
movapd %xmm0,%xmm3
movapd %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @noisy_div(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%8 = load double, double* %6
%9 = load double, double* %7
%10 = fcmp ole double %8, %9
br i1 %10, label %11, label %12
11: ; preds = %3
store double 0.000000e+00, double* %4
br label %16
12: ; preds = %3
%13 = load double, double* %5
%14 = load double, double* %6
%15 = fdiv double %13, %14
store double %15, double* %4
br label %16
16: ; preds = %12, %11
%17 = load double, double* %4
ret double %17
}

LLVM IR (-O2):
define double @noisy_div(double %0, double %1, double %2) {
%4 = fcmp ugt double %1, %2
%5 = fdiv double %0, %1
%6 = select i1 %4, double %5, double 0.000000e+00
ret double %6
}
unsigned long flat_get_relocate_addr(unsigned long relval) {
  return relval & 0x00ffffff;
}


x86 assembly (clang, -O0):
<flat_get_relocate_addr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xffffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flat_get_relocate_addr>:
mov    %rdi,%rax
and    $0xffffff,%eax
ret

LLVM IR (-O0):
define i64 @flat_get_relocate_addr(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 16777215
ret i64 %4
}

LLVM IR (-O2):
define i64 @flat_get_relocate_addr(i64 %0) {
%2 = and i64 %0, 16777215
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *);
void terminate(const char *message, int status) {
  printf("%s\n", message);
  exit(status);
}


x86 assembly (clang, -O0):
<terminate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<terminate>:
push   %rbx
mov    %esi,%ebx
mov    %rdi,%rsi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @terminate(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i32, i32* %4
%8 = call i32 @exit(i32 %7)
unreachable
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @terminate(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 %1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ troca_err(int, int);
int main(int argc, char **argv) {
  int a = 3;
  int b = 8;
  troca_err(a, b);
  printf("a=%d, b=%d\n", a, b);
  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)
movl   $0x3,-0x14(%rbp)
movl   $0x8,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <troca_err@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
mov    $0x8,%esi
call   1040 <troca_err@plt>
lea    0xec9(%rip),%rdi
mov    $0x3,%esi
mov    $0x8,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"a=%d, b=%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @troca_err(i32 3, i32 8)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 3, i32 8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ main_loop(int);
int /*<<< orphan*/ printf(char *, char *, int);
int socket_listen(int);
void server_start(int port) {
  int fd_server = -1;
  fd_server = socket_listen(port);
  printf("MUG server started at %s:%d ...\n", "127.0.0.1", port);
  main_loop(fd_server);
}


x86 assembly (clang, -O0):
<server_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <socket_listen@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edx
lea    0xea9(%rip),%rdi
lea    0xec3(%rip),%rsi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1050 <main_loop@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<server_start>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1040 <socket_listen@plt>
mov    %eax,%ebp
lea    0xebd(%rip),%rdi
lea    0xed7(%rip),%rsi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <main_loop@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"MUG server started at %s:%d ...\0A\00"
@.str.1 = [10 x i8] c"127.0.0.1\00"
define void @server_start(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 -1, i32* %3
%4 = load i32, i32* %2
%5 = call i32 @socket_listen(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %3
%9 = call i32 @main_loop(i32 %8)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"MUG server started at %s:%d ...\0A\00"
@.str.1 = [10 x i8] c"127.0.0.1\00"
define void @server_start(i32 %0) {
%2 = tail call i32 @socket_listen(i32 %0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%4 = tail call i32 @main_loop(i32 %2)
ret void
}
/* Type definitions */
struct katcp_dispatch {
  int dummy;
};

/* Variables and functions */
int log_level_generic_katcp(struct katcp_dispatch *, int, int);
int log_default_cmd_katcp(struct katcp_dispatch *d, int argc) {
  return log_level_generic_katcp(d, argc, 1);
}


x86 assembly (clang, -O0):
<log_default_cmd_katcp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x1,%edx
call   1030 <log_level_generic_katcp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_default_cmd_katcp>:
mov    $0x1,%edx
jmp    1030 <log_level_generic_katcp@plt>

LLVM IR (-O0):
%struct.katcp_dispatch = type { i32 }
define i32 @log_default_cmd_katcp(%struct.katcp_dispatch* %0, i32 %1) {
%3 = alloca %struct.katcp_dispatch*
%4 = alloca i32
store %struct.katcp_dispatch* %0, %struct.katcp_dispatch** %3
store i32 %1, i32* %4
%5 = load %struct.katcp_dispatch*, %struct.katcp_dispatch** %3
%6 = load i32, i32* %4
%7 = call i32 @log_level_generic_katcp(%struct.katcp_dispatch* %5, i32 %6, i32 1)
ret i32 %7
}

LLVM IR (-O2):
%struct.katcp_dispatch = type { i32 }
define i32 @log_default_cmd_katcp(%struct.katcp_dispatch* %0, i32 %1) {
%3 = tail call i32 @log_level_generic_katcp(%struct.katcp_dispatch* %0, i32 %1, i32 1)
ret i32 %3
}
/* Variables and functions */
unsigned long xatoull(char const *);
unsigned long xatoul(const char *str) { return xatoull(str); }


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

x86 assembly (clang, -O2):
<xatoul>:
jmp    1030 <xatoull@plt>

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

LLVM IR (-O2):
define i64 @xatoul(i8* %0) {
%2 = tail call i64 @xatoull(i8* %0)
ret i64 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ array;

/* Variables and functions */
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ printf(char *, int, int);
int *twoSum(int *, int, int);
int main() {
  int array[] = {3, 2, 4};
  int target = 6;
  int *ptr = NULL;
  ptr = twoSum(array, sizeof(array) / sizeof(array[0]), target);
  printf("index 1:%d index 2:%d\n", ptr[0], ptr[1]);
  free(ptr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeb8(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x6,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    $0x3,%esi
call   1050 <twoSum@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%edx
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0xecd(%rip),%eax
mov    %eax,0x8(%rsp)
mov    0xeba(%rip),%rax
mov    %rax,(%rsp)
mov    %rsp,%rdi
mov    $0x3,%esi
mov    $0x6,%edx
call   1050 <twoSum@plt>
mov    %rax,%rbx
mov    (%rax),%esi
mov    0x4(%rax),%edx
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.array = [3 x i32] [i32 3, i32 2, i32 4]
@.str = [23 x i8] c"index 1:%d index 2:%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca i32
%4 = alloca i32*
store i32 0, i32* %1
%5 = bitcast [3 x i32]* %2 to i8*
store i32 6, i32* %3
store i32* null, i32** %4
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%7 = load i32, i32* %3
%8 = call i32* @twoSum(i32* %6, i32 3, i32 %7)
store i32* %8, i32** %4
%9 = load i32*, i32** %4
%10 = getelementptr inbounds i32, i32* %9, i64 0
%11 = load i32, i32* %10
%12 = load i32*, i32** %4
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = load i32, i32* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %14)
%16 = load i32*, i32** %4
%17 = call i32 @free(i32* %16)
ret i32 0
}

LLVM IR (-O2):
@__const.main.array = [3 x i32] [i32 3, i32 2, i32 4]
@.str = [23 x i8] c"index 1:%d index 2:%d\0A\00"
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%4 = call i32* @twoSum(i32* %3, i32 3, i32 6)
%5 = load i32, i32* %4
%6 = getelementptr inbounds i32, i32* %4, i64 1
%7 = load i32, i32* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %7)
%9 = call i32 @free(i32* %4)
ret i32 0
}
/* Variables and functions */
int f176(int *);
int f177(int *p) { return f176(p); }


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

x86 assembly (clang, -O2):
<f177>:
jmp    1030 <f176@plt>

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

LLVM IR (-O2):
define i32 @f177(i32* %0) {
%2 = tail call i32 @f176(i32* %0)
ret i32 %2
}
int td_iscntrl(c)
int c;
{ return ((c >= 0 && c < 32) || (c == 127)); }


x86 assembly (clang, -O0):
<td_iscntrl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1120 <td_iscntrl+0x20>
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     112a <td_iscntrl+0x2a>
cmpl   $0x7f,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<td_iscntrl>:
cmp    $0x20,%edi
setb   %al
cmp    $0x7f,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @td_iscntrl(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 32
br i1 %7, label %11, label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 127
br label %11
11: ; preds = %8, %5
%12 = phi i1 [ true, %5 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @td_iscntrl(i32 %0) {
%2 = icmp ult i32 %0, 32
%3 = icmp eq i32 %0, 127
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
void __aeabi_unwind_cpp_pr1(void) {
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<__aeabi_unwind_cpp_pr1>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <__aeabi_unwind_cpp_pr1+0x9>
jmp    1109 <__aeabi_unwind_cpp_pr1+0x9>

x86 assembly (clang, -O2):
<__aeabi_unwind_cpp_pr1>:
jmp    1100 <__aeabi_unwind_cpp_pr1>

LLVM IR (-O0):
define void @__aeabi_unwind_cpp_pr1() {
br label %1
1: ; preds = %1, %0
br label %1
}

LLVM IR (-O2):
define void @__aeabi_unwind_cpp_pr1() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void devicesChangedCallback(void *p) {
  (void)p;
  printf("Portaudio device list have changed!\n");
}


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

x86 assembly (clang, -O2):
<devicesChangedCallback>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"Portaudio device list have changed!\0A\00"
define void @devicesChangedCallback(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [36 x i8] c"Portaudio device list have changed!\00"
define void @devicesChangedCallback(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
ret void
}
void UARTDMADisable(unsigned long ulBase, unsigned long ulDMAFlags) {
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000048))) &= ~ulDMAFlags;
}


x86 assembly (clang, -O0):
<UARTDMADisable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
xor    $0xffffffffffffffff,%rdx
mov    -0x8(%rbp),%rax
mov    0x48(%rax),%rcx
and    %rdx,%rcx
mov    %rcx,0x48(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTDMADisable>:
not    %rsi
and    %rsi,0x48(%rdi)
ret

LLVM IR (-O0):
define void @UARTDMADisable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = xor i64 %5, -1
%7 = load i64, i64* %3
%8 = add i64 %7, 72
%9 = inttoptr i64 %8 to i64*
%10 = load volatile i64, i64* %9
%11 = and i64 %10, %6
store volatile i64 %11, i64* %9
ret void
}

LLVM IR (-O2):
define void @UARTDMADisable(i64 %0, i64 %1) {
%3 = xor i64 %1, -1
%4 = add i64 %0, 72
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = and i64 %6, %3
store volatile i64 %7, i64* %5
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ outl(int, int /*<<< orphan*/);
void serial_out(unsigned dev, int offset, uint32_t value) {
  outl((0x4000C000 + (0x1000 * (dev))) + offset, value);
}


x86 assembly (clang, -O0):
<serial_out>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
shl    $0xc,%edi
add    $0x4000c000,%edi
add    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <outl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_out>:
shl    $0xc,%edi
add    %esi,%edi
add    $0x4000c000,%edi
mov    %edx,%esi
jmp    1030 <outl@plt>

LLVM IR (-O0):
define void @serial_out(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = mul i32 4096, %7
%9 = add i32 1073790976, %8
%10 = load i32, i32* %5
%11 = add i32 %9, %10
%12 = load i32, i32* %6
%13 = call i32 @outl(i32 %11, i32 %12)
ret void
}

LLVM IR (-O2):
define void @serial_out(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %0, 12
%5 = add i32 %4, 1073790976
%6 = add i32 %5, %1
%7 = tail call i32 @outl(i32 %6, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void c2(void) { puts("c2"); }


x86 assembly (clang, -O0):
<c2>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<c2>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"c2\00"
define void @c2() {
%1 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"c2\00"
define void @c2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
void CloseFiles(FILE *in, FILE *out) {
  fclose(in);
  fclose(out);
  return;
}


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

x86 assembly (clang, -O2):
<CloseFiles>:
push   %rbx
mov    %rsi,%rbx
call   1030 <fclose@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fclose@plt>

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

LLVM IR (-O2):
define void @CloseFiles(i32* nocapture %0, i32* nocapture %1) {
%3 = tail call i32 @fclose(i32* %0)
%4 = tail call i32 @fclose(i32* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AccelStateHandle();
int /*<<< orphan*/ UAVObjRequestUpdate(int /*<<< orphan*/);
void AccelStateRequestUpdate() { UAVObjRequestUpdate(AccelStateHandle()); }


x86 assembly (clang, -O0):
<AccelStateRequestUpdate>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <AccelStateHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjRequestUpdate@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<AccelStateRequestUpdate>:
push   %rax
xor    %eax,%eax
call   1030 <AccelStateHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjRequestUpdate@plt>

LLVM IR (-O0):
define void @AccelStateRequestUpdate() {
%1 = call i32 (...) @AccelStateHandle()
%2 = call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}

LLVM IR (-O2):
define void @AccelStateRequestUpdate() {
%1 = tail call i32 (...) @AccelStateHandle()
%2 = tail call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ at_init();
int /*<<< orphan*/ ide_init();
int /*<<< orphan*/ mem_remap_top_384k();
void at_ide_init() {
  at_init();
  ide_init();
  mem_remap_top_384k();
}


x86 assembly (clang, -O0):
<at_ide_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <at_init@plt>
mov    $0x0,%al
call   1050 <ide_init@plt>
mov    $0x0,%al
call   1030 <mem_remap_top_384k@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<at_ide_init>:
push   %rax
xor    %eax,%eax
call   1040 <at_init@plt>
xor    %eax,%eax
call   1050 <ide_init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <mem_remap_top_384k@plt>

LLVM IR (-O0):
define void @at_ide_init() {
%1 = call i32 (...) @at_init()
%2 = call i32 (...) @ide_init()
%3 = call i32 (...) @mem_remap_top_384k()
ret void
}

LLVM IR (-O2):
define void @at_ide_init() {
%1 = tail call i32 (...) @at_init()
%2 = tail call i32 (...) @ide_init()
%3 = tail call i32 (...) @mem_remap_top_384k()
ret void
}