xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ assert(int);
scalar_t__ strcmp(int /*<<< orphan*/, char *);
int /*<<< orphan*/ strdup(char *);
void example__strdup(void) { assert(strcmp(strdup("abc"), "abc") == 0); }


x86 assembly (clang, -O0):
<example__strdup>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1050 <strdup@plt>
mov    %eax,%edi
lea    0xeb7(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<example__strdup>:
push   %rbx
lea    0xec8(%rip),%rbx
mov    %rbx,%rdi
call   1050 <strdup@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
pop    %rbx
jmp    1040 <assert@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
define void @example__strdup() {
%1 = call i32 @strdup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = call i64 @strcmp(i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
%5 = call i32 @assert(i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"abc\00"
define void @example__strdup() {
%1 = tail call i32 @strdup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i64 @strcmp(i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
void fputs_t() {
  FILE *fp;
  fp = fopen("file.txt", "w+");
  fputs("This is c programming.", fp);
  fputs("This is a system programming language.", fp);
  fclose(fp);
}


x86 assembly (clang, -O0):
<fputs_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xec3(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb2(%rip),%rdi
call   1040 <fputs@plt>
mov    -0x8(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1040 <fputs@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fputs_t>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xeca(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
lea    0xebe(%rip),%rdi
mov    $0x16,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
lea    0xebc(%rip),%rdi
mov    $0x26,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"file.txt\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [23 x i8] c"This is c programming.\00"
@.str.3 = [39 x i8] c"This is a system programming language.\00"
define void @fputs_t() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = call i32 @fputs(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%5 = load i32*, i32** %1
%6 = call i32 @fputs(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32* %5)
%7 = load i32*, i32** %1
%8 = call i32 @fclose(i32* %7)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"file.txt\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [23 x i8] c"This is c programming.\00"
@.str.3 = [39 x i8] c"This is a system programming language.\00"
define void @fputs_t() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i64 22, i64 1, i32* %1)
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i64 38, i64 1, i32* %1)
%4 = tail call i32 @fclose(i32* %1)
ret void
}
float nvDegToRadf(float d) { return d * 3.14159265358979323846f / 180.0f; }


x86 assembly (clang, -O0):
<nvDegToRadf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xef3(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  0xee2(%rip),%xmm1
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvDegToRadf>:
mulss  0xef8(%rip),%xmm0
divss  0xef4(%rip),%xmm0
ret

LLVM IR (-O0):
define float @nvDegToRadf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fmul float %3, 0x400921FB60000000
%5 = fdiv float %4, 1.800000e+02
ret float %5
}

LLVM IR (-O2):
define float @nvDegToRadf(float %0) {
%2 = fmul float %0, 0x400921FB60000000
%3 = fdiv float %2, 1.800000e+02
ret float %3
}
int test_fun(int x, int y) {
  if (x <= 0) {
    return y;
  }
  while (x > y) {
    y = y + x;
  }
  return y;
}


x86 assembly (clang, -O0):
<test_fun>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     111f <test_fun+0x1f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1144 <test_fun+0x44>
jmp    1124 <test_fun+0x24>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    113e <test_fun+0x3e>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <test_fun+0x24>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_fun>:
mov    %esi,%eax
test   %edi,%edi
jle    1116 <test_fun+0x16>
sub    %edi,%eax
nopl   0x0(%rax,%rax,1)
add    %edi,%eax
cmp    %edi,%eax
jl     1110 <test_fun+0x10>
ret

LLVM IR (-O0):
define i32 @test_fun(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 = icmp sle i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %5
store i32 %9, i32* %3
br label %21
10: ; preds = %2
br label %11
11: ; preds = %15, %10
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = icmp sgt i32 %12, %13
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i32, i32* %5
%17 = load i32, i32* %4
%18 = add nsw i32 %16, %17
store i32 %18, i32* %5
br label %11
19: ; preds = %11
%20 = load i32, i32* %5
store i32 %20, i32* %3
br label %21
21: ; preds = %19, %8
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @test_fun(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 1
br i1 %3, label %8, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = icmp slt i32 %5, %0
%7 = add nsw i32 %5, %0
br i1 %6, label %4, label %8
8: ; preds = %4, %2
%9 = phi i32 [ %1, %2 ], [ %5, %4 ]
ret i32 %9
}
/* Variables and functions */
scalar_t__ drv_LW_ABP_poll();
int /*<<< orphan*/ drv_LW_ABP_process_button();
int /*<<< orphan*/ drv_LW_ABP_switchcontact();
int /*<<< orphan*/ drv_LW_ABP_time(int /*<<< orphan*/);
void drv_LW_ABP_timer(void __attribute__((unused)) * notused) {
  while (drv_LW_ABP_poll()) {
    drv_LW_ABP_process_button();
  }
  drv_LW_ABP_time(0);
  drv_LW_ABP_switchcontact();
}


x86 assembly (clang, -O0):
<drv_LW_ABP_timer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1060 <drv_LW_ABP_poll@plt>
cmp    $0x0,%rax
je     1169 <drv_LW_ABP_timer+0x29>
mov    $0x0,%al
call   1050 <drv_LW_ABP_process_button@plt>
jmp    114c <drv_LW_ABP_timer+0xc>
xor    %edi,%edi
call   1040 <drv_LW_ABP_time@plt>
mov    $0x0,%al
call   1030 <drv_LW_ABP_switchcontact@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_LW_ABP_timer>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <drv_LW_ABP_poll@plt>
test   %rax,%rax
je     1165 <drv_LW_ABP_timer+0x25>
xor    %eax,%eax
call   1050 <drv_LW_ABP_process_button@plt>
jmp    1150 <drv_LW_ABP_timer+0x10>
xor    %edi,%edi
call   1040 <drv_LW_ABP_time@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <drv_LW_ABP_switchcontact@plt>

LLVM IR (-O0):
define void @drv_LW_ABP_timer(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %6, %1
%4 = call i64 (...) @drv_LW_ABP_poll()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = call i32 (...) @drv_LW_ABP_process_button()
br label %3
8: ; preds = %3
%9 = call i32 @drv_LW_ABP_time(i32 0)
%10 = call i32 (...) @drv_LW_ABP_switchcontact()
ret void
}

LLVM IR (-O2):
define void @drv_LW_ABP_timer(i8* nocapture readnone %0) {
%2 = tail call i64 (...) @drv_LW_ABP_poll()
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1, %4
%5 = tail call i32 (...) @drv_LW_ABP_process_button()
%6 = tail call i64 (...) @drv_LW_ABP_poll()
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %4
8: ; preds = %4, %1
%9 = tail call i32 @drv_LW_ABP_time(i32 0)
%10 = tail call i32 (...) @drv_LW_ABP_switchcontact()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void ShowIntResult(int result) { printf("The result is: %d \n", result); }


x86 assembly (clang, -O0):
<ShowIntResult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShowIntResult>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"The result is: %d \0A\00"
define void @ShowIntResult(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"The result is: %d \0A\00"
define void @ShowIntResult(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ printf(char *, int);
int totalNQueens(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int nq = 0;
  int ret = totalNQueens(atoi(argv[1]));
  printf("(%d)\n", ret);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1030 <totalNQueens@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1030 <totalNQueens@plt>
lea    0xeb8(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"(%d)\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = tail call i32 @totalNQueens(i32 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}
void isr_int_co_not_avail() {}


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

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

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

LLVM IR (-O2):
define void @isr_int_co_not_avail() {
ret void
}
int test_imm_49int64_highword_reg(long long val) {
  return ((val >> 32) & (0x49 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_49int64_highword_reg>:
movabs $0x4900000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_49int64_highword_reg(i64 %0) {
%2 = and i64 %0, 313532612608
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ int64_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ __checkint_int64_mul_signed_unsigned(int /*<<< orphan*/,
                                                        int /*<<< orphan*/,
                                                        int /*<<< orphan*/ *);
__attribute__((always_)) int64_t
__checkint_int64_mul_unsigned_signed(uint64_t x, int64_t y, int32_t *err) {
  return __checkint_int64_mul_signed_unsigned(y, x, err);
}


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

x86 assembly (clang, -O2):
<__checkint_int64_mul_unsigned_signed>:
mov    %edi,%eax
mov    %esi,%edi
mov    %eax,%esi
jmp    1030 <__checkint_int64_mul_signed_unsigned@plt>

LLVM IR (-O0):
define i32 @__checkint_int64_mul_unsigned_signed(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* %5
%8 = load i32, i32* %4
%9 = load i32*, i32** %6
%10 = call i32 @__checkint_int64_mul_signed_unsigned(i32 %7, i32 %8, i32* %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @__checkint_int64_mul_unsigned_signed(i32 %0, i32 %1, i32* %2) {
%4 = tail call i32 @__checkint_int64_mul_signed_unsigned(i32 %1, i32 %0, i32* %2)
ret i32 %4
}
void ff_hevc_put_hevc_bi_w_epel_v48_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_w_epel_v48_12_sse4() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set_io_bit(int, int);
void TOSH_SET_GREEN_LED_PIN() { set_io_bit(0x34, 1); }


x86 assembly (clang, -O0):
<TOSH_SET_GREEN_LED_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0x34,%edi
mov    $0x1,%esi
call   1030 <set_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_SET_GREEN_LED_PIN>:
mov    $0x34,%edi
mov    $0x1,%esi
jmp    1030 <set_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_SET_GREEN_LED_PIN() {
%1 = call i32 @set_io_bit(i32 52, i32 1)
ret void
}

LLVM IR (-O2):
define void @TOSH_SET_GREEN_LED_PIN() {
%1 = tail call i32 @set_io_bit(i32 52, i32 1)
ret void
}
void destr_function(void *arg) {}


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

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

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

LLVM IR (-O2):
define void @destr_function(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ run_vm();
int main(int argc, char **argv) {
  (void)argc;
  (void)argv;
  run_vm();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @run_vm()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ wiznetRegReadByte(int /*<<< orphan*/, int);
uint8_t wiznetGetSocketMode(uint8_t socket) {
  return wiznetRegReadByte(socket, (0x0000 + 0x0000));
}


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

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

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

LLVM IR (-O2):
define i32 @wiznetGetSocketMode(i32 %0) {
%2 = tail call i32 @wiznetRegReadByte(i32 %0, i32 0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ assert_int_equal(int, int /*<<< orphan*/);
int /*<<< orphan*/ islands_west_files(int);
void islands_west_files_test(void **state) {
  assert_int_equal(0x02, islands_west_files(0x7E));
}


x86 assembly (clang, -O0):
<islands_west_files_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x7e,%edi
call   1030 <islands_west_files@plt>
mov    %eax,%esi
mov    $0x2,%edi
call   1040 <assert_int_equal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<islands_west_files_test>:
push   %rax
mov    $0x7e,%edi
call   1030 <islands_west_files@plt>
mov    $0x2,%edi
mov    %eax,%esi
pop    %rax
jmp    1040 <assert_int_equal@plt>

LLVM IR (-O0):
define void @islands_west_files_test(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = call i32 @islands_west_files(i32 126)
%4 = call i32 @assert_int_equal(i32 2, i32 %3)
ret void
}

LLVM IR (-O2):
define void @islands_west_files_test(i8** nocapture readnone %0) {
%2 = tail call i32 @islands_west_files(i32 126)
%3 = tail call i32 @assert_int_equal(i32 2, i32 %2)
ret void
}
/* Variables and functions */
unsigned int char_to_byte(char const);
scalar_t__ isxdigit(char const);
unsigned int xatoi(const char *s) {
  unsigned int n;
  n = 0;
  while (isxdigit(*s)) {
    n = n * 16 + char_to_byte(*s);
    s++;
  }
  return n;
}


x86 assembly (clang, -O0):
<xatoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isxdigit@plt>
cmp    $0x0,%rax
je     1179 <xatoi+0x59>
mov    -0xc(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <char_to_byte@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1133 <xatoi+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xatoi>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1040 <isxdigit@plt>
test   %rax,%rax
je     1161 <xatoi+0x41>
add    $0x1,%rbx
xor    %ebp,%ebp
nopl   0x0(%rax)
shl    $0x4,%ebp
movsbl -0x1(%rbx),%edi
call   1030 <char_to_byte@plt>
add    %eax,%ebp
movsbl (%rbx),%edi
call   1040 <isxdigit@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1140 <xatoi+0x20>
jmp    1163 <xatoi+0x43>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @xatoi(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %9, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = call i64 @isxdigit(i8 signext %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %18
9: ; preds = %4
%10 = load i32, i32* %3
%11 = mul i32 %10, 16
%12 = load i8*, i8** %2
%13 = load i8, i8* %12
%14 = call i32 @char_to_byte(i8 signext %13)
%15 = add i32 %11, %14
store i32 %15, i32* %3
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
br label %4
18: ; preds = %4
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @xatoi(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i64 @isxdigit(i8 signext %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %1, %5
%6 = phi i32 [ %11, %5 ], [ 0, %1 ]
%7 = phi i8* [ %12, %5 ], [ %0, %1 ]
%8 = shl i32 %6, 4
%9 = load i8, i8* %7
%10 = tail call i32 @char_to_byte(i8 signext %9)
%11 = add i32 %10, %8
%12 = getelementptr inbounds i8, i8* %7, i64 1
%13 = load i8, i8* %12
%14 = tail call i64 @isxdigit(i8 signext %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %1
%17 = phi i32 [ 0, %1 ], [ %11, %5 ]
ret i32 %17
}
void simplify(unsigned int *u, unsigned int *v) {
  unsigned int a, b, tmp;
  a = *u;
  b = *v;
  while (a) {
    tmp = a;
    a = b % tmp;
    b = tmp;
  }
  *u /= b;
  *v /= b;
}


x86 assembly (clang, -O0):
<simplify>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1144 <simplify+0x44>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
xor    %edx,%edx
divl   -0x1c(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    111e <simplify+0x1e>
mov    -0x18(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    (%rax),%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    (%rax),%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<simplify>:
mov    (%rdi),%r8d
mov    (%rsi),%eax
test   %r8d,%r8d
je     111e <simplify+0x1e>
mov    %r8d,%edx
nopl   (%rax)
mov    %edx,%ecx
xor    %edx,%edx
div    %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <simplify+0x10>
jmp    1120 <simplify+0x20>
mov    %eax,%ecx
mov    %r8d,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,(%rdi)
mov    (%rsi),%eax
xor    %edx,%edx
div    %ecx
mov    %eax,(%rsi)
ret

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

LLVM IR (-O2):
define void @simplify(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = icmp eq i32 %3, 0
br i1 %5, label %11, label %6
6: ; preds = %2, %6
%7 = phi i32 [ %9, %6 ], [ %3, %2 ]
%8 = phi i32 [ %7, %6 ], [ %4, %2 ]
%9 = urem i32 %8, %7
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %6
11: ; preds = %6, %2
%12 = phi i32 [ %4, %2 ], [ %7, %6 ]
%13 = udiv i32 %3, %12
store i32 %13, i32* %0
%14 = load i32, i32* %1
%15 = udiv i32 %14, %12
store i32 %15, i32* %1
ret void
}
void free_2d_array(int **arr) {
  int i = 0;
  while (arr[i][0]) {
    free(arr[i]);
    i++;
  }
  free(arr[i]);
  free(arr);
}


x86 assembly (clang, -O0):
<free_2d_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cmpl   $0x0,(%rax)
je     1157 <free_2d_array+0x47>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <free_2d_array+0x13>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_2d_array>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rdi
cmpl   $0x0,(%rdi)
je     1141 <free_2d_array+0x31>
lea    0x8(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
cmpl   $0x0,(%rdi)
jne    1130 <free_2d_array+0x20>
call   1030 <free@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_2d_array(i32** nocapture %0) {
%2 = load i32*, i32** %0
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %1, %5
%6 = phi i64 [ %9, %5 ], [ 0, %1 ]
%7 = phi i32* [ %11, %5 ], [ %2, %1 ]
%8 = bitcast i32* %7 to i8*
tail call void @free(i8* %8)
%9 = add nuw nsw i64 %6, 1
%10 = getelementptr inbounds i32*, i32** %0, i64 %9
%11 = load i32*, i32** %10
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %1
%15 = phi i32* [ %2, %1 ], [ %11, %5 ]
%16 = bitcast i32* %15 to i8*
tail call void @free(i8* %16)
%17 = bitcast i32** %0 to i8*
tail call void @free(i8* %17)
ret void
}
signed char implicitcast_3(signed int x) { return x; }


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

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

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

LLVM IR (-O2):
define signext i8 @implicitcast_3(i32 %0) {
%2 = trunc i32 %0 to i8
ret i8 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ XEvent;
typedef int /*<<< orphan*/ Widget;
typedef int /*<<< orphan*/ String;
typedef int /*<<< orphan*/ Cardinal;

/* Variables and functions */
int /*<<< orphan*/ ringbell();
void nop(Widget w, XEvent *e, String *vector, Cardinal *count) { ringbell(); }


x86 assembly (clang, -O0):
<nop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0x0,%al
call   1030 <ringbell@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @nop(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 = call i32 (...) @ringbell()
ret void
}

LLVM IR (-O2):
define void @nop(i32 %0, i32* nocapture readnone %1, i32* nocapture readnone %2, i32* nocapture readnone %3) {
%5 = tail call i32 (...) @ringbell()
ret void
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ xalloc_die();
void *xcalloc(size_t n, size_t size) {
  void *ptr;
  if (!(ptr = calloc(n, size))) {
    xalloc_die();
  }
  return ptr;
}


x86 assembly (clang, -O0):
<xcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1152 <xcalloc+0x32>
mov    $0x0,%al
call   1040 <xalloc_die@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcalloc>:
push   %rbx
call   1030 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <xcalloc+0x15>
xor    %eax,%eax
call   1040 <xalloc_die@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @xcalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i8* @calloc(i64 %6, i64 %7)
store i8* %8, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = call i32 (...) @xalloc_die()
br label %12
12: ; preds = %10, %2
%13 = load i8*, i8** %5
ret i8* %13
}

LLVM IR (-O2):
define noalias i8* @xcalloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @xalloc_die()
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Variables and functions */
int getchar();
int /*<<< orphan*/ putchar(char);
int main() {
  int c = getchar();
  if (c >= 'A')
    putchar('X');
  else
    putchar('Y');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x41,-0x8(%rbp)
jl     1152 <main+0x32>
mov    $0x58,%edi
call   1030 <putchar@plt>
jmp    115c <main+0x3c>
mov    $0x59,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %edi,%edi
cmp    $0x41,%eax
setge  %dil
xor    $0x59,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @getchar()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @putchar(i8 signext 88)
br label %10
8: ; preds = %0
%9 = call i32 @putchar(i8 signext 89)
br label %10
10: ; preds = %8, %6
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = icmp sgt i32 %1, 64
%3 = select i1 %2, i8 88, i8 89
%4 = tail call i32 @putchar(i8 signext %3)
ret i32 0
}
/* Variables and functions */
int strlen(char const *);
int write(int, char const *, int);
int serialport_write(int fd, const char *str) {
  int len = strlen(str);
  int n = write(fd, str, len);
  if (n != len)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<serialport_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     1165 <serialport_write+0x45>
movl   $0xffffffff,-0x4(%rbp)
jmp    116c <serialport_write+0x4c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serialport_write>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%r14d
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
xor    %ecx,%ecx
cmp    %ebp,%eax
setne  %cl
neg    %ecx
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @serialport_write(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %3)
%5 = icmp ne i32 %4, %3
%6 = sext i1 %5 to i32
ret i32 %6
}
int rangecolor(int n) {
  int n2 = (n == 9 ? 8 : n);
  int ret = (n2 << 5);
  if (ret > 255)
    ret = 255;
  return (ret);
}


x86 assembly (clang, -O0):
<rangecolor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x9,-0x4(%rbp)
jne    111e <rangecolor+0x1e>
mov    $0x8,%eax
mov    %eax,-0x10(%rbp)
jmp    1124 <rangecolor+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x5,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xff,-0xc(%rbp)
jle    1147 <rangecolor+0x47>
movl   $0xff,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rangecolor>:
mov    %edi,%eax
shl    $0x5,%eax
cmp    $0x9,%edi
mov    $0x100,%ecx
cmovne %eax,%ecx
cmp    $0xff,%ecx
mov    $0xff,%eax
cmovl  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @rangecolor(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 9
br i1 %6, label %7, label %8
7: ; preds = %1
br label %10
8: ; preds = %1
%9 = load i32, i32* %2
br label %10
10: ; preds = %8, %7
%11 = phi i32 [ 8, %7 ], [ %9, %8 ]
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = shl i32 %12, 5
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 255
br i1 %15, label %16, label %17
16: ; preds = %10
store i32 255, i32* %4
br label %17
17: ; preds = %16, %10
%18 = load i32, i32* %4
ret i32 %18
}

LLVM IR (-O2):
define i32 @rangecolor(i32 %0) {
%2 = icmp eq i32 %0, 9
%3 = shl i32 %0, 5
%4 = select i1 %2, i32 256, i32 %3
%5 = icmp slt i32 %4, 255
%6 = select i1 %5, i32 %4, i32 255
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int pipe(int *);
void safe_pipe(int pipefd[2]) {
  if (pipe(pipefd) == -1) {
    perror("[fatal] pipe() failed");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<safe_pipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <pipe@plt>
cmp    $0xffffffff,%eax
jne    1164 <safe_pipe+0x34>
lea    0xeab(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_pipe>:
push   %rax
call   1030 <pipe@plt>
cmp    $0xffffffff,%eax
je     113d <safe_pipe+0xd>
pop    %rax
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"[fatal] pipe() failed\00"
define void @safe_pipe(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @pipe(i32* %3)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"[fatal] pipe() failed\00"
define void @safe_pipe(i32* %0) {
%2 = tail call i32 @pipe(i32* %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret void
}
/* Variables and functions */
double pow(double, double);
double opPower(double lhs, double rhs) { return pow(lhs, rhs); }


x86 assembly (clang, -O0):
<opPower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <pow@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opPower>:
jmp    1030 <pow@plt>

LLVM IR (-O0):
define double @opPower(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 = call double @pow(double %5, double %6)
ret double %7
}

LLVM IR (-O2):
define double @opPower(double %0, double %1) {
%3 = tail call double @pow(double %0, double %1)
ret double %3
}
int search(int arr[], int size, int x) {
  int i = 0;
  for (i = 0; i < size; i++)
    if (arr[i] == x)
      return i;
  return -1;
}


x86 assembly (clang, -O0):
<search>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    115a <search+0x5a>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x18(%rbp),%eax
jne    1147 <search+0x47>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1161 <search+0x61>
jmp    114c <search+0x4c>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    111c <search+0x1c>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<search>:
mov    $0xffffffff,%eax
test   %esi,%esi
jle    111e <search+0x1e>
mov    %esi,%esi
xor    %ecx,%ecx
nopl   (%rax)
cmp    %edx,(%rdi,%rcx,4)
je     111f <search+0x1f>
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1110 <search+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @search(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, %2
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %3
%18 = phi i32 [ -1, %3 ], [ %16, %15 ], [ -1, %12 ]
ret i32 %18
}
/* Variables and functions */
int syscall(int, unsigned int, int);
int eventfd(unsigned int initval, int flags) {
  return syscall(284, initval, flags);
}


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

x86 assembly (clang, -O2):
<eventfd>:
mov    %esi,%edx
mov    %edi,%esi
mov    $0x11c,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i32 @eventfd(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 = load i32, i32* %4
%7 = call i32 @syscall(i32 284, i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @eventfd(i32 %0, i32 %1) {
%3 = tail call i32 @syscall(i32 284, i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
float ps2_sqrtf(float);
float ps2_rsqrtf(float x) { return 1.0f / ps2_sqrtf(x); }


x86 assembly (clang, -O0):
<ps2_rsqrtf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <ps2_sqrtf@plt>
movaps %xmm0,%xmm1
movss  0xece(%rip),%xmm0
divss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ps2_rsqrtf>:
push   %rax
call   1030 <ps2_sqrtf@plt>
movss  0xee2(%rip),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @ps2_rsqrtf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @ps2_sqrtf(float %3)
%5 = fdiv float 1.000000e+00, %4
ret float %5
}

LLVM IR (-O2):
define float @ps2_rsqrtf(float %0) {
%2 = tail call float @ps2_sqrtf(float %0)
%3 = fdiv float 1.000000e+00, %2
ret float %3
}
void XLastKnownRequestProcessed() {}


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

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

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

LLVM IR (-O2):
define void @XLastKnownRequestProcessed() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ syscall(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
char ireadc() {
  char ch;
  syscall(0x4963, &ch, 0, 0);
  return ch;
}


x86 assembly (clang, -O0):
<ireadc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4963,%edi
lea    -0x1(%rbp),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <syscall@plt>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ireadc>:
push   %rax
lea    0x7(%rsp),%rsi
mov    $0x4963,%edi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <syscall@plt>
mov    0x7(%rsp),%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @ireadc() {
%1 = alloca i8
%2 = call i32 @syscall(i32 18787, i8* %1, i32 0, i32 0)
%3 = load i8, i8* %1
ret i8 %3
}

LLVM IR (-O2):
define signext i8 @ireadc() {
%1 = alloca i8
%2 = call i32 @syscall(i32 18787, i8* %1, i32 0, i32 0)
%3 = load i8, i8* %1
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ exec(char *);
void test_main(void) { exec((char *)0x20101234); }


x86 assembly (clang, -O0):
<test_main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20101234,%edi
call   1030 <exec@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_main>:
mov    $0x20101234,%edi
jmp    1030 <exec@plt>

LLVM IR (-O0):
define void @test_main() {
%1 = call i32 @exec(i8* inttoptr (i64 537924148 to i8*))
ret void
}

LLVM IR (-O2):
define void @test_main() {
%1 = tail call i32 @exec(i8* inttoptr (i64 537924148 to i8*))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ XHostAddress;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void free_XHostAddress(void *_p) {
  if (_p == NULL)
    abort();
  free((XHostAddress *)_p);
}


x86 assembly (clang, -O0):
<free_XHostAddress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113e <free_XHostAddress+0x1e>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_XHostAddress>:
test   %rdi,%rdi
je     112a <free_XHostAddress+0xa>
jmp    1030 <free@plt>
push   %rax
xor    %eax,%eax
call   1040 <abort@plt>

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

LLVM IR (-O2):
define void @free_XHostAddress(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
%6 = bitcast i8* %0 to i32*
%7 = tail call i32 @free(i32* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0xbb() {
  Assert_real((isdigit(187) == 0),
              "/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_isdigit.c",
              940, ("isdigit should be 0 for 0xbb"));
}


x86 assembly (clang, -O0):
<t_isdigit_0xbb>:
push   %rbp
mov    %rsp,%rbp
mov    $0xbb,%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x3ac,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isdigit_0xbb>:
push   %rax
mov    $0xbb,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x3ac,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 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_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0xbb\00"
define void @t_isdigit_0xbb() {
%1 = call i64 @isdigit(i32 187)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 940, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 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_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0xbb\00"
define void @t_isdigit_0xbb() {
%1 = tail call i64 @isdigit(i32 187)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 940, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}