xunge/DecIR huggingface dataset:
/* Variables and functions */
int GET_NWORDS(int);
void UNSET_ALL_DIGIT(unsigned int *v, int len) {
  int size = GET_NWORDS(len);
  for (int j = 0; j < size; j++)
    v[j] = 0;
}


x86 assembly (clang, -O0):
<UNSET_ALL_DIGIT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <GET_NWORDS@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    115a <UNSET_ALL_DIGIT+0x4a>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1131 <UNSET_ALL_DIGIT+0x21>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UNSET_ALL_DIGIT>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1040 <GET_NWORDS@plt>
test   %eax,%eax
jle    113f <UNSET_ALL_DIGIT+0x1f>
mov    %eax,%edx
shl    $0x2,%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @UNSET_ALL_DIGIT(i32* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @GET_NWORDS(i32 %1)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = bitcast i32* %0 to i8*
%7 = zext i32 %3 to i64
%8 = shl nuw nsw i64 %7, 2
br label %9
9: ; preds = %5, %2
ret void
}
int cmd_power_switch_ctrl(struct sigma_dut *dut, struct sigma_conn *conn,
                          struct sigma_cmd *cmd) {
  return 1;
}


x86 assembly (clang, -O0):
<cmd_power_switch_ctrl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.sigma_dut = type opaque
%struct.sigma_conn = type opaque
%struct.sigma_cmd = type opaque
define i32 @cmd_power_switch_ctrl(%struct.sigma_dut* %0, %struct.sigma_conn* %1, %struct.sigma_cmd* %2) {
%4 = alloca %struct.sigma_dut*
%5 = alloca %struct.sigma_conn*
%6 = alloca %struct.sigma_cmd*
store %struct.sigma_dut* %0, %struct.sigma_dut** %4
store %struct.sigma_conn* %1, %struct.sigma_conn** %5
store %struct.sigma_cmd* %2, %struct.sigma_cmd** %6
ret i32 1
}

