xunge/DecIR huggingface dataset:
int ls_costN_nm5_work(int *sz_arg, int *sz_res, int *sz_iw, int *sz_w) {
  if (sz_arg)
    *sz_arg = 1;
  if (sz_res)
    *sz_res = 2;
  if (sz_iw)
    *sz_iw = 0;
  if (sz_w)
    *sz_w = 1;
  return 0;
}


x86 assembly (clang, -O0):
<ls_costN_nm5_work>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1129 <ls_costN_nm5_work+0x29>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     113e <ls_costN_nm5_work+0x3e>
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     1153 <ls_costN_nm5_work+0x53>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     1168 <ls_costN_nm5_work+0x68>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_costN_nm5_work>:
test   %rdi,%rdi
je     110b <ls_costN_nm5_work+0xb>
movl   $0x1,(%rdi)
test   %rsi,%rsi
je     1116 <ls_costN_nm5_work+0x16>
movl   $0x2,(%rsi)
test   %rdx,%rdx
je     1121 <ls_costN_nm5_work+0x21>
movl   $0x0,(%rdx)
test   %rcx,%rcx
je     112c <ls_costN_nm5_work+0x2c>
movl   $0x1,(%rcx)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ls_costN_nm5_work(i32* writeonly %0, i32* writeonly %1, i32* writeonly %2, i32* writeonly %3) {
%5 = icmp eq i32* %0, null
br i1 %5, label %7, label %6
6: ; preds = %4
store i32 1, i32* %0
br label %7
7: ; preds = %6, %4
%8 = icmp eq i32* %1, null
br i1 %8, label %10, label %9
9: ; preds = %7
store i32 2, i32* %1
br label %10
10: ; preds = %9, %7
%11 = icmp eq i32* %2, null
br i1 %11, label %13, label %12
12: ; preds = %10
store i32 0, i32* %2
br label %13
13: ; preds = %12, %10
%14 = icmp eq i32* %3, null
br i1 %14, label %16, label %15
15: ; preds = %13
store i32 1, i32* %3
br label %16
16: ; preds = %15, %13
ret i32 0
}
void _libaroma_font_hb_destroy_function(void) {}


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

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

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

LLVM IR (-O2):
define void @_libaroma_font_hb_destroy_function() {
ret void
}
/* Type definitions */
struct pagevec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __pagevec_lru_add_anon(struct pagevec *);
scalar_t__ pagevec_count(struct pagevec *);
void pagevec_lru_add_anon(struct pagevec *pvec) {
  if (pagevec_count(pvec))
    __pagevec_lru_add_anon(pvec);
}


x86 assembly (clang, -O0):
<pagevec_lru_add_anon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <pagevec_count@plt>
cmp    $0x0,%rax
je     1148 <pagevec_lru_add_anon+0x28>
mov    -0x8(%rbp),%rdi
call   1040 <__pagevec_lru_add_anon@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pagevec_lru_add_anon>:
push   %rbx
mov    %rdi,%rbx
call   1030 <pagevec_count@plt>
test   %rax,%rax
je     1137 <pagevec_lru_add_anon+0x17>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <__pagevec_lru_add_anon@plt>
pop    %rbx
ret

