xunge/DecIR huggingface dataset:
int gcd(int a, int b) {
  int c;
  while (b) {
    c = a % b;
    a = b;
    b = c;
  }
  return a;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112f <gcd+0x2f>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    110a <gcd+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %edi,%eax
test   %esi,%esi
je     111d <gcd+0x1d>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <gcd+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %0, %2 ]
%6 = phi i32 [ %7, %4 ], [ %1, %2 ]
%7 = srem i32 %5, %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %6, %4 ]
ret i32 %10
}
void clean_exit(request) struct request_info *request;
{ exit(0); }


x86 assembly (clang, -O0):
<clean_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<clean_exit>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
%struct.request_info = type opaque
define void @clean_exit(%struct.request_info* %0) {
%2 = alloca %struct.request_info*
store %struct.request_info* %0, %struct.request_info** %2
unreachable
}

LLVM IR (-O2):
%struct.request_info = type opaque
define void @clean_exit(%struct.request_info* nocapture readnone %0) {
tail call void @exit(i32 0)
unreachable
}
void REMR3NotifyFF(void) {}


x86 assembly (clang, -O0):
<REMR3NotifyFF>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @REMR3NotifyFF() {
ret void
}

LLVM IR (-O2):
define void @REMR3NotifyFF() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ standard();
int main(void) {
  standard();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @standard()
ret i32 0
}
void RTFileQueryFsSizes(void) {}


x86 assembly (clang, -O0):
<RTFileQueryFsSizes>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @RTFileQueryFsSizes() {
ret void
}

LLVM IR (-O2):
define void @RTFileQueryFsSizes() {
ret void
}
int _ccv_floor(float x) {
  int xi = (int)x;
  if (x >= 0 || (float)xi == x)
    return xi;
  return xi - 1;
}