LLVM IR (-O2):
%struct.sigma_dut = type opaque
%struct.sigma_conn = type opaque
%struct.sigma_cmd = type opaque
define i32 @cmd_power_switch_ctrl(%struct.sigma_dut* nocapture readnone %0, %struct.sigma_conn* nocapture readnone %1, %struct.sigma_cmd* nocapture readnone %2) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int removeDuplicates(int *, int);
int main() {
  int arr[5] = {1, 1, 2, 3, 3};
  printf("%d\n", removeDuplicates(arr, 5));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1040 <removeDuplicates@plt>
mov    %eax,%esi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xee6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1040 <removeDuplicates@plt>
lea    0xec7(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@__const.main.arr = [5 x i32] [i32 1, i32 1, i32 2, i32 3, i32 3]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @removeDuplicates(i32* %3, i32 5)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
bool nrf51_errata_44(void) { return false; }


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

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

LLVM IR (-O0):
define i32 @nrf51_errata_44() {
ret i32 0
}

LLVM IR (-O2):
define i32 @nrf51_errata_44() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fc8080_isr(void *);
void bbm_com_isr(void *handle) { fc8080_isr(handle); }


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

x86 assembly (clang, -O2):
<bbm_com_isr>:
jmp    1030 <fc8080_isr@plt>

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

LLVM IR (-O2):
define void @bbm_com_isr(i8* %0) {
%2 = tail call i32 @fc8080_isr(i8* %0)
ret void
}
int verify_benchmark(int r) {
  int expected = 89;
  if (r != expected)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<verify_benchmark>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x59,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1126 <verify_benchmark+0x26>
movl   $0x0,-0x4(%rbp)
jmp    112d <verify_benchmark+0x2d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_benchmark>:
xor    %eax,%eax
cmp    $0x59,%edi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @verify_benchmark(i32 %0) {
%2 = icmp eq i32 %0, 89
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ assert(void *);
void *dyn_alloc(long, int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, long);
void *zmalloc0(long size) {
  void *res = dyn_alloc(size, 8);
  assert(res);
  memset(res, 0, size);
  return res;
}


x86 assembly (clang, -O0):
<zmalloc0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1030 <dyn_alloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zmalloc0>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x8,%esi
call   1030 <dyn_alloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <assert@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @zmalloc0(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @dyn_alloc(i64 %4, i32 8)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @assert(i8* %6)
%8 = load i8*, i8** %3
%9 = load i64, i64* %2
%10 = call i32 @memset(i8* %8, i32 0, i64 %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @zmalloc0(i64 %0) {
%2 = tail call i8* @dyn_alloc(i64 %0, i32 8)
%3 = tail call i32 @assert(i8* %2)
%4 = tail call i32 @memset(i8* %2, i32 0, i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ print(char *, char *);
void gen_reset_func() { print("M31", "reset functions"); }


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

x86 assembly (clang, -O2):
<gen_reset_func>:
lea    0xee9(%rip),%rdi
lea    0xee6(%rip),%rsi
jmp    1030 <print@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"M31\00"
@.str.1 = [16 x i8] c"reset functions\00"
define void @gen_reset_func() {
%1 = call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"M31\00"
@.str.1 = [16 x i8] c"reset functions\00"
define void @gen_reset_func() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}
long read(long fd, void *buffer, unsigned long size) {
  long ret = 0;
  asm("movq $3,%%rax \n\t"
      "movq %1,%%rbx \n\t"
      "movq %2,%%rcx \n\t"
      "movq %3, %%rdx \n\t"
      "int $0x80  \n\t"
      "movq %%rax,%0  \n\t"
      : "=m"(ret)
      : "m"(fd), "m"(buffer), "m"(size));
  return ret;
}


x86 assembly (clang, -O0):
<read>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    $0x3,%rax
mov    -0x8(%rbp),%rbx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rdx
int    $0x80
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read>:
mov    %rdi,-0x8(%rsp)
mov    %rsi,-0x10(%rsp)
mov    %rdx,-0x18(%rsp)
movq   $0x0,-0x20(%rsp)
mov    $0x3,%rax
mov    -0x8(%rsp),%rbx
mov    -0x10(%rsp),%rcx
mov    -0x18(%rsp),%rdx
int    $0x80
mov    %rax,-0x20(%rsp)
mov    -0x20(%rsp),%rax
ret

LLVM IR (-O0):
define i64 @read(i64 %0, i8* %1, i64 %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
store i64 0, i64* %7
%8 = load i64, i64* %7
ret i64 %8
}

LLVM IR (-O2):
define i64 @read(i64 %0, i8* %1, i64 %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = bitcast i64* %7 to i8*
store i64 0, i64* %7
%9 = load i64, i64* %7
ret i64 %9
}
int false() { return !true(); }


x86 assembly (clang, -O0):
<false>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <true@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<false>:
push   %rax
xor    %eax,%eax
call   1030 <true@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @false() {
%1 = call i32 (...) @true()
%2 = icmp ne i32 %1, 0
%3 = xor i1 %2, true
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @false() {
%1 = tail call i32 (...) @true()
%2 = icmp eq i32 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double, double, double);
int handler_result_kulibin(double dx, double dy, double dz, double f) {
  printf("move(%f, %f, %f)\n", dx, dy, dz);
}


x86 assembly (clang, -O0):
<handler_result_kulibin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [18 x i8] c"move(%f, %f, %f)\0A\00"
define i32 @handler_result_kulibin(double %0, double %1, double %2, double %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), double %0, double %1, double %2)
ret i32 undef
}
void rop3_73_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  unsigned char stk4;
  stk4 = T & *D;
  stk3 = S | stk4;
  stk2 = *D ^ stk3;
  stk1 = T ^ stk2;
  stk1 = ~stk1;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_73_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
and    %ecx,%eax
mov    %al,-0xe(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xe(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xd(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_73_1_0>:
mov    (%rdi),%al
mov    %eax,%ecx
and    %dl,%cl
or     %sil,%cl
xor    %al,%dl
xor    %cl,%dl
or     %sil,%dl
not    %dl
and    %sil,%al
or     %dl,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_73_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%11 = load i8, i8* %6
%12 = zext i8 %11 to i32
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = and i32 %12, %15
%17 = trunc i32 %16 to i8
store i8 %17, i8* %10
%18 = load i8, i8* %5
%19 = zext i8 %18 to i32
%20 = load i8, i8* %10
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
%23 = trunc i32 %22 to i8
store i8 %23, i8* %9
%24 = load i8*, i8** %4
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = load i8, i8* %9
%28 = zext i8 %27 to i32
%29 = xor i32 %26, %28
%30 = trunc i32 %29 to i8
store i8 %30, i8* %8
%31 = load i8, i8* %6
%32 = zext i8 %31 to i32
%33 = load i8, i8* %8
%34 = zext i8 %33 to i32
%35 = xor i32 %32, %34
%36 = trunc i32 %35 to i8
store i8 %36, i8* %7
%37 = load i8, i8* %7
%38 = zext i8 %37 to i32
%39 = xor i32 %38, -1
%40 = trunc i32 %39 to i8
store i8 %40, i8* %7
%41 = load i8, i8* %7
%42 = zext i8 %41 to i32
%43 = load i8, i8* %5
%44 = zext i8 %43 to i32
%45 = xor i32 %44, -1
%46 = and i32 %42, %45
%47 = load i8*, i8** %4
%48 = load i8, i8* %47
%49 = zext i8 %48 to i32
%50 = load i8, i8* %5
%51 = zext i8 %50 to i32
%52 = and i32 %49, %51
%53 = or i32 %46, %52
%54 = trunc i32 %53 to i8
%55 = load i8*, i8** %4
store i8 %54, i8* %55
ret void
}

LLVM IR (-O2):
define void @rop3_73_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = and i8 %4, %2
%6 = or i8 %5, %1
%7 = xor i8 %4, %2
%8 = xor i8 %7, %6
%9 = or i8 %8, %1
%10 = xor i8 %9, -1
%11 = and i8 %4, %1
%12 = or i8 %11, %10
store i8 %12, i8* %0
ret void
}
int qsort_desc_uivector(const void *a, const void *b) {
  return (*(unsigned *)b - *(unsigned *)a);
}


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

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

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

LLVM IR (-O2):
define i32 @qsort_desc_uivector(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %0 to i32*
%6 = load i32, i32* %5
%7 = sub i32 %4, %6
ret i32 %7
}
void removeNewline(char *string, int size) {
  int i;
  for (i = 0; i < size; ++i) {
    if (string[i] == '\n') {
      string[i] = '\0';
      return;
    }
  }
}


x86 assembly (clang, -O0):
<removeNewline>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1157 <removeNewline+0x57>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1144 <removeNewline+0x44>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1157 <removeNewline+0x57>
jmp    1149 <removeNewline+0x49>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <removeNewline+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<removeNewline>:
test   %esi,%esi
jle    111f <removeNewline+0x1f>
mov    %esi,%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmpb   $0xa,(%rdi,%rcx,1)
je     1120 <removeNewline+0x20>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1110 <removeNewline+0x10>
ret
movb   $0x0,(%rdi,%rcx,1)
ret

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

LLVM IR (-O2):
define void @removeNewline(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %17
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %14
%7 = phi i64 [ 0, %4 ], [ %15, %14 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 10
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = and i64 %7, 4294967295
%13 = getelementptr inbounds i8, i8* %0, i64 %12
store i8 0, i8* %13
br label %17
14: ; preds = %6
%15 = add nuw nsw i64 %7, 1
%16 = icmp eq i64 %15, %5
br i1 %16, label %17, label %6
17: ; preds = %14, %2, %11
ret void
}
unsigned int *mt_save_generic_timer(unsigned int *container, int sw) {
  return container;
}


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

x86 assembly (clang, -O2):
<mt_save_generic_timer>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i32* @mt_save_generic_timer(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
ret i32* %5
}

LLVM IR (-O2):
define i32* @mt_save_generic_timer(i32* readnone returned %0, i32 %1) {
ret i32* %0
}
unsigned xrop3_254_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = T | S;
  stk1 = D | stk2;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}


x86 assembly (clang, -O0):
<xrop3_254_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x10(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0x10(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_254_1_1>:
mov    %esi,%ecx
or     %edi,%esi
mov    %edi,%eax
shl    $0x8,%eax
shl    $0x8,%ecx
mov    %ecx,%edx
or     %eax,%edx
or     $0xff,%edx
or     %esi,%eax
or     %ecx,%eax
not    %eax
and    %edx,%eax
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_254_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = or i32 %12, %14
store i32 %15, i32* %6
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = load i32, i32* %6
%24 = or i32 %22, %23
store i32 %24, i32* %9
%25 = load i32, i32* %5
%26 = load i32, i32* %9
%27 = or i32 %25, %26
store i32 %27, i32* %8
%28 = load i32, i32* %8
%29 = load i32, i32* %6
%30 = xor i32 %29, -1
%31 = and i32 %28, %30
%32 = load i32, i32* %7
%33 = xor i32 %32, -1
%34 = and i32 %31, %33
%35 = load i32, i32* %5
%36 = load i32, i32* %6
%37 = and i32 %35, %36
%38 = or i32 %34, %37
%39 = load i32, i32* %5
%40 = load i32, i32* %7
%41 = and i32 %39, %40
%42 = or i32 %38, %41
ret i32 %42
}

LLVM IR (-O2):
define i32 @xrop3_254_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = zext i8 %1 to i32
%6 = shl nuw nsw i32 %5, 8
%7 = or i32 %6, %4
%8 = or i32 %7, 255
%9 = or i8 %1, %0
%10 = zext i8 %9 to i32
%11 = or i32 %4, %10
%12 = or i32 %11, %6
%13 = xor i32 %12, -1
%14 = and i32 %8, %13
%15 = or i32 %14, %10
ret i32 %15
}
void main_menu() {}


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

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

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

LLVM IR (-O2):
define void @main_menu() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/);
void *thread_main(void *arg) { pthread_exit(0); }


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

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

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

LLVM IR (-O2):
define noalias i8* @thread_main(i8* nocapture readnone %0) {
%2 = tail call i32 @pthread_exit(i32 0)
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ write_instr(int);
void eval_add(void) { write_instr(0x15); }


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

x86 assembly (clang, -O2):
<eval_add>:
mov    $0x15,%edi
jmp    1030 <write_instr@plt>

LLVM IR (-O0):
define void @eval_add() {
%1 = call i32 @write_instr(i32 21)
ret void
}

LLVM IR (-O2):
define void @eval_add() {
%1 = tail call i32 @write_instr(i32 21)
ret void
}
/* Variables and functions */
int a();
int b();
int main() { return a() + b(); }


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <a@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <b@plt>
add    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @a()
%3 = call i32 (...) @b()
%4 = add nsw i32 %2, %3
ret i32 %4
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @a()
%2 = tail call i32 (...) @b()
%3 = add nsw i32 %2, %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ ctest_assert_true(int, char *);
int strings_free(char *);
int test_strings_free() {
  {
    char *src = NULL;
    int result = strings_free(src);
    char *assert_message = "Testing strings free for NULL..";
    int assert_result = (result == 0) ? 1 : 0;
    ctest_assert_true(assert_result, assert_message);
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_strings_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strings_free@plt>
mov    %eax,-0xc(%rbp)
lea    0xebd(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1040 <ctest_assert_true@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_strings_free>:
push   %rax
xor    %edi,%edi
call   1030 <strings_free@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
lea    0xec9(%rip),%rsi
call   1040 <ctest_assert_true@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Testing strings free for NULL..\00"
define i32 @test_strings_free() {
%1 = alloca i8*
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* null, i8** %1
%5 = load i8*, i8** %1
%6 = call i32 @strings_free(i8* %5)
store i32 %6, i32* %2
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8** %3
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 1, i32 0
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = load i8*, i8** %3
%13 = call i32 @ctest_assert_true(i32 %11, i8* %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"Testing strings free for NULL..\00"
define i32 @test_strings_free() {
%1 = tail call i32 @strings_free(i8* null)
%2 = icmp eq i32 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @ctest_assert_true(i32 %3, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void foo694(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo694(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ mbus_remote_register_write(int, int, int);
void pmu_set_sleep_low() {
  mbus_remote_register_write(
      0x6, 0x17, ((3 << 14) | (0 << 13) | (1 << 9) | (1 << 5) | (1)));
  delay(200);
  mbus_remote_register_write(
      0x6, 0x17, ((3 << 14) | (0 << 13) | (1 << 9) | (1 << 5) | (1)));
  delay(200);
  mbus_remote_register_write(0x6, 0x15,
                             ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) |
                              (0 << 13) | (1 << 9) | (1 << 5) | (1)));
  delay(200);
}


x86 assembly (clang, -O0):
<pmu_set_sleep_low>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6,%edi
mov    $0x17,%esi
mov    $0xc221,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0xc8,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x17,%esi
mov    $0xc221,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0xc8,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x15,%esi
mov    $0xc221,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0xc8,%edi
call   1030 <delay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmu_set_sleep_low>:
push   %rax
mov    $0x6,%edi
mov    $0x17,%esi
mov    $0xc221,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0xc8,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x17,%esi
mov    $0xc221,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0xc8,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x15,%esi
mov    $0xc221,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0xc8,%edi
pop    %rax
jmp    1030 <delay@plt>

LLVM IR (-O0):
define void @pmu_set_sleep_low() {
%1 = call i32 @mbus_remote_register_write(i32 6, i32 23, i32 49697)
%2 = call i32 @delay(i32 200)
%3 = call i32 @mbus_remote_register_write(i32 6, i32 23, i32 49697)
%4 = call i32 @delay(i32 200)
%5 = call i32 @mbus_remote_register_write(i32 6, i32 21, i32 49697)
%6 = call i32 @delay(i32 200)
ret void
}

LLVM IR (-O2):
define void @pmu_set_sleep_low() {
%1 = tail call i32 @mbus_remote_register_write(i32 6, i32 23, i32 49697)
%2 = tail call i32 @delay(i32 200)
%3 = tail call i32 @mbus_remote_register_write(i32 6, i32 23, i32 49697)
%4 = tail call i32 @delay(i32 200)
%5 = tail call i32 @mbus_remote_register_write(i32 6, i32 21, i32 49697)
%6 = tail call i32 @delay(i32 200)
ret void
}
int operator_subtract(int a, int b) { return a - b; }


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

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

LLVM IR (-O0):
define i32 @operator_subtract(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 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @operator_subtract(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int /*<<< orphan*/ __NR_fchmod;
int syscall(int /*<<< orphan*/, int, int /*<<< orphan*/);
__attribute__((always_)) int _syscall_fchmod(int fd, mode_t mode) {
  return syscall(__NR_fchmod, fd, mode);
}


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

x86 assembly (clang, -O2):
<_syscall_fchmod>:
mov    %esi,%edx
mov    %edi,%esi
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
@__NR_fchmod = global i32 0
define i32 @_syscall_fchmod(i32 %0, i32 %1) {
%3 = load i32, i32* @__NR_fchmod
%4 = tail call i32 @syscall(i32 %3, i32 %0, i32 %1)
ret i32 %4
}
/* Variables and functions */
scalar_t__ isspace(char);
int /*<<< orphan*/ memmove(char *, char *, scalar_t__);
scalar_t__ strlen(char *);
char *ltrim(char *s) {
  char *begin = s;
  while (isspace(*begin))
    ++begin;
  memmove(s, begin, strlen(begin) + 1);
  return s;
}


x86 assembly (clang, -O0):
<ltrim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     116b <ltrim+0x3b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1144 <ltrim+0x14>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1050 <memmove@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltrim>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    -0x1(%rdi),%rbx
nopl   0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1040 <isspace@plt>
test   %rax,%rax
jne    1140 <ltrim+0x10>
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <memmove@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @ltrim(i8* returned %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = tail call i64 @isspace(i8 signext %4)
%6 = icmp eq i64 %5, 0
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = tail call i64 @strlen(i8* %3)
%10 = add nsw i64 %9, 1
%11 = tail call i32 @memmove(i8* %0, i8* %3, i64 %10)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ unit_error(char *, char const *, int);
void assert_not_null(void *real, const char *caller, int line) {
  if (real == NULL) {
    unit_error("%s:%d should not be NULL", caller, line);
  }
}


x86 assembly (clang, -O0):
<assert_not_null>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1141 <assert_not_null+0x31>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xec4(%rip),%rdi
call   1030 <unit_error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_not_null>:
test   %rdi,%rdi
je     1116 <assert_not_null+0x6>
ret
lea    0xee3(%rip),%rdi
jmp    1030 <unit_error@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"%s:%d should not be NULL\00"
define void @assert_not_null(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call i32 @unit_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %11)
br label %13
13: ; preds = %9, %3
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"%s:%d should not be NULL\00"
define void @assert_not_null(i8* readnone %0, i8* %1, i32 %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @unit_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %2)
br label %7
7: ; preds = %5, %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ mvprintw(int, int, char *);
int /*<<< orphan*/ wmove(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void print_thing(WINDOW *erg_win, int x, int y, char thing) {
  char cstr[2];
  cstr[0] = thing;
  cstr[1] = '\0';
  mvprintw(y, x, cstr);
  wrefresh(erg_win);
  wmove(erg_win, y, x);
}


x86 assembly (clang, -O0):
<print_thing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
mov    %al,-0x13(%rbp)
movb   $0x0,-0x12(%rbp)
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
lea    -0x13(%rbp),%rdx
call   1050 <mvprintw@plt>
mov    -0x8(%rbp),%rdi
call   1030 <wrefresh@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <wmove@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_thing>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %cl,0xe(%rsp)
movb   $0x0,0xf(%rsp)
lea    0xe(%rsp),%rdx
mov    %r14d,%edi
call   1050 <mvprintw@plt>
mov    %rbx,%rdi
call   1030 <wrefresh@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
call   1040 <wmove@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @print_thing(i32* %0, i32 %1, i32 %2, i8 signext %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca [2 x i8]
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8 %3, i8* %8
%10 = load i8, i8* %8
%11 = getelementptr inbounds [2 x i8], [2 x i8]* %9, i64 0, i64 0
store i8 %10, i8* %11
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %9, i64 0, i64 1
store i8 0, i8* %12
%13 = load i32, i32* %7
%14 = load i32, i32* %6
%15 = getelementptr inbounds [2 x i8], [2 x i8]* %9, i64 0, i64 0
%16 = call i32 @mvprintw(i32 %13, i32 %14, i8* %15)
%17 = load i32*, i32** %5
%18 = call i32 @wrefresh(i32* %17)
%19 = load i32*, i32** %5
%20 = load i32, i32* %7
%21 = load i32, i32* %6
%22 = call i32 @wmove(i32* %19, i32 %20, i32 %21)
ret void
}

LLVM IR (-O2):
define void @print_thing(i32* %0, i32 %1, i32 %2, i8 signext %3) {
%5 = alloca [2 x i8]
%6 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
store i8 %3, i8* %6
%7 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 1
store i8 0, i8* %7
%8 = call i32 @mvprintw(i32 %2, i32 %1, i8* %6)
%9 = call i32 @wrefresh(i32* %0)
%10 = call i32 @wmove(i32* %0, i32 %2, i32 %1)
ret void
}
/* Variables and functions */
unsigned char UART1_Read();
unsigned char serial_read() { return UART1_Read(); }


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

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

LLVM IR (-O0):
define zeroext i8 @serial_read() {
%1 = call zeroext i8 (...) @UART1_Read()
ret i8 %1
}

LLVM IR (-O2):
define zeroext i8 @serial_read() {
%1 = tail call zeroext i8 (...) @UART1_Read()
ret i8 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ le64toh(int /*<<< orphan*/);
int64_t ld_i64_le(const void *x) { return le64toh(((int64_t *)x)[0]); }


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

x86 assembly (clang, -O2):
<ld_i64_le>:
mov    (%rdi),%edi
jmp    1030 <le64toh@plt>

LLVM IR (-O0):
define i32 @ld_i64_le(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = getelementptr inbounds i32, i32* %4, i64 0
%6 = load i32, i32* %5
%7 = call i32 @le64toh(i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @ld_i64_le(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @le64toh(i32 %3)
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;
typedef int int32_t;

/* Variables and functions */
int32_t sra(int32_t reg1, uint8_t desloc) { return (reg1 >> desloc); }


x86 assembly (clang, -O0):
<sra>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sra>:
mov    %esi,%ecx
mov    %edi,%eax
sar    %cl,%eax
ret

LLVM IR (-O0):
define i32 @sra(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 = ashr i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @sra(i32 %0, i32 %1) {
%3 = ashr i32 %0, %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void die(char *str) {
  fputs(str, stderr);
  exit(1);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @stderr
%5 = call i32 @fputs(i8* %3, i32 %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
define void @die(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fputs(i8* %0, i32 %2)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ action_servo(int, int /*<<< orphan*/);
void camera_up(void) { action_servo(19, 0); }


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

x86 assembly (clang, -O2):
<camera_up>:
mov    $0x13,%edi
xor    %esi,%esi
jmp    1030 <action_servo@plt>

LLVM IR (-O0):
define void @camera_up() {
%1 = call i32 @action_servo(i32 19, i32 0)
ret void
}

LLVM IR (-O2):
define void @camera_up() {
%1 = tail call i32 @action_servo(i32 19, i32 0)
ret void
}
/* Variables and functions */
bool positionInBounds(int n, int rowNum, int colNum) {
  bool judge = true;
  if (rowNum + 1 > n || rowNum < 0 || colNum + 1 > n || colNum < 0)
    judge = false;
  return (judge);
}


x86 assembly (clang, -O0):
<positionInBounds>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cmp    -0x4(%rbp),%eax
jg     1146 <positionInBounds+0x46>
cmpl   $0x0,-0x8(%rbp)
jl     1146 <positionInBounds+0x46>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cmp    -0x4(%rbp),%eax
jg     1146 <positionInBounds+0x46>
cmpl   $0x0,-0xc(%rbp)
jge    114d <positionInBounds+0x4d>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<positionInBounds>:
cmp    %edi,%esi
jge    1116 <positionInBounds+0x16>
test   %esi,%esi
js     1116 <positionInBounds+0x16>
cmp    %edi,%edx
jge    1116 <positionInBounds+0x16>
mov    $0x1,%eax
test   %edx,%edx
js     1116 <positionInBounds+0x16>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @positionInBounds(i32 %0, i32 %1, i32 %2) {
%4 = icmp sge i32 %1, %0
%5 = icmp slt i32 %1, 0
%6 = or i1 %4, %5
br i1 %6, label %11, label %7
7: ; preds = %3
%8 = icmp sge i32 %2, %0
%9 = icmp slt i32 %2, 0
%10 = or i1 %8, %9
br i1 %10, label %11, label %12
11: ; preds = %7, %3
br label %12
12: ; preds = %7, %11
%13 = phi i32 [ 0, %11 ], [ 1, %7 ]
ret i32 %13
}
int bit_next_smallest_number_same_num_ones(int n) {
  if (n <= 0)
    return 0;
  else {
    int ret = ~bit_snoob(~n);
    if (ret < 0 || ret > n)
      return 0;
    else
      return ret;
  }
}


x86 assembly (clang, -O0):
<bit_next_smallest_number_same_num_ones>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     1131 <bit_next_smallest_number_same_num_ones+0x21>
movl   $0x0,-0x4(%rbp)
jmp    116c <bit_next_smallest_number_same_num_ones+0x5c>
mov    -0x8(%rbp),%edi
xor    $0xffffffff,%edi
mov    $0x0,%al
call   1030 <bit_snoob@plt>
xor    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     115a <bit_next_smallest_number_same_num_ones+0x4a>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1166 <bit_next_smallest_number_same_num_ones+0x56>
movl   $0x0,-0x4(%rbp)
jmp    116c <bit_next_smallest_number_same_num_ones+0x5c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_next_smallest_number_same_num_ones>:
test   %edi,%edi
jle    1139 <bit_next_smallest_number_same_num_ones+0x29>
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
not    %edi
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <bit_snoob@plt>
mov    %eax,%ecx
not    %eax
cmp    %ebx,%eax
cmovg  %ebp,%eax
test   %ecx,%ecx
cmovns %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @bit_next_smallest_number_same_num_ones(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = xor i32 %0, -1
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @bit_snoob to i32 (i32, ...)*)(i32 %4)
%6 = xor i32 %5, -1
%7 = icmp sgt i32 %5, -1
%8 = icmp sgt i32 %6, %0
%9 = or i1 %7, %8
%10 = select i1 %9, i32 0, i32 %6
br label %11
11: ; preds = %1, %3
%12 = phi i32 [ %10, %3 ], [ 0, %1 ]
ret i32 %12
}