LLVM IR (-O0):
%struct.pagevec = type { i32 }
define void @pagevec_lru_add_anon(%struct.pagevec* %0) {
%2 = alloca %struct.pagevec*
store %struct.pagevec* %0, %struct.pagevec** %2
%3 = load %struct.pagevec*, %struct.pagevec** %2
%4 = call i64 @pagevec_count(%struct.pagevec* %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load %struct.pagevec*, %struct.pagevec** %2
%8 = call i32 @__pagevec_lru_add_anon(%struct.pagevec* %7)
br label %9
9: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
%struct.pagevec = type { i32 }
define void @pagevec_lru_add_anon(%struct.pagevec* %0) {
%2 = tail call i64 @pagevec_count(%struct.pagevec* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @__pagevec_lru_add_anon(%struct.pagevec* %0)
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(float *, float const *, int);
int /*<<< orphan*/ nvgTransformMultiply(float *, float *);
void nvgTransformPremultiply(float *t, const float *s) {
  float s2[6];
  memcpy(s2, s, sizeof(float) * 6);
  nvgTransformMultiply(s2, t);
  memcpy(t, s2, sizeof(float) * 6);
}


x86 assembly (clang, -O0):
<nvgTransformPremultiply>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x18,%edx
call   1030 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <nvgTransformMultiply@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x18,%edx
call   1030 <memcpy@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvgTransformPremultiply>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x18,%edx
call   1030 <memcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <nvgTransformMultiply@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x18,%edx
call   1030 <memcpy@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @nvgTransformPremultiply(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca [6 x float]
store float* %0, float** %3
store float* %1, float** %4
%6 = getelementptr inbounds [6 x float], [6 x float]* %5, i64 0, i64 0
%7 = load float*, float** %4
%8 = call i32 @memcpy(float* %6, float* %7, i32 24)
%9 = getelementptr inbounds [6 x float], [6 x float]* %5, i64 0, i64 0
%10 = load float*, float** %3
%11 = call i32 @nvgTransformMultiply(float* %9, float* %10)
%12 = load float*, float** %3
%13 = getelementptr inbounds [6 x float], [6 x float]* %5, i64 0, i64 0
%14 = call i32 @memcpy(float* %12, float* %13, i32 24)
ret void
}

LLVM IR (-O2):
define void @nvgTransformPremultiply(float* %0, float* %1) {
%3 = alloca [6 x float]
%4 = bitcast [6 x float]* %3 to i8*
%5 = getelementptr inbounds [6 x float], [6 x float]* %3, i64 0, i64 0
%6 = call i32 @memcpy(float* %5, float* %1, i32 24)
%7 = call i32 @nvgTransformMultiply(float* %5, float* %0)
%8 = call i32 @memcpy(float* %0, float* %5, i32 24)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ notify_pvcall(char *);
int pvCaptureToBuffer(unsigned long ulBoardNum, void **hEvent,
                      unsigned long ulFlags, int nNumFrames, void *pBuffer,
                      int ulLineIncrement, long long *pTimeStamp) {
  notify_pvcall("f");
  return (0);
}


x86 assembly (clang, -O0):
<pvCaptureToBuffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
lea    0xec6(%rip),%rdi
call   1030 <notify_pvcall@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pvCaptureToBuffer>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <notify_pvcall@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"f\00"
define i32 @pvCaptureToBuffer(i64 %0, i8** %1, i64 %2, i32 %3, i8* %4, i32 %5, i64* %6) {
%8 = alloca i64
%9 = alloca i8**
%10 = alloca i64
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i64*
store i64 %0, i64* %8
store i8** %1, i8*** %9
store i64 %2, i64* %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i32 %5, i32* %13
store i64* %6, i64** %14
%15 = call i32 @notify_pvcall(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"f\00"
define i32 @pvCaptureToBuffer(i64 %0, i8** nocapture readnone %1, i64 %2, i32 %3, i8* nocapture readnone %4, i32 %5, i64* nocapture readnone %6) {
%8 = tail call i32 @notify_pvcall(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
scalar_t__ default_hash(char *, int);
void test_hash_function_long_compare() {
  char *one = "test";
  char *two = "testlong";
  assert(default_hash(one, 20) != default_hash(two, 20));
}


x86 assembly (clang, -O0):
<test_hash_function_long_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x14,%esi
call   1030 <default_hash@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x14,%esi
call   1030 <default_hash@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_hash_function_long_compare>:
push   %rbx
lea    0xed8(%rip),%rdi
mov    $0x14,%esi
call   1030 <default_hash@plt>
mov    %rax,%rbx
lea    0xec9(%rip),%rdi
mov    $0x14,%esi
call   1030 <default_hash@plt>
xor    %edi,%edi
cmp    %rax,%rbx
setne  %dil
pop    %rbx
jmp    1040 <assert@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"test\00"
@.str.1 = [9 x i8] c"testlong\00"
define void @test_hash_function_long_compare() {
%1 = alloca i8*
%2 = alloca i8*
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %1
%4 = call i64 @default_hash(i8* %3, i32 20)
%5 = load i8*, i8** %2
%6 = call i64 @default_hash(i8* %5, i32 20)
%7 = icmp ne i64 %4, %6
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"test\00"
@.str.1 = [9 x i8] c"testlong\00"
define void @test_hash_function_long_compare() {
%1 = tail call i64 @default_hash(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 20)
%2 = tail call i64 @default_hash(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 20)
%3 = icmp ne i64 %1, %2
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
ret void
}
/* Variables and functions */
int test_if1(void) {
  if (1) {
    return 'a';
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_if1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x61,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_if1() {
ret i32 97
}

LLVM IR (-O2):
define i32 @test_if1() {
ret i32 97
}
/* Variables and functions */
int /*<<< orphan*/ sim_read(int /*<<< orphan*/, int);
void test_read_whole_disk(void) {
  sim_read(0, (2 * ((1 << (9 + ((15 - 9) - (12 - 9)))) * (1 << 9))));
}


x86 assembly (clang, -O0):
<test_read_whole_disk>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0x400000,%esi
call   1030 <sim_read@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_read_whole_disk>:
xor    %edi,%edi
mov    $0x400000,%esi
jmp    1030 <sim_read@plt>

LLVM IR (-O0):
define void @test_read_whole_disk() {
%1 = call i32 @sim_read(i32 0, i32 4194304)
ret void
}

LLVM IR (-O2):
define void @test_read_whole_disk() {
%1 = tail call i32 @sim_read(i32 0, i32 4194304)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isxdigit(int);
void t_isxdigit_0x36() {
  Assert_real((isxdigit(54)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isxdigit.c",
              275, ("isxdigit should be 1 for 6"));
}


x86 assembly (clang, -O0):
<t_isxdigit_0x36>:
push   %rbp
mov    %rsp,%rbp
mov    $0x36,%edi
call   1030 <isxdigit@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x113,%edx
lea    0xf66(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isxdigit_0x36>:
push   %rax
mov    $0x36,%edi
call   1030 <isxdigit@plt>
lea    0xece(%rip),%rsi
lea    0xf70(%rip),%rcx
mov    %eax,%edi
mov    $0x113,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isxdigit.c\00"
@.str.1 = [27 x i8] c"isxdigit should be 1 for 6\00"
define void @t_isxdigit_0x36() {
%1 = call i32 @isxdigit(i32 54)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 275, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isxdigit.c\00"
@.str.1 = [27 x i8] c"isxdigit should be 1 for 6\00"
define void @t_isxdigit_0x36() {
%1 = tail call i32 @isxdigit(i32 54)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 275, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clear_packet(int);
void clear_all(void) {
  int i;
  for (i = 0; i < 600; i++)
    clear_packet(i);
}


x86 assembly (clang, -O0):
<clear_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x258,-0x4(%rbp)
jge    1142 <clear_all+0x32>
mov    -0x4(%rbp),%edi
call   1030 <clear_packet@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <clear_all+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_all>:
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <clear_packet@plt>
add    $0x1,%ebx
cmp    $0x258,%ebx
jne    1120 <clear_all+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @clear_all() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @clear_packet(i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 600
br i1 %5, label %6, label %1
6: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void *childfn(void *ptr) {
  printf("child says hello\n");
  return NULL;
}


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

x86 assembly (clang, -O2):
<childfn>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"child says hello\0A\00"
define i8* @childfn(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret i8* null
}

LLVM IR (-O2):
@str = [17 x i8] c"child says hello\00"
define noalias i8* @childfn(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
ret i8* null
}
unsigned int j(unsigned int a) { return ~a; }


x86 assembly (clang, -O0):
<j>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @j(i32 %0) {
%2 = xor i32 %0, -1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ fexpectf(char *, int, int, float);
void test_float() {
  double a = 4.0;
  float b = a;
  fexpectf(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/conversion.c",
      19, 4, b);
  ;
}


x86 assembly (clang, -O0):
<test_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  0xee0(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
lea    0xec9(%rip),%rdi
mov    $0x13,%esi
mov    $0x4,%edx
call   1030 <fexpectf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_float>:
lea    0xeed(%rip),%rdi
movss  0xee1(%rip),%xmm0
mov    $0x13,%esi
mov    $0x4,%edx
jmp    1030 <fexpectf@plt>

LLVM IR (-O0):
@.str = [133 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/conversion.c\00"
define void @test_float() {
%1 = alloca double
%2 = alloca float
store double 4.000000e+00, double* %1
%3 = load double, double* %1
%4 = fptrunc double %3 to float
store float %4, float* %2
%5 = load float, float* %2
%6 = call i32 @fexpectf(i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str, i64 0, i64 0), i32 19, i32 4, float %5)
ret void
}

LLVM IR (-O2):
@.str = [133 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/conversion.c\00"
define void @test_float() {
%1 = tail call i32 @fexpectf(i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str, i64 0, i64 0), i32 19, i32 4, float 4.000000e+00)
ret void
}
/* Variables and functions */
int floatToRawIntBits(float);
float const intBitsToFloat(int);
__attribute__((always_)) const float fabsfk(float x) {
  return intBitsToFloat(0x7fffffffL & floatToRawIntBits(x));
}


x86 assembly (clang, -O0):
<fabsfk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <floatToRawIntBits@plt>
cltq
and    $0x7fffffff,%rax
mov    %eax,%edi
call   1030 <intBitsToFloat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fabsfk>:
push   %rax
call   1040 <floatToRawIntBits@plt>
and    $0x7fffffff,%eax
mov    %eax,%edi
pop    %rax
jmp    1030 <intBitsToFloat@plt>

LLVM IR (-O0):
define float @fabsfk(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @floatToRawIntBits(float %3)
%5 = sext i32 %4 to i64
%6 = and i64 2147483647, %5
%7 = trunc i64 %6 to i32
%8 = call float @intBitsToFloat(i32 %7)
ret float %8
}

LLVM IR (-O2):
define float @fabsfk(float %0) {
%2 = tail call i32 @floatToRawIntBits(float %0)
%3 = and i32 %2, 2147483647
%4 = tail call float @intBitsToFloat(i32 %3)
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ arg_char3(char, char, char);
void arg_char2(char a, char b) { arg_char3(a, b, b + 1); }


x86 assembly (clang, -O0):
<arg_char2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    -0x1(%rbp),%dl
mov    -0x2(%rbp),%cl
movsbl -0x2(%rbp),%eax
add    $0x1,%eax
movsbl %dl,%edi
movsbl %cl,%esi
movsbl %al,%edx
call   1030 <arg_char3@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arg_char2>:
lea    0x1(%rsi),%eax
movsbl %al,%edx
jmp    1030 <arg_char3@plt>

LLVM IR (-O0):
define void @arg_char2(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = load i8, i8* %4
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = add nsw i32 %8, 1
%10 = trunc i32 %9 to i8
%11 = call i32 @arg_char3(i8 signext %5, i8 signext %6, i8 signext %10)
ret void
}

LLVM IR (-O2):
define void @arg_char2(i8 signext %0, i8 signext %1) {
%3 = add i8 %1, 1
%4 = tail call i32 @arg_char3(i8 signext %0, i8 signext %1, i8 signext %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PathActionHandle();
int /*<<< orphan*/ UAVObjLogging(int /*<<< orphan*/);
void PathActionLogging() { UAVObjLogging(PathActionHandle()); }


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

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

LLVM IR (-O0):
define void @PathActionLogging() {
%1 = call i32 (...) @PathActionHandle()
%2 = call i32 @UAVObjLogging(i32 %1)
ret void
}

LLVM IR (-O2):
define void @PathActionLogging() {
%1 = tail call i32 (...) @PathActionHandle()
%2 = tail call i32 @UAVObjLogging(i32 %1)
ret void
}
int strcmp(const char *a, const char *b) {
  while (*a && *a == *b) {
    a++;
    b++;
  }
  return (*a - *b);
}


x86 assembly (clang, -O0):
<strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1137 <strcmp+0x37>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1147 <strcmp+0x47>
jmp    1164 <strcmp+0x64>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <strcmp+0xc>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
mov    (%rdi),%al
test   %al,%al
je     1123 <strcmp+0x23>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
cmp    (%rsi),%al
jne    1125 <strcmp+0x25>
add    $0x1,%rsi
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <strcmp+0x10>
xor    %eax,%eax
movsbl %al,%eax
movsbl (%rsi),%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %11
%6 = phi i8 [ %14, %11 ], [ %3, %2 ]
%7 = phi i8* [ %13, %11 ], [ %1, %2 ]
%8 = phi i8* [ %12, %11 ], [ %0, %2 ]
%9 = load i8, i8* %7
%10 = icmp eq i8 %6, %9
br i1 %10, label %11, label %16
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = load i8, i8* %12
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %11, %2
%17 = phi i8* [ %1, %2 ], [ %13, %11 ], [ %7, %5 ]
%18 = phi i8 [ 0, %2 ], [ 0, %11 ], [ %6, %5 ]
%19 = sext i8 %18 to i32
%20 = load i8, i8* %17
%21 = sext i8 %20 to i32
%22 = sub nsw i32 %19, %21
ret i32 %22
}
/* Variables and functions */
int /*<<< orphan*/ DebugLogControlHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void DebugLogControlUpdated() { UAVObjUpdated(DebugLogControlHandle()); }


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

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

LLVM IR (-O0):
define void @DebugLogControlUpdated() {
%1 = call i32 (...) @DebugLogControlHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @DebugLogControlUpdated() {
%1 = tail call i32 (...) @DebugLogControlHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}
int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }


x86 assembly (clang, -O0):
<GCD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1141 <GCD+0x31>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%esi
call   1030 <GCD@plt>
mov    %eax,-0xc(%rbp)
jmp    1147 <GCD+0x37>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
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
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = srem i32 %9, %10
%12 = call i32 @GCD(i32 %8, i32 %11)
br label %15
13: ; preds = %2
%14 = load i32, i32* %3
br label %15
15: ; preds = %13, %7
%16 = phi i32 [ %12, %7 ], [ %14, %13 ]
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 [ %7, %4 ], [ %1, %2 ]
%6 = phi i32 [ %5, %4 ], [ %0, %2 ]
%7 = srem i32 %6, %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %5, %4 ]
ret i32 %10
}
void foo281(int p) {}


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

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

LLVM IR (-O0):
define void @foo281(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @foo281(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ kprintf(char *);
void DAbt_Routine(void) { kprintf("DAbt\n"); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"DAbt\0A\00"
define void @DAbt_Routine() {
%1 = tail call i32 @kprintf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
float exp(float const);
float gauss_1d(float m, float s, float x) {
  float const dx = (x - m) / s;
  return exp(-dx * dx / 2);
}


x86 assembly (clang, -O0):
<gauss_1d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  -0x10(%rbp),%xmm0
movss  0xea6(%rip),%xmm1
divss  %xmm1,%xmm0
call   1030 <exp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gauss_1d>:
subss  %xmm0,%xmm2
divss  %xmm1,%xmm2
mulss  %xmm2,%xmm2
mulss  0xedc(%rip),%xmm2
movaps %xmm2,%xmm0
jmp    1030 <exp@plt>

LLVM IR (-O0):
define float @gauss_1d(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%8 = load float, float* %6
%9 = load float, float* %4
%10 = fsub float %8, %9
%11 = load float, float* %5
%12 = fdiv float %10, %11
store float %12, float* %7
%13 = load float, float* %7
%14 = fneg float %13
%15 = load float, float* %7
%16 = fmul float %14, %15
%17 = fdiv float %16, 2.000000e+00
%18 = call float @exp(float %17)
ret float %18
}

LLVM IR (-O2):
define float @gauss_1d(float %0, float %1, float %2) {
%4 = fsub float %2, %0
%5 = fdiv float %4, %1
%6 = fneg float %5
%7 = fmul float %5, %6
%8 = fmul float %7, 5.000000e-01
%9 = tail call float @exp(float %8)
ret float %9
}
int imin(int x, int y) {
  if (x < y)
    return (x);
  return (y);
}


x86 assembly (clang, -O0):
<imin>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1121 <imin+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <imin+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<imin>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

LLVM IR (-O0):
define i32 @imin(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 slt i32 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* %4
store i32 %10, i32* %3
br label %13
11: ; preds = %2
%12 = load i32, i32* %5
store i32 %12, i32* %3
br label %13
13: ; preds = %11, %9
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @imin(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
float circle(float *sqr_len, float *sqr_ans) {
  *sqr_ans = (*sqr_len * *sqr_len);
  return (*sqr_ans);
}


x86 assembly (clang, -O0):
<circle>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mulss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<circle>:
movss  (%rdi),%xmm0
mulss  %xmm0,%xmm0
movss  %xmm0,(%rsi)
ret

LLVM IR (-O0):
define float @circle(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %3
%6 = load float, float* %5
%7 = load float*, float** %3
%8 = load float, float* %7
%9 = fmul float %6, %8
%10 = load float*, float** %4
store float %9, float* %10
%11 = load float*, float** %4
%12 = load float, float* %11
ret float %12
}

LLVM IR (-O2):
define float @circle(float* nocapture %0, float* nocapture writeonly %1) {
%3 = load float, float* %0
%4 = fmul float %3, %3
store float %4, float* %1
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void abort_due_to_error(int rc) {
  fprintf(stderr, "Error: %d\n");
  exit(-1);
}


x86 assembly (clang, -O0):
<abort_due_to_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<abort_due_to_error>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"Error: %d\0A\00"
define void @abort_due_to_error(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"Error: %d\0A\00"
define void @abort_due_to_error(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int, int);
void cross(int pos_x, int pos_y, int color) {
  printf("L %d %d %d %d %d 0 0 0 -1 -1\n", pos_x + -50, pos_y, pos_x + 50,
         pos_y, color);
  printf("L %d %d %d %d %d 0 0 0 -1 -1\n", pos_x, pos_y + 50, pos_x, pos_y - 50,
         color);
}


x86 assembly (clang, -O0):
<cross>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%esi
add    $0xffffffce,%esi
mov    -0x8(%rbp),%edx
mov    -0x4(%rbp),%ecx
add    $0x32,%ecx
mov    -0x8(%rbp),%r8d
mov    -0xc(%rbp),%r9d
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
add    $0x32,%edx
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%r8d
sub    $0x32,%r8d
mov    -0xc(%rbp),%r9d
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cross>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%ebx
mov    %edi,%ebp
lea    -0x32(%rbp),%esi
lea    0x32(%rbp),%ecx
lea    0xed5(%rip),%r15
mov    %r15,%rdi
mov    %ebx,%edx
mov    %ebx,%r8d
mov    %r14d,%r9d
call   1030 <printf@plt>
lea    0x32(%rbx),%edx
add    $0xffffffce,%ebx
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    %r14d,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"L %d %d %d %d %d 0 0 0 -1 -1\0A\00"
define void @cross(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 = add nsw i32 %7, -50
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 50
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9, i32 %11, i32 %12, i32 %13)
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 50
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = sub nsw i32 %19, 50
%21 = load i32, i32* %6
%22 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %17, i32 %18, i32 %20, i32 %21)
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"L %d %d %d %d %d 0 0 0 -1 -1\0A\00"
define void @cross(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %0, -50
%5 = add nsw i32 %0, 50
%6 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %1, i32 %5, i32 %1, i32 %2)
%7 = add nsw i32 %1, 50
%8 = add nsw i32 %1, -50
%9 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %7, i32 %0, i32 %8, i32 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ GLenum;

/* Variables and functions */
GLenum glGetError(void) {}


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

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

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

LLVM IR (-O2):
define i32 @glGetError() {
ret i32 undef
}
void assign(double *a, const double *b) {
  a[0] = b[0];
  a[1] = b[1];
  a[2] = b[2];
}


x86 assembly (clang, -O0):
<assign>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @assign(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %4
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double*, double** %3
%9 = getelementptr inbounds double, double* %8, i64 0
store double %7, double* %9
%10 = load double*, double** %4
%11 = getelementptr inbounds double, double* %10, i64 1
%12 = load double, double* %11
%13 = load double*, double** %3
%14 = getelementptr inbounds double, double* %13, i64 1
store double %12, double* %14
%15 = load double*, double** %4
%16 = getelementptr inbounds double, double* %15, i64 2
%17 = load double, double* %16
%18 = load double*, double** %3
%19 = getelementptr inbounds double, double* %18, i64 2
store double %17, double* %19
ret void
}

LLVM IR (-O2):
define void @assign(double* nocapture writeonly %0, double* nocapture %1) {
%3 = load double, double* %1
store double %3, double* %0
%4 = getelementptr inbounds double, double* %1, i64 1
%5 = load double, double* %4
%6 = getelementptr inbounds double, double* %0, i64 1
store double %5, double* %6
%7 = getelementptr inbounds double, double* %1, i64 2
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %0, i64 2
store double %8, double* %9
ret void
}
int add_core_to_monitor(__attribute__((unused)) int core) { return 0; }


x86 assembly (clang, -O0):
<add_core_to_monitor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @add_core_to_monitor(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *strdup(char const *);
int tls_set_string(const char **dest, const char *src) {
  free((char *)*dest);
  *dest = NULL;
  if (src != NULL)
    if ((*dest = strdup(src)) == NULL)
      return -1;
  return 0;
}


x86 assembly (clang, -O0):
<tls_set_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     117d <tls_set_string+0x5d>
mov    -0x18(%rbp),%rdi
call   1040 <strdup@plt>
mov    -0x10(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    1178 <tls_set_string+0x58>
movl   $0xffffffff,-0x4(%rbp)
jmp    1184 <tls_set_string+0x64>
jmp    117d <tls_set_string+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tls_set_string>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
movq   $0x0,(%rbx)
test   %r14,%r14
je     114e <tls_set_string+0x2e>
mov    %r14,%rdi
call   1040 <strdup@plt>
mov    %rax,(%rbx)
test   %rax,%rax
je     1152 <tls_set_string+0x32>
xor    %eax,%eax
jmp    1157 <tls_set_string+0x37>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @tls_set_string(i8** nocapture %0, i8* %1) {
%3 = load i8*, i8** %0
%4 = tail call i32 @free(i8* %3)
store i8* null, i8** %0
%5 = icmp eq i8* %1, null
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i8* @strdup(i8* %1)
store i8* %7, i8** %0
%8 = icmp eq i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %6, %2
br label %10
10: ; preds = %6, %9
%11 = phi i32 [ 0, %9 ], [ -1, %6 ]
ret i32 %11
}
char *strchr(register const char *t, int c) {
  register char ch;
  ch = c;
  for (;;) {
    if (*t == ch)
      break;
    if (!*t)
      return 0;
    ++t;
  }
  return (char *)t;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %al,-0x15(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x15(%rbp),%ecx
cmp    %ecx,%eax
jne    1129 <strchr+0x29>
jmp    1154 <strchr+0x54>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1143 <strchr+0x43>
movq   $0x0,-0x8(%rbp)
jmp    115c <strchr+0x5c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1111 <strchr+0x11>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
movsbl %sil,%ecx
movsbl (%rdi),%edx
cmp    %edx,%ecx
je     1120 <strchr+0x20>
xchg   %ax,%ax
test   %dl,%dl
je     1121 <strchr+0x21>
movsbl 0x1(%rax),%edx
add    $0x1,%rax
cmp    %edx,%ecx
jne    1110 <strchr+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
%3 = shl i32 %1, 24
%4 = ashr exact i32 %3, 24
%5 = load i8, i8* %0
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %4, %6
br i1 %7, label %17, label %8
8: ; preds = %2, %12
%9 = phi i8 [ %14, %12 ], [ %5, %2 ]
%10 = phi i8* [ %13, %12 ], [ %0, %2 ]
%11 = icmp eq i8 %9, 0
br i1 %11, label %17, label %12
12: ; preds = %8
%13 = getelementptr inbounds i8, i8* %10, i64 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %4, %15
br i1 %16, label %17, label %8
17: ; preds = %8, %12, %2
%18 = phi i8* [ %0, %2 ], [ %13, %12 ], [ null, %8 ]
ret i8* %18
}
int hmn_linear_bend(struct context_data *ctx, struct channel_data *xc) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.context_data = type opaque
%struct.channel_data = type opaque
define i32 @hmn_linear_bend(%struct.context_data* %0, %struct.channel_data* %1) {
%3 = alloca %struct.context_data*
%4 = alloca %struct.channel_data*
store %struct.context_data* %0, %struct.context_data** %3
store %struct.channel_data* %1, %struct.channel_data** %4
ret i32 0
}

LLVM IR (-O2):
%struct.context_data = type opaque
%struct.channel_data = type opaque
define i32 @hmn_linear_bend(%struct.context_data* nocapture readnone %0, %struct.channel_data* nocapture readnone %1) {
ret i32 0
}
int isprint(int ch) {
  ch &= 0x7F;
  return (ch >= 0x20 && ch < 0x7F);
}


x86 assembly (clang, -O0):
<isprint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7f,%eax
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1129 <isprint+0x29>
cmpl   $0x7f,-0x4(%rbp)
setl   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isprint>:
and    $0x7f,%edi
cmp    $0x20,%edi
setae  %al
cmp    $0x7f,%edi
setne  %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @isprint(i32 %0) {
%2 = and i32 %0, 127
%3 = icmp ugt i32 %2, 31
%4 = icmp ne i32 %2, 127
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ input_chars(char *);
int /*<<< orphan*/ print_chars(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sort_chars(char *);
int main() {
  char chars[10];
  input_chars(chars);
  print_chars(chars);
  printf(" -> ");
  sort_chars(chars);
  print_chars(chars);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rdi
call   1050 <input_chars@plt>
lea    -0xe(%rbp),%rdi
call   1030 <print_chars@plt>
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
lea    -0xe(%rbp),%rdi
call   1060 <sort_chars@plt>
lea    -0xe(%rbp),%rdi
call   1030 <print_chars@plt>
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <input_chars@plt>
mov    %rbx,%rdi
call   1030 <print_chars@plt>
lea    0xe8f(%rip),%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1070 <sort_chars@plt>
mov    %rbx,%rdi
call   1030 <print_chars@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c" -> \00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @input_chars(i8* %2)
%4 = call i32 @print_chars(i8* %2)
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @sort_chars(i8* %2)
%7 = call i32 @print_chars(i8* %2)
%8 = call i32 @putchar(i32 10)
ret i32 0
}