x86 assembly (clang, -O0):
<_ccv_floor>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
cvttss2si -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jae    1137 <_ccv_floor+0x37>
cvtsi2ssl -0xc(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jne    1142 <_ccv_floor+0x42>
jp     1142 <_ccv_floor+0x42>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114b <_ccv_floor+0x4b>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ccv_floor>:
cvttss2si %xmm0,%eax
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
setb   %sil
cvttps2dq %xmm0,%xmm1
cvtdq2ps %xmm1,%xmm1
ucomiss %xmm0,%xmm1
setp   %dl
setne  %cl
or     %dl,%cl
and    %sil,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @_ccv_floor(float %0) {
%2 = alloca i32
%3 = alloca float
%4 = alloca i32
store float %0, float* %3
%5 = load float, float* %3
%6 = fptosi float %5 to i32
store i32 %6, i32* %4
%7 = load float, float* %3
%8 = fcmp oge float %7, 0.000000e+00
br i1 %8, label %14, label %9
9: ; preds = %1
%10 = load i32, i32* %4
%11 = sitofp i32 %10 to float
%12 = load float, float* %3
%13 = fcmp oeq float %11, %12
br i1 %13, label %14, label %16
14: ; preds = %9, %1
%15 = load i32, i32* %4
store i32 %15, i32* %2
br label %19
16: ; preds = %9
%17 = load i32, i32* %4
%18 = sub nsw i32 %17, 1
store i32 %18, i32* %2
br label %19
19: ; preds = %16, %14
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @_ccv_floor(float %0) {
%2 = fptosi float %0 to i32
%3 = fcmp ult float %0, 0.000000e+00
%4 = sitofp i32 %2 to float
%5 = fcmp une float %4, %0
%6 = select i1 %3, i1 %5, i1 false
%7 = sext i1 %6 to i32
%8 = add nsw i32 %7, %2
ret i32 %8
}
/* Type definitions */
struct iphdr {
  int dummy;
};
struct icmp {
  int dummy;
};
struct ether_header {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *ICMP_type(struct icmp *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void print_icmp(FILE *f, void *packet, ssize_t psize) {
  struct icmp *icmp = (struct icmp *)(packet + sizeof(struct iphdr) +
                                      sizeof(struct ether_header));
  fprintf(f, "|%s", ICMP_type(icmp));
}


x86 assembly (clang, -O0):
<print_icmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <ICMP_type@plt>
mov    -0x28(%rbp),%rdi
mov    %rax,%rdx
lea    0xe9e(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_icmp>:
push   %rbx
mov    %rdi,%rbx
lea    0x8(%rsi),%rdi
call   1040 <ICMP_type@plt>
lea    0xecc(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
%struct.icmp = type { i32 }
@.str = [4 x i8] c"|%s\00"
define void @print_icmp(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca %struct.icmp*
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %5
%9 = getelementptr i8, i8* %8, i64 4
%10 = getelementptr i8, i8* %9, i64 4
%11 = bitcast i8* %10 to %struct.icmp*
store %struct.icmp* %11, %struct.icmp** %7
%12 = load i32*, i32** %4
%13 = load %struct.icmp*, %struct.icmp** %7
%14 = call i8* @ICMP_type(%struct.icmp* %13)
%15 = call i32 @fprintf(i32* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %14)
ret void
}

LLVM IR (-O2):
%struct.icmp = type { i32 }
@.str = [4 x i8] c"|%s\00"
define void @print_icmp(i32* nocapture %0, i8* %1, i32 %2) {
%4 = getelementptr i8, i8* %1, i64 8
%5 = bitcast i8* %4 to %struct.icmp*
%6 = tail call i8* @ICMP_type(%struct.icmp* %5)
%7 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void SOIL_free_image_data(unsigned char *img_data) {
  if (img_data)
    free((void *)img_data);
}


x86 assembly (clang, -O0):
<SOIL_free_image_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <SOIL_free_image_data+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SOIL_free_image_data>:
test   %rdi,%rdi
je     111a <SOIL_free_image_data+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @SOIL_free_image_data(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @SOIL_free_image_data(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int index(char *ptr1, char *ptr2) {
  int retval = ptr2 - ptr1;
  return retval;
}


x86 assembly (clang, -O0):
<index>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<index>:
mov    %rsi,%rax
sub    %edi,%eax
ret

LLVM IR (-O0):
define i32 @index(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = load i8*, i8** %3
%8 = ptrtoint i8* %6 to i64
%9 = ptrtoint i8* %7 to i64
%10 = sub i64 %8, %9
%11 = trunc i64 %10 to i32
store i32 %11, i32* %5
%12 = load i32, i32* %5
ret i32 %12
}

LLVM IR (-O2):
define i32 @index(i8* %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = ptrtoint i8* %0 to i64
%5 = sub i64 %3, %4
%6 = trunc i64 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ add_array_array(double *, double *, double *, int, int);
void add_arrays_inplace(double *b, double *a, int ncol, int nlns) {
  add_array_array(b, a, b, ncol, nlns);
}


x86 assembly (clang, -O0):
<add_arrays_inplace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1030 <add_array_array@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_arrays_inplace>:
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %rdi,%rdx
jmp    1030 <add_array_array@plt>

LLVM IR (-O0):
define void @add_arrays_inplace(double* %0, double* %1, i32 %2, i32 %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
store double* %0, double** %5
store double* %1, double** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load double*, double** %5
%10 = load double*, double** %6
%11 = load double*, double** %5
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i32 @add_array_array(double* %9, double* %10, double* %11, i32 %12, i32 %13)
ret void
}

LLVM IR (-O2):
define void @add_arrays_inplace(double* %0, double* %1, i32 %2, i32 %3) {
%5 = tail call i32 @add_array_array(double* %0, double* %1, double* %0, i32 %2, i32 %3)
ret void
}
/* Variables and functions */
char dos_file_match_include_slash(char const *, char const *, char);
char dos_file_match(const char *a, const char *b, char is_dir) {
  char matched = dos_file_match_include_slash(a, b, is_dir);
  return (matched);
}


x86 assembly (clang, -O0):
<dos_file_match>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movsbl -0x11(%rbp),%edx
call   1030 <dos_file_match_include_slash@plt>
mov    %al,-0x12(%rbp)
movsbl -0x12(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dos_file_match>:
jmp    1030 <dos_file_match_include_slash@plt>

LLVM IR (-O0):
define signext i8 @dos_file_match(i8* %0, i8* %1, i8 signext %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8 %2, i8* %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = load i8, i8* %6
%11 = call signext i8 @dos_file_match_include_slash(i8* %8, i8* %9, i8 signext %10)
store i8 %11, i8* %7
%12 = load i8, i8* %7
ret i8 %12
}

LLVM IR (-O2):
define signext i8 @dos_file_match(i8* %0, i8* %1, i8 signext %2) {
%4 = tail call signext i8 @dos_file_match_include_slash(i8* %0, i8* %1, i8 signext %2)
ret i8 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int getBoardSize() {
  int boardSize;
  printf("How large would you like your board to be?\n(i.e. X*X)\n> ");
  scanf("%d", &boardSize);
  return boardSize;
}


x86 assembly (clang, -O0):
<getBoardSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getBoardSize>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xf05(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [57 x i8] c"How large would you like your board to be?\0A(i.e. X*X)\0A> \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @getBoardSize() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@.str = [57 x i8] c"How large would you like your board to be?\0A(i.e. X*X)\0A> \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @getBoardSize() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
ret i32 %5
}
int func() {
  int x = 3840;
  { return x; }
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
movl   $0xf00,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
mov    $0xf00,%eax
ret

LLVM IR (-O0):
define i32 @func() {
%1 = alloca i32
store i32 3840, i32* %1
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @func() {
ret i32 3840
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
char *strcasestr(char *, char *);
int main(int argc, char **argv) {
  char *r = 0;
  char s2[] = "c";
  char s1[] = {'a', 'C'};
  char s3 = 0;
  r = strcasestr(s1, s2);
  assert(r == s1 + 1);
  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)
movq   $0x0,-0x18(%rbp)
mov    0xebb(%rip),%ax
mov    %ax,-0x1a(%rbp)
mov    0xeb2(%rip),%ax
mov    %ax,-0x1c(%rbp)
movb   $0x0,-0x1d(%rbp)
lea    -0x1c(%rbp),%rdi
lea    -0x1a(%rbp),%rsi
call   1040 <strcasestr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
lea    -0x1c(%rbp),%rcx
add    $0x1,%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movw   $0x63,0x6(%rsp)
movw   $0x4361,0x4(%rsp)
lea    0x4(%rsp),%rdi
lea    0x6(%rsp),%rsi
call   1040 <strcasestr@plt>
lea    0x5(%rsp),%rcx
xor    %edi,%edi
cmp    %rcx,%rax
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.s2 = [2 x i8] c"c\00"
@__const.main.s1 = [2 x i8] c"aC"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [2 x i8]
%8 = alloca [2 x i8]
%9 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
%10 = bitcast [2 x i8]* %7 to i8*
%11 = bitcast [2 x i8]* %8 to i8*
store i8 0, i8* %9
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%13 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%14 = call i8* @strcasestr(i8* %12, i8* %13)
store i8* %14, i8** %6
%15 = load i8*, i8** %6
%16 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = icmp eq i8* %15, %17
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i16
%4 = alloca i16
%5 = bitcast i16* %3 to i8*
store i16 99, i16* %3
%6 = bitcast i16* %4 to i8*
store i16 17249, i16* %4
%7 = call i8* @strcasestr(i8* %6, i8* %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = icmp eq i8* %7, %8
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
ret i32 0
}
int cmp(const void *key, const void *payload) {
  return ((int)key) - (*(int *)payload);
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
mov    %rdi,%rax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @cmp(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 = ptrtoint i8* %5 to i32
%7 = load i8*, i8** %4
%8 = bitcast i8* %7 to i32*
%9 = load i32, i32* %8
%10 = sub nsw i32 %6, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @cmp(i8* %0, i8* nocapture %1) {
%3 = ptrtoint i8* %0 to i64
%4 = trunc i64 %3 to i32
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ print32(int);
int /*<<< orphan*/ serial_putc(char);
int /*<<< orphan*/ serial_puts(char *);
void show32(char *s, int val) {
  serial_puts(s);
  print32(val);
  serial_putc('\n');
}


x86 assembly (clang, -O0):
<show32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <serial_puts@plt>
mov    -0xc(%rbp),%edi
call   1050 <print32@plt>
mov    $0xa,%edi
call   1030 <serial_putc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show32>:
push   %rbx
mov    %esi,%ebx
call   1040 <serial_puts@plt>
mov    %ebx,%edi
call   1050 <print32@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <serial_putc@plt>

LLVM IR (-O0):
define void @show32(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 @serial_puts(i8* %5)
%7 = load i32, i32* %4
%8 = call i32 @print32(i32 %7)
%9 = call i32 @serial_putc(i8 signext 10)
ret void
}

LLVM IR (-O2):
define void @show32(i8* %0, i32 %1) {
%3 = tail call i32 @serial_puts(i8* %0)
%4 = tail call i32 @print32(i32 %1)
%5 = tail call i32 @serial_putc(i8 signext 10)
ret void
}
/* Variables and functions */
unsigned int getcnt();
unsigned int clock(void) { return getcnt(); }


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

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

LLVM IR (-O0):
define i32 @clock() {
%1 = call i32 (...) @getcnt()
ret i32 %1
}

LLVM IR (-O2):
define i32 @clock() {
%1 = tail call i32 (...) @getcnt()
ret i32 %1
}
int my_strlen(char const *str) {
  int i;
  i = 0;
  while (str[i] != '\0')
    i++;
  return (i);
}


x86 assembly (clang, -O0):
<my_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1132 <my_strlen+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <my_strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <my_strlen+0x10>
ret

LLVM IR (-O0):
define i32 @my_strlen(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @my_strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int ft_strlen(char *);
int /*<<< orphan*/ write(int, char *, int);
void ft_putendl(char *str) {
  char endl;
  endl = '\n';
  write(1, str, ft_strlen(str));
  write(1, &endl, 1);
}


x86 assembly (clang, -O0):
<ft_putendl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0xa,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ft_strlen@plt>
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
mov    $0x1,%edx
lea    -0x9(%rbp),%rsi
mov    %edx,%edi
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putendl>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movb   $0xa,0xf(%rsp)
call   1040 <ft_strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    0xf(%rsp),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @ft_putendl(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
store i8 10, i8* %3
%4 = load i8*, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @ft_strlen(i8* %5)
%7 = call i32 @write(i32 1, i8* %4, i32 %6)
%8 = call i32 @write(i32 1, i8* %3, i32 1)
ret void
}

LLVM IR (-O2):
define void @ft_putendl(i8* %0) {
%2 = alloca i8
store i8 10, i8* %2
%3 = tail call i32 @ft_strlen(i8* %0)
%4 = tail call i32 @write(i32 1, i8* %0, i32 %3)
%5 = call i32 @write(i32 1, i8* %2, i32 1)
ret void
}
/* Variables and functions */
void __gnat_default_lock(void) { return; }


x86 assembly (clang, -O0):
<__gnat_default_lock>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @__gnat_default_lock() {
ret void
}

LLVM IR (-O2):
define void @__gnat_default_lock() {
ret void
}
/* Variables and functions */
int sysapi_get_arch();
int sysapi_is_arch_64bit(void) { return (sysapi_get_arch() == 1); }


x86 assembly (clang, -O0):
<sysapi_is_arch_64bit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <sysapi_get_arch@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sysapi_is_arch_64bit>:
push   %rax
xor    %eax,%eax
call   1030 <sysapi_get_arch@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @sysapi_is_arch_64bit() {
%1 = call i32 (...) @sysapi_get_arch()
%2 = icmp eq i32 %1, 1
%3 = zext i1 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
define i32 @sysapi_is_arch_64bit() {
%1 = tail call i32 (...) @sysapi_get_arch()
%2 = icmp eq i32 %1, 1
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ bar(int);
void foo(int n) {
  if (!n)
    return;
  bar(n - 1);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    112a <foo+0x1a>
jmp    1135 <foo+0x25>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1030 <bar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
test   %edi,%edi
je     111c <foo+0xc>
add    $0xffffffff,%edi
jmp    1030 <bar@plt>
ret

LLVM IR (-O0):
define void @foo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %6, label %5
5: ; preds = %1
br label %10
6: ; preds = %1
%7 = load i32, i32* %2
%8 = sub nsw i32 %7, 1
%9 = call i32 @bar(i32 %8)
br label %10
10: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = add nsw i32 %0, -1
%5 = tail call i32 @bar(i32 %4)
br label %6
6: ; preds = %1, %3
ret void
}
/* Type definitions */
struct rtnlmsg {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct rtnlmsg *);
extern void rtnlmsg_free(struct rtnlmsg *rtnlmsg) { free(rtnlmsg); }


x86 assembly (clang, -O0):
<rtnlmsg_free>:
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):
<rtnlmsg_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.rtnlmsg = type { i32 }
define void @rtnlmsg_free(%struct.rtnlmsg* nocapture %0) {
%2 = tail call i32 @free(%struct.rtnlmsg* %0)
ret void
}
/* Type definitions */
typedef unsigned int uint32_t;

/* Variables and functions */
unsigned int SPI_CSR_DLYBCT(unsigned int);
unsigned int pmc_get_peripheral_clock(unsigned int);
uint32_t _spi_compute_dlybct(uint32_t delay, uint32_t periph_id) {
  uint32_t dlybct =
      ((pmc_get_peripheral_clock(periph_id) / 31250u) * delay) / 100;
  return SPI_CSR_DLYBCT(dlybct);
}


x86 assembly (clang, -O0):
<_spi_compute_dlybct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <pmc_get_peripheral_clock@plt>
mov    $0x7a12,%ecx
xor    %edx,%edx
div    %ecx
imul   -0x4(%rbp),%eax
mov    $0x64,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <SPI_CSR_DLYBCT@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_spi_compute_dlybct>:
push   %rbx
mov    %edi,%ebx
mov    %esi,%edi
call   1040 <pmc_get_peripheral_clock@plt>
mov    %eax,%eax
imul   $0x431bde83,%rax,%rax
shr    $0x2d,%rax
imul   %ebx,%eax
imul   $0x51eb851f,%rax,%rdi
shr    $0x25,%rdi
pop    %rbx
jmp    1030 <SPI_CSR_DLYBCT@plt>

LLVM IR (-O0):
define i32 @_spi_compute_dlybct(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 @pmc_get_peripheral_clock(i32 %6)
%8 = udiv i32 %7, 31250
%9 = load i32, i32* %3
%10 = mul i32 %8, %9
%11 = udiv i32 %10, 100
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = call i32 @SPI_CSR_DLYBCT(i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @_spi_compute_dlybct(i32 %0, i32 %1) {
%3 = tail call i32 @pmc_get_peripheral_clock(i32 %1)
%4 = udiv i32 %3, 31250
%5 = mul i32 %4, %0
%6 = udiv i32 %5, 100
%7 = tail call i32 @SPI_CSR_DLYBCT(i32 %6)
ret i32 %7
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
scalar_t__ fmix32(scalar_t__);
bool test(uint32_t input, uint32_t expected) {
  return (fmix32(input) == expected);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fmix32@plt>
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbx
mov    %rsi,%rbx
call   1030 <fmix32@plt>
xor    %ecx,%ecx
cmp    %rbx,%rax
sete   %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @test(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = call i64 @fmix32(i64 %5)
%7 = load i64, i64* %4
%8 = icmp eq i64 %6, %7
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @test(i64 %0, i64 %1) {
%3 = tail call i64 @fmix32(i64 %0)
%4 = icmp eq i64 %3, %1
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
void CG_MouseEvent(int x, int y) {}


x86 assembly (clang, -O0):
<CG_MouseEvent>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @CG_MouseEvent(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SA1StackRelative(int);
int /*<<< orphan*/ STA8(int /*<<< orphan*/);
void Op83M1(void) { STA8(SA1StackRelative(2)); }


x86 assembly (clang, -O0):
<Op83M1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1040 <SA1StackRelative@plt>
mov    %eax,%edi
call   1030 <STA8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op83M1>:
push   %rax
mov    $0x2,%edi
call   1040 <SA1StackRelative@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <STA8@plt>

LLVM IR (-O0):
define void @Op83M1() {
%1 = call i32 @SA1StackRelative(i32 2)
%2 = call i32 @STA8(i32 %1)
ret void
}

LLVM IR (-O2):
define void @Op83M1() {
%1 = tail call i32 @SA1StackRelative(i32 2)
%2 = tail call i32 @STA8(i32 %1)
ret void
}
int fun(int n) {
  if (n < 2)
    return n;
  return fun(n / 2) * 10 + n % 2;
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1130 <fun+0x20>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115b <fun+0x4b>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <fun@plt>
imul   $0xa,%eax,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
push   %rbx
mov    %edi,%ebx
cmp    $0x1,%edi
jle    112b <fun+0x1b>
mov    %ebx,%edi
shr    %edi
call   1030 <fun@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%eax
and    $0x1,%ebx
or     %eax,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @fun(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 2
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i32, i32* %3
store i32 %7, i32* %2
br label %16
8: ; preds = %1
%9 = load i32, i32* %3
%10 = sdiv i32 %9, 2
%11 = call i32 @fun(i32 %10)
%12 = mul nsw i32 %11, 10
%13 = load i32, i32* %3
%14 = srem i32 %13, 2
%15 = add nsw i32 %12, %14
store i32 %15, i32* %2
br label %16
16: ; preds = %8, %6
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @fun(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %3, label %5
3: ; preds = %1, %5
%4 = phi i32 [ %10, %5 ], [ %0, %1 ]
ret i32 %4
5: ; preds = %1
%6 = lshr i32 %0, 1
%7 = tail call i32 @fun(i32 %6)
%8 = mul nsw i32 %7, 10
%9 = and i32 %0, 1
%10 = or i32 %8, %9
br label %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char EOF;
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/ *);
void copyFileContents(FILE *src, FILE *dest) {
  char c;
  while (1) {
    c = getc(src);
    if (c != EOF) {
      putc(c, dest);
    } else {
      return;
    }
  }
}


x86 assembly (clang, -O0):
<copyFileContents>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getc@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
mov    0x2ea1(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1166 <copyFileContents+0x46>
mov    -0x11(%rbp),%al
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1030 <putc@plt>
jmp    116c <copyFileContents+0x4c>
add    $0x20,%rsp
pop    %rbp
ret
jmp    1130 <copyFileContents+0x10>

x86 assembly (clang, -O2):
<copyFileContents>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <getc@plt>
mov    0x2eb1(%rip),%r15
cmp    (%r15),%al
je     1158 <copyFileContents+0x38>
nopl   0x0(%rax)
movsbl %al,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
mov    %rbx,%rdi
call   1040 <getc@plt>
cmp    (%r15),%al
jne    1140 <copyFileContents+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i8 0
define void @copyFileContents(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i8
store i32* %0, i32** %3
store i32* %1, i32** %4
br label %6
6: ; preds = %2, %19
%7 = load i32*, i32** %3
%8 = call signext i8 @getc(i32* %7)
store i8 %8, i8* %5
%9 = load i8, i8* %5
%10 = sext i8 %9 to i32
%11 = load i8, i8* @EOF
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %10, %12
br i1 %13, label %14, label %18
14: ; preds = %6
%15 = load i8, i8* %5
%16 = load i32*, i32** %4
%17 = call i32 @putc(i8 signext %15, i32* %16)
br label %19
18: ; preds = %6
ret void
19: ; preds = %14
br label %6
}

LLVM IR (-O2):
@EOF = global i8 0
define void @copyFileContents(i32* nocapture %0, i32* nocapture %1) {
%3 = tail call signext i8 @getc(i32* %0)
%4 = load i8, i8* @EOF
%5 = icmp eq i8 %3, %4
br i1 %5, label %12, label %6
6: ; preds = %2, %6
%7 = phi i8 [ %9, %6 ], [ %3, %2 ]
%8 = tail call i32 @putc(i8 signext %7, i32* %1)
%9 = tail call signext i8 @getc(i32* %0)
%10 = load i8, i8* @EOF
%11 = icmp eq i8 %9, %10
br i1 %11, label %12, label %6
12: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ link_failure();
void texit(void) {
  exit(1);
  link_failure();
}


x86 assembly (clang, -O0):
<texit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<texit>:
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @texit() {
%1 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @texit() {
%1 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
double RAND_MAX;
double rand();
size_t TestingJittered(size_t index, size_t total) {
  return (rand() * 1.0 / RAND_MAX <= 0.9) ? index : (index - 2);
}


x86 assembly (clang, -O0):
<TestingJittered>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
movaps %xmm0,%xmm1
movsd  0xed6(%rip),%xmm0
mulsd  %xmm0,%xmm1
mov    0x2eab(%rip),%rax
divsd  (%rax),%xmm1
movsd  0xeb7(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1160 <TestingJittered+0x50>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    116c <TestingJittered+0x5c>
mov    -0x8(%rbp),%rax
sub    $0x2,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestingJittered>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <rand@plt>
mov    0x2ec6(%rip),%rax
divsd  (%rax),%xmm0
lea    -0x2(%rbx),%rax
movsd  0xece(%rip),%xmm1
ucomisd %xmm0,%xmm1
cmovae %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define i64 @TestingJittered(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = call double (...) @rand()
%6 = fmul double %5, 1.000000e+00
%7 = load double, double* @RAND_MAX
%8 = fdiv double %6, %7
%9 = fcmp ole double %8, 9.000000e-01
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i64, i64* %3
br label %15
12: ; preds = %2
%13 = load i64, i64* %3
%14 = sub i64 %13, 2
br label %15
15: ; preds = %12, %10
%16 = phi i64 [ %11, %10 ], [ %14, %12 ]
ret i64 %16
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define i64 @TestingJittered(i64 %0, i64 %1) {
%3 = tail call double (...) @rand()
%4 = load double, double* @RAND_MAX
%5 = fdiv double %3, %4
%6 = fcmp ole double %5, 9.000000e-01
%7 = add i64 %0, -2
%8 = select i1 %6, i64 %0, i64 %7
ret i64 %8
}
int main() {
  int x;
_L:
  if (x || ++x) {
    x++;
    x++;
    x++;
    x++;
    x++;
    x++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1127 <main+0x27>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     115d <main+0x5d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ hl_cache_init();
int /*<<< orphan*/ hl_gc_init();
void hl_global_init() {
  hl_gc_init();
  hl_cache_init();
}


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

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

LLVM IR (-O0):
define void @hl_global_init() {
%1 = call i32 (...) @hl_gc_init()
%2 = call i32 (...) @hl_cache_init()
ret void
}

LLVM IR (-O2):
define void @hl_global_init() {
%1 = tail call i32 (...) @hl_gc_init()
%2 = tail call i32 (...) @hl_cache_init()
ret void
}
/* Type definitions */
struct oscap_string {
  int dummy;
};
struct oscap_buffer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ oscap_buffer_clear(struct oscap_buffer *);
void oscap_string_clear(struct oscap_string *s) {
  oscap_buffer_clear((struct oscap_buffer *)s);
}


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

x86 assembly (clang, -O2):
<oscap_string_clear>:
jmp    1030 <oscap_buffer_clear@plt>

LLVM IR (-O0):
%struct.oscap_string = type { i32 }
%struct.oscap_buffer = type { i32 }
define void @oscap_string_clear(%struct.oscap_string* %0) {
%2 = alloca %struct.oscap_string*
store %struct.oscap_string* %0, %struct.oscap_string** %2
%3 = load %struct.oscap_string*, %struct.oscap_string** %2
%4 = bitcast %struct.oscap_string* %3 to %struct.oscap_buffer*
%5 = call i32 @oscap_buffer_clear(%struct.oscap_buffer* %4)
ret void
}

LLVM IR (-O2):
%struct.oscap_string = type { i32 }
%struct.oscap_buffer = type { i32 }
define void @oscap_string_clear(%struct.oscap_string* %0) {
%2 = bitcast %struct.oscap_string* %0 to %struct.oscap_buffer*
%3 = tail call i32 @oscap_buffer_clear(%struct.oscap_buffer* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int random_int(int);
int random_int2(int low, int high) {
  assert(low >= 0 && high >= 0 && low <= high);
  return low + random_int(high - low + 1);
}


x86 assembly (clang, -O0):
<random_int2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x9(%rbp)
jl     1158 <random_int2+0x38>
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jl     1158 <random_int2+0x38>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setle  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
sub    -0x4(%rbp),%edi
add    $0x1,%edi
call   1040 <random_int@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_int2>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %esi,%ebp
sub    %edi,%ebp
setge  %al
or     %edi,%esi
setns  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
add    $0x1,%ebp
mov    %ebp,%edi
call   1040 <random_int@plt>
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @random_int2(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 = icmp sge i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = icmp sle i32 %11, %12
br label %14
14: ; preds = %10, %7, %2
%15 = phi i1 [ false, %7 ], [ false, %2 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = load i32, i32* %3
%21 = sub nsw i32 %19, %20
%22 = add nsw i32 %21, 1
%23 = call i32 @random_int(i32 %22)
%24 = add nsw i32 %18, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @random_int2(i32 %0, i32 %1) {
%3 = or i32 %1, %0
%4 = icmp sge i32 %1, %0
%5 = icmp sgt i32 %3, -1
%6 = and i1 %4, %5
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = sub i32 1, %0
%10 = add i32 %9, %1
%11 = tail call i32 @random_int(i32 %10)
%12 = add nsw i32 %11, %0
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fclose(int /*<<< orphan*/ *);
int c_fclose(void *stream) { return fclose((FILE *)stream); }


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

x86 assembly (clang, -O2):
<c_fclose>:
jmp    1030 <fclose@plt>

LLVM IR (-O0):
define i32 @c_fclose(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = call i32 @fclose(i32* %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @c_fclose(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 @fclose(i32* %2)
ret i32 %3
}
int comparator(const void *a, const void *b) {
  return *((int *)a) - *((int *)b);
}


x86 assembly (clang, -O0):
<comparator>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<comparator>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @comparator(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 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @comparator(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ status_bar_message_i(char const *, int /*<<< orphan*/);
void status_bar_message(const char message[]) {
  status_bar_message_i(message, 0);
}


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

x86 assembly (clang, -O2):
<status_bar_message>:
xor    %esi,%esi
jmp    1030 <status_bar_message_i@plt>

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

LLVM IR (-O2):
define void @status_bar_message(i8* %0) {
%2 = tail call i32 @status_bar_message_i(i8* %0, i32 0)
ret void
}
void monte_nums_of_vars(long *ilen, long *olen, long *ffunc) {
  *ilen = 3;
  *olen = 2;
  *ffunc = 1;
  return;
}


x86 assembly (clang, -O0):
<monte_nums_of_vars>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movq   $0x3,(%rax)
mov    -0x10(%rbp),%rax
movq   $0x2,(%rax)
mov    -0x18(%rbp),%rax
movq   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<monte_nums_of_vars>:
movq   $0x3,(%rdi)
movq   $0x2,(%rsi)
movq   $0x1,(%rdx)
ret

LLVM IR (-O0):
define void @monte_nums_of_vars(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
store i64 3, i64* %7
%8 = load i64*, i64** %5
store i64 2, i64* %8
%9 = load i64*, i64** %6
store i64 1, i64* %9
ret void
}

LLVM IR (-O2):
define void @monte_nums_of_vars(i64* nocapture writeonly %0, i64* nocapture writeonly %1, i64* nocapture writeonly %2) {
store i64 3, i64* %0
store i64 2, i64* %1
store i64 1, i64* %2
ret void
}
double dmin(double x, double y) { return (x < y) ? x : y; }


x86 assembly (clang, -O0):
<dmin>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1131 <dmin+0x31>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    113b <dmin+0x3b>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmin>:
minsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @dmin(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 = fcmp olt double %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load double, double* %3
br label %12
10: ; preds = %2
%11 = load double, double* %4
br label %12
12: ; preds = %10, %8
%13 = phi double [ %9, %8 ], [ %11, %10 ]
ret double %13
}

LLVM IR (-O2):
define double @dmin(double %0, double %1) {
%3 = fcmp olt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
/* Variables and functions */
int ch_forw_get();
int /*<<< orphan*/ flush();
int /*<<< orphan*/ putchr(int);
void cat_file(void) {
  int c;
  while ((c = ch_forw_get()) != (-1))
    putchr(c);
  flush();
}


x86 assembly (clang, -O0):
<cat_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <ch_forw_get@plt>
mov    %eax,-0x4(%rbp)
cmp    $0xffffffff,%eax
je     1158 <cat_file+0x28>
mov    -0x4(%rbp),%edi
call   1040 <putchr@plt>
jmp    1138 <cat_file+0x8>
mov    $0x0,%al
call   1030 <flush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cat_file>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <ch_forw_get@plt>
cmp    $0xffffffff,%eax
je     1155 <cat_file+0x25>
mov    %eax,%edi
call   1040 <putchr@plt>
jmp    1140 <cat_file+0x10>
xor    %eax,%eax
pop    %rcx
jmp    1030 <flush@plt>

LLVM IR (-O0):
define void @cat_file() {
%1 = alloca i32
br label %2
2: ; preds = %5, %0
%3 = call i32 (...) @ch_forw_get()
store i32 %3, i32* %1
%4 = icmp ne i32 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* %1
%7 = call i32 @putchr(i32 %6)
br label %2
8: ; preds = %2
%9 = call i32 (...) @flush()
ret void
}

LLVM IR (-O2):
define void @cat_file() {
%1 = tail call i32 (...) @ch_forw_get()
%2 = icmp eq i32 %1, -1
br i1 %2, label %8, label %3
3: ; preds = %0, %3
%4 = phi i32 [ %6, %3 ], [ %1, %0 ]
%5 = tail call i32 @putchr(i32 %4)
%6 = tail call i32 (...) @ch_forw_get()
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %3
8: ; preds = %3, %0
%9 = tail call i32 (...) @flush()
ret void
}