xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ atoi(char *);
char *getenv(char const *);
bool igt_check_boolean_env_var(const char *env_var, bool default_value) {
  char *val;
  val = getenv(env_var);
  if (!val)
    return default_value;
  return atoi(val) != 0;
}


x86 assembly (clang, -O0):
<igt_check_boolean_env_var>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1152 <igt_check_boolean_env_var+0x32>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116a <igt_check_boolean_env_var+0x4a>
mov    -0x20(%rbp),%rdi
call   1040 <atoi@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<igt_check_boolean_env_var>:
push   %rbx
mov    %esi,%ebx
call   1030 <getenv@plt>
test   %rax,%rax
je     113d <igt_check_boolean_env_var+0x1d>
mov    %rax,%rdi
call   1040 <atoi@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @igt_check_boolean_env_var(i8* nocapture %0, i32 %1) {
%3 = tail call i8* @getenv(i8* %0)
%4 = icmp eq i8* %3, null
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i64 @atoi(i8* %3)
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %2, %5
%10 = phi i32 [ %8, %5 ], [ %1, %2 ]
ret i32 %10
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ serial;
};
typedef TYPE_1__ XMapRequestEvent;

/* Variables and functions */
unsigned long get_XMapRequestEvent_serial(void *_p) {
  return (unsigned long)((XMapRequestEvent *)_p)->serial;
}


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

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

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

LLVM IR (-O2):
define i64 @get_XMapRequestEvent_serial(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void handle(int s) {
  printf("hello start.....\n");
  sleep(20);
  printf("hello end.....\n");
}


x86 assembly (clang, -O0):
<handle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    $0x14,%edi
call   1040 <sleep@plt>
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x14,%edi
call   1040 <sleep@plt>
lea    0xed3(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"hello start.....\0A\00"
@.str.1 = [16 x i8] c"hello end.....\0A\00"
define void @handle(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @sleep(i32 20)
%5 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [17 x i8] c"hello start.....\00"
@str.2 = [15 x i8] c"hello end.....\00"
define void @handle(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @sleep(i32 20)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
double vabs(double *);
int vzero(double v[3], double t) { return vabs(v) <= t; }


x86 assembly (clang, -O0):
<vzero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <vabs@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vzero>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <vabs@plt>
xor    %eax,%eax
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
setae  %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @vzero(double* %0, double %1) {
%3 = alloca double*
%4 = alloca double
store double* %0, double** %3
store double %1, double* %4
%5 = load double*, double** %3
%6 = call double @vabs(double* %5)
%7 = load double, double* %4
%8 = fcmp ole double %6, %7
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @vzero(double* %0, double %1) {
%3 = tail call double @vabs(double* %0)
%4 = fcmp ole double %3, %1
%5 = zext i1 %4 to i32
ret i32 %5
}
adrreg0imm1_set(r0, r1, x0, x1, p0, p1) int r0, r1;
int *p0, *p1;
{ (p0[10000000]) = 33; }


x86 assembly (clang, -O0):
<adrreg0imm1_set>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x21,0x2625a00(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adrreg0imm1_set>:
movl   $0x21,0x2625a00(%r8)
ret

LLVM IR (-O0):
define i32 @adrreg0imm1_set(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32*
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32* %4, i32** %12
store i32* %5, i32** %13
%14 = load i32*, i32** %12
%15 = getelementptr inbounds i32, i32* %14, i64 10000000
store i32 33, i32* %15
%16 = load i32, i32* %7
ret i32 %16
}

LLVM IR (-O2):
define i32 @adrreg0imm1_set(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture writeonly %4, i32* nocapture readnone %5) {
%7 = getelementptr inbounds i32, i32* %4, i64 10000000
store i32 33, i32* %7
ret i32 undef
}
/* Variables and functions */
int clearenv();
int main(void) { return clearenv(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @clearenv()
ret i32 %1
}
equate_bmpfileheaders(src, dest) struct bmpfileheader *src, *dest;
{}


x86 assembly (clang, -O0):
<equate_bmpfileheaders>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.bmpfileheader = type opaque
define i32 @equate_bmpfileheaders(%struct.bmpfileheader* %0, %struct.bmpfileheader* %1) {
%3 = alloca i32
%4 = alloca %struct.bmpfileheader*
%5 = alloca %struct.bmpfileheader*
store %struct.bmpfileheader* %0, %struct.bmpfileheader** %4
store %struct.bmpfileheader* %1, %struct.bmpfileheader** %5
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
%struct.bmpfileheader = type opaque
define i32 @equate_bmpfileheaders(%struct.bmpfileheader* nocapture readnone %0, %struct.bmpfileheader* nocapture readnone %1) {
ret i32 undef
}
void test8() {
  enum { A, B, C = 1 } a;
  switch (a) {
  case A:
  case B:
    break;
  }
  switch (a) {
  case A:
  case C:
    break;
  }
  switch (a) {
  case A:
    break;
  }
}


x86 assembly (clang, -O0):
<test8>:
push   %rbp
mov    %rsp,%rbp
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
ja     111a <test8+0x1a>
jmp    1115 <test8+0x15>
jmp    111a <test8+0x1a>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
ja     1130 <test8+0x30>
jmp    112b <test8+0x2b>
jmp    1130 <test8+0x30>
mov    -0x4(%rbp),%eax
test   %eax,%eax
jne    1145 <test8+0x45>
jmp    1140 <test8+0x40>
jmp    1145 <test8+0x45>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test8() {
%1 = alloca i32
%2 = load i32, i32* %1
switch i32 %2, label %4 [
i32 0, label %3
i32 1, label %3
]
3: ; preds = %0, %0
br label %4
4: ; preds = %0, %3
%5 = load i32, i32* %1
switch i32 %5, label %7 [
i32 0, label %6
i32 1, label %6
]
6: ; preds = %4, %4
br label %7
7: ; preds = %4, %6
%8 = load i32, i32* %1
switch i32 %8, label %10 [
i32 0, label %9
]
9: ; preds = %7
br label %10
10: ; preds = %7, %9
ret void
}

LLVM IR (-O2):
define void @test8() {
ret void
}
void f3(void) { char buffer2[100]; }


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

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

LLVM IR (-O0):
define void @f3() {
%1 = alloca [100 x i8]
ret void
}

LLVM IR (-O2):
define void @f3() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ strings_is_null_or_empty(char *);
bool paths_is_absolute(char *path) {
  assert(!strings_is_null_or_empty(path));
  return path[0] == '/';
}


x86 assembly (clang, -O0):
<paths_is_absolute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strings_is_null_or_empty@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<paths_is_absolute>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strings_is_null_or_empty@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
cmpb   $0x2f,(%rbx)
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @paths_is_absolute(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strings_is_null_or_empty(i8* %3)
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 47
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @paths_is_absolute(i8* %0) {
%2 = tail call i32 @strings_is_null_or_empty(i8* %0)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 47
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
struct ld_kern_param_s {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ arg_to_param_value(char *, struct ld_kern_param_s *);
int /*<<< orphan*/ setBufferValue(char *, struct ld_kern_param_s *);
void buffer_to_param_value(struct ld_kern_param_s *ldParam) {
  static char value[400];
  setBufferValue(value, ldParam);
  arg_to_param_value(value, ldParam);
}


x86 assembly (clang, -O0):
<buffer_to_param_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0x2f09(%rip),%rdi
call   1040 <setBufferValue@plt>
mov    -0x8(%rbp),%rsi
lea    0x2ef9(%rip),%rdi
call   1030 <arg_to_param_value@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buffer_to_param_value>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0x2f12(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <setBufferValue@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <arg_to_param_value@plt>

LLVM IR (-O0):
%struct.ld_kern_param_s = type { i32 }
@buffer_to_param_value.value = internal global [400 x i8] zeroinitializer
define void @buffer_to_param_value(%struct.ld_kern_param_s* %0) {
%2 = alloca %struct.ld_kern_param_s*
store %struct.ld_kern_param_s* %0, %struct.ld_kern_param_s** %2
%3 = load %struct.ld_kern_param_s*, %struct.ld_kern_param_s** %2
%4 = call i32 @setBufferValue(i8* getelementptr inbounds ([400 x i8], [400 x i8]* @buffer_to_param_value.value, i64 0, i64 0), %struct.ld_kern_param_s* %3)
%5 = load %struct.ld_kern_param_s*, %struct.ld_kern_param_s** %2
%6 = call i32 @arg_to_param_value(i8* getelementptr inbounds ([400 x i8], [400 x i8]* @buffer_to_param_value.value, i64 0, i64 0), %struct.ld_kern_param_s* %5)
ret void
}

LLVM IR (-O2):
%struct.ld_kern_param_s = type { i32 }
@buffer_to_param_value.value = internal global [400 x i8] zeroinitializer
define void @buffer_to_param_value(%struct.ld_kern_param_s* %0) {
%2 = tail call i32 @setBufferValue(i8* getelementptr inbounds ([400 x i8], [400 x i8]* @buffer_to_param_value.value, i64 0, i64 0), %struct.ld_kern_param_s* %0)
%3 = tail call i32 @arg_to_param_value(i8* getelementptr inbounds ([400 x i8], [400 x i8]* @buffer_to_param_value.value, i64 0, i64 0), %struct.ld_kern_param_s* %0)
ret void
}
unsigned xrop3_237_1_0(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 = D ^ T;
  stk2 = ~stk2;
  stk1 = S | stk2;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_237_1_0>:
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    -0x8(%rbp),%eax
xor    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%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    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @xrop3_237_1_0(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* %5
%23 = load i32, i32* %7
%24 = xor i32 %22, %23
store i32 %24, i32* %9
%25 = load i32, i32* %9
%26 = xor i32 %25, -1
store i32 %26, i32* %9
%27 = load i32, i32* %6
%28 = load i32, i32* %9
%29 = or i32 %27, %28
store i32 %29, i32* %8
%30 = load i32, i32* %8
%31 = load i32, i32* %6
%32 = xor i32 %31, -1
%33 = and i32 %30, %32
%34 = load i32, i32* %5
%35 = load i32, i32* %6
%36 = and i32 %34, %35
%37 = or i32 %33, %36
ret i32 %37
}

LLVM IR (-O2):
define i32 @xrop3_237_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = xor i32 %6, -256
%8 = xor i32 %4, -1
%9 = and i32 %7, %8
%10 = or i32 %9, %3
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int firstval = 5, secoundval = 10;
  int *p1, *p2;
  p1 = &firstval;
  p2 = &secoundval;
  *p1 = 10;
  *p2 = *p1;
  p1 = p2;
  *p1 = 20;
  printf("firstval is %d\n", firstval);
  printf("secoundval is %d\n", secoundval);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
movl   $0xa,-0x18(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movl   $0xa,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x14,(%rax)
mov    -0x14(%rbp),%esi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
mov    $0x14,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"firstval is %d\0A\00"
@.str.1 = [18 x i8] c"secoundval is %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 10)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 20)
ret i32 0
}
/* Type definitions */
typedef int socklen_t;
typedef int /*<<< orphan*/ nodelay;

/* Variables and functions */
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ TCP_NODELAY;
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int hi_set_tcpnodelay(int sd) {
  int nodelay;
  socklen_t len;
  nodelay = 1;
  len = sizeof(nodelay);
  return setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, &nodelay, len);
}


x86 assembly (clang, -O0):
<hi_set_tcpnodelay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x4,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
mov    0x2eac(%rip),%rax
mov    (%rax),%edx
mov    -0xc(%rbp),%r8d
lea    -0x8(%rbp),%rcx
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hi_set_tcpnodelay>:
push   %rax
movl   $0x1,0x4(%rsp)
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
mov    0x2ebf(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
pop    %rcx
ret

LLVM IR (-O0):
@IPPROTO_TCP = global i32 0
@TCP_NODELAY = global i32 0
define i32 @hi_set_tcpnodelay(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
store i32 4, i32* %4
%5 = load i32, i32* %2
%6 = load i32, i32* @IPPROTO_TCP
%7 = load i32, i32* @TCP_NODELAY
%8 = load i32, i32* %4
%9 = call i32 @setsockopt(i32 %5, i32 %6, i32 %7, i32* %3, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
@IPPROTO_TCP = global i32 0
@TCP_NODELAY = global i32 0
define i32 @hi_set_tcpnodelay(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%4 = load i32, i32* @IPPROTO_TCP
%5 = load i32, i32* @TCP_NODELAY
%6 = call i32 @setsockopt(i32 %0, i32 %4, i32 %5, i32* %2, i32 4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isalnum(int);
void t_isalnum_0x46() {
  Assert_real((isalnum(70)),
              "/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_isalnum.c",
              355, ("isalnum should be 1 for F"));
}


x86 assembly (clang, -O0):
<t_isalnum_0x46>:
push   %rbp
mov    %rsp,%rbp
mov    $0x46,%edi
call   1030 <isalnum@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x163,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isalnum_0x46>:
push   %rax
mov    $0x46,%edi
call   1030 <isalnum@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x163,%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_isalnum.c\00"
@.str.1 = [26 x i8] c"isalnum should be 1 for F\00"
define void @t_isalnum_0x46() {
%1 = call i32 @isalnum(i32 70)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 355, i8* getelementptr inbounds ([26 x i8], [26 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_isalnum.c\00"
@.str.1 = [26 x i8] c"isalnum should be 1 for F\00"
define void @t_isalnum_0x46() {
%1 = tail call i32 @isalnum(i32 70)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 355, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct list_head {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _list_del(struct list_head *);
int /*<<< orphan*/ list_add(struct list_head *, struct list_head *);
void list_move(struct list_head *list, struct list_head *head) {
  _list_del(list);
  list_add(list, head);
}


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

x86 assembly (clang, -O2):
<list_move>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <_list_del@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <list_add@plt>

LLVM IR (-O0):
%struct.list_head = type { i32 }
define void @list_move(%struct.list_head* %0, %struct.list_head* %1) {
%3 = alloca %struct.list_head*
%4 = alloca %struct.list_head*
store %struct.list_head* %0, %struct.list_head** %3
store %struct.list_head* %1, %struct.list_head** %4
%5 = load %struct.list_head*, %struct.list_head** %3
%6 = call i32 @_list_del(%struct.list_head* %5)
%7 = load %struct.list_head*, %struct.list_head** %3
%8 = load %struct.list_head*, %struct.list_head** %4
%9 = call i32 @list_add(%struct.list_head* %7, %struct.list_head* %8)
ret void
}

LLVM IR (-O2):
%struct.list_head = type { i32 }
define void @list_move(%struct.list_head* %0, %struct.list_head* %1) {
%3 = tail call i32 @_list_del(%struct.list_head* %0)
%4 = tail call i32 @list_add(%struct.list_head* %0, %struct.list_head* %1)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t bcdToInt(char bcd) { return ((0x0F & (bcd >> 4)) * 10) + (0x0F & bcd); }


x86 assembly (clang, -O0):
<bcdToInt>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sar    $0x4,%eax
and    $0xf,%eax
imul   $0xa,%eax,%eax
movsbl -0x1(%rbp),%ecx
and    $0xf,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bcdToInt>:
movzbl %dil,%eax
shr    $0x4,%eax
lea    (%rax,%rax,4),%eax
and    $0xf,%edi
lea    (%rdi,%rax,2),%eax
ret

LLVM IR (-O0):
define i32 @bcdToInt(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = ashr i32 %4, 4
%6 = and i32 15, %5
%7 = mul nsw i32 %6, 10
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = and i32 15, %9
%11 = add nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @bcdToInt(i8 signext %0) {
%2 = zext i8 %0 to i32
%3 = lshr i32 %2, 4
%4 = mul nuw nsw i32 %3, 10
%5 = and i32 %2, 15
%6 = add nuw nsw i32 %4, %5
ret i32 %6
}
/* Variables and functions */
double pow(double, double);
double ff_cbrt(double x) {
  return x < 0 ? -pow(-x, 1.0 / 3.0) : pow(x, 1.0 / 3.0);
}


x86 assembly (clang, -O0):
<ff_cbrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1175 <ff_cbrt+0x65>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xeb1(%rip),%xmm1
call   1030 <pow@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    118c <ff_cbrt+0x7c>
movsd  -0x8(%rbp),%xmm0
movsd  0xe7e(%rip),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ff_cbrt>:
push   %rax
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    113a <ff_cbrt+0x2a>
xorpd  0xeed(%rip),%xmm0
movsd  0xed5(%rip),%xmm1
call   1030 <pow@plt>
xorpd  0xed8(%rip),%xmm0
pop    %rax
ret
movsd  0xebe(%rip),%xmm1
pop    %rax
jmp    1030 <pow@plt>

LLVM IR (-O0):
define double @ff_cbrt(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp olt double %3, 0.000000e+00
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load double, double* %2
%7 = fneg double %6
%8 = call double @pow(double %7, double 0x3FD5555555555555)
%9 = fneg double %8
br label %13
10: ; preds = %1
%11 = load double, double* %2
%12 = call double @pow(double %11, double 0x3FD5555555555555)
br label %13
13: ; preds = %10, %5
%14 = phi double [ %9, %5 ], [ %12, %10 ]
ret double %14
}

LLVM IR (-O2):
define double @ff_cbrt(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = fneg double %0
%5 = tail call double @pow(double %4, double 0x3FD5555555555555)
%6 = fneg double %5
br label %9
7: ; preds = %1
%8 = tail call double @pow(double %0, double 0x3FD5555555555555)
br label %9
9: ; preds = %7, %3
%10 = phi double [ %6, %3 ], [ %8, %7 ]
ret double %10
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fgetc(int /*<<< orphan*/ *);
void skip_line(FILE *fp) {
  int ch;
  while ((ch = fgetc(fp)) != '\n')
    ;
}


x86 assembly (clang, -O0):
<skip_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xa,%eax
je     1136 <skip_line+0x26>
jmp    111c <skip_line+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_line>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0xa,%eax
jne    1120 <skip_line+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @skip_line(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @fgetc(i32* %0)
%4 = icmp eq i32 %3, 10
br i1 %4, label %5, label %2
5: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int foo1(unsigned long long);
int foo2(unsigned long long);
main() {
  unsigned long long value = 0xc000000000000001LL;
  int x, y;
  x = foo1(value);
  y = foo2(value);
  if (x != y || x != 1)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movabs $0xc000000000000001,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <foo1@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <foo2@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    118b <main+0x4b>
cmpl   $0x1,-0x14(%rbp)
je     1192 <main+0x52>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
movabs $0xc000000000000001,%rbx
mov    %rbx,%rdi
call   1050 <foo1@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <foo2@plt>
cmp    $0x1,%ebp
jne    1170 <main+0x30>
cmp    $0x1,%eax
jne    1170 <main+0x30>
xor    %edi,%edi
call   1060 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i64 -4611686018427387903, i64* %2
%5 = load i64, i64* %2
%6 = call i32 @foo1(i64 %5)
store i32 %6, i32* %3
%7 = load i64, i64* %2
%8 = call i32 @foo2(i64 %7)
store i32 %8, i32* %4
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = icmp ne i32 %9, %10
br i1 %11, label %15, label %12
12: ; preds = %0
%13 = load i32, i32* %3
%14 = icmp ne i32 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %12, %0
%16 = call i32 (...) @abort()
unreachable
17: ; preds = %12
%18 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo1(i64 -4611686018427387903)
%2 = tail call i32 @foo2(i64 -4611686018427387903)
%3 = icmp ne i32 %1, 1
%4 = icmp ne i32 %2, 1
%5 = or i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int lock_fp(int /*<<< orphan*/ *, int);
int lock_file(FILE *f) { return lock_fp(f, 1); }


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

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

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

LLVM IR (-O2):
define i32 @lock_file(i32* %0) {
%2 = tail call i32 @lock_fp(i32* %0, i32 1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ cpuinfo(int, int *, int *, int *, int *);
int computecacheline() {
  int eax = 0, ebx = 0, ecx = 0, edx = 0;
  cpuinfo((int)0x80000006, &eax, &ebx, &ecx, &edx);
  return ecx & 0xFF;
}


x86 assembly (clang, -O0):
<computecacheline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x80000006,%edi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1030 <cpuinfo@plt>
mov    -0xc(%rbp),%eax
and    $0xff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<computecacheline>:
sub    $0x18,%rsp
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0xc(%rsp)
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    $0x80000006,%edi
call   1030 <cpuinfo@plt>
movzbl 0x8(%rsp),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @computecacheline() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
%5 = call i32 @cpuinfo(i32 -2147483642, i32* %1, i32* %2, i32* %3, i32* %4)
%6 = load i32, i32* %3
%7 = and i32 %6, 255
ret i32 %7
}

LLVM IR (-O2):
define i32 @computecacheline() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%6 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = call i32 @cpuinfo(i32 -2147483642, i32* %1, i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %3
%11 = and i32 %10, 255
ret i32 %11
}
/* Variables and functions */
void *malloc(size_t);
void *compat_malloc(size_t size) {
  if (size == 0)
    size++;
  return malloc(size);
}


x86 assembly (clang, -O0):
<compat_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1133 <compat_malloc+0x23>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compat_malloc>:
test   %rdi,%rdi
mov    $0x1,%eax
cmove  %rax,%rdi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @compat_malloc(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i64, i64* %2
%7 = add i64 %6, 1
store i64 %7, i64* %2
br label %8
8: ; preds = %5, %1
%9 = load i64, i64* %2
%10 = call i8* @malloc(i64 %9)
ret i8* %10
}

LLVM IR (-O2):
define noalias i8* @compat_malloc(i64 %0) {
%2 = icmp eq i64 %0, 0
%3 = select i1 %2, i64 1, i64 %0
%4 = tail call i8* @malloc(i64 %3)
ret i8* %4
}
void uart_putc(int c) {
  if (c == '\n')
    uart_putc('\r');
  while (((*(volatile unsigned char *)(0x44E09000 + 20)) & 32) == 0)
    ;
  (*(volatile unsigned char *)(0x44E09000 + 0) = (unsigned char)(c));
}


x86 assembly (clang, -O0):
<uart_putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jne    112f <uart_putc+0x1f>
mov    $0xd,%edi
call   1030 <uart_putc@plt>
jmp    1134 <uart_putc+0x24>
mov    $0x44e09014,%eax
mov    (%rax),%al
movzbl %al,%eax
and    $0x20,%eax
cmp    $0x0,%eax
jne    114f <uart_putc+0x3f>
jmp    1134 <uart_putc+0x24>
mov    -0x4(%rbp),%eax
mov    %al,%cl
mov    $0x44e09000,%eax
mov    %cl,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_putc>:
cmp    $0xa,%edi
jne    1130 <uart_putc+0x30>
cs nopw 0x0(%rax,%rax,1)
nop
testb  $0x20,0x44e09014
20
je     1110 <uart_putc+0x10>
movb   $0xd,0x44e09000
0d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
testb  $0x20,0x44e09014
20
je     1130 <uart_putc+0x30>
mov    %dil,0x44e09000
44
ret

LLVM IR (-O0):
define void @uart_putc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 10
br i1 %4, label %5, label %6
5: ; preds = %1
br label %6
6: ; preds = %5, %1
br label %7
7: ; preds = %12, %6
%8 = load volatile i8, i8* inttoptr (i64 1155567636 to i8*)
%9 = zext i8 %8 to i32
%10 = and i32 %9, 32
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %7
br label %7
13: ; preds = %7
%14 = load i32, i32* %2
%15 = trunc i32 %14 to i8
store volatile i8 %15, i8* inttoptr (i64 1155567616 to i8*)
ret void
}

LLVM IR (-O2):
define void @uart_putc(i32 %0) {
%2 = icmp eq i32 %0, 10
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = load volatile i8, i8* inttoptr (i64 1155567636 to i8*)
%5 = and i8 %4, 32
%6 = icmp eq i8 %5, 0
br i1 %6, label %3, label %7
7: ; preds = %3
store volatile i8 13, i8* inttoptr (i64 1155567616 to i8*)
br label %8
8: ; preds = %7, %1
br label %9
9: ; preds = %8, %9
%10 = load volatile i8, i8* inttoptr (i64 1155567636 to i8*)
%11 = and i8 %10, 32
%12 = icmp eq i8 %11, 0
br i1 %12, label %9, label %13
13: ; preds = %9
%14 = trunc i32 %0 to i8
store volatile i8 %14, i8* inttoptr (i64 1155567616 to i8*)
ret void
}
int d_eq_rc1(double a1) { return (((a1) == (100))); }


x86 assembly (clang, -O0):
<d_eq_rc1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_eq_rc1>:
cmpeqsd 0xef7(%rip),%xmm0
movq   %xmm0,%rax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @d_eq_rc1(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp oeq double %3, 1.000000e+02
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @d_eq_rc1(double %0) {
%2 = fcmp oeq double %0, 1.000000e+02
%3 = zext i1 %2 to i32
ret i32 %3
}
void CMOS_sync() {}


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

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

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

LLVM IR (-O2):
define void @CMOS_sync() {
ret void
}
/* Type definitions */
typedef int time_t;
struct timeval {
  int tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
time_t time_now(void) {
  struct timeval now;
  gettimeofday(&now, NULL);
  return (time_t)now.tv_sec * 1000000 + now.tv_usec;
}


x86 assembly (clang, -O0):
<time_now>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x8(%rbp),%rax
imul   $0xf4240,%eax,%eax
add    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_now>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,0x10(%rsp),%eax
add    0x8(%rsp),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define i32 @time_now() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%4 = load i64, i64* %3
%5 = trunc i64 %4 to i32
%6 = mul nsw i32 %5, 1000000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%8 = load i32, i32* %7
%9 = add nsw i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i32 @time_now() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = mul nsw i32 %6, 1000000
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%9 = load i32, i32* %8
%10 = add nsw i32 %7, %9
ret i32 %10
}
void didLaunch() {}


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

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

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

LLVM IR (-O2):
define void @didLaunch() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int r;
  srand(time(NULL));
  r = rand() % 2;
  printf("Random Number either 0 or 1: %d", r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
lea    0xe97(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Random Number either 0 or 1: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @time(i32* null)
%4 = call i32 @srand(i32 %3)
%5 = call i32 (...) @rand()
%6 = srem i32 %5, 2
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"Random Number either 0 or 1: %d\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 2
%5 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
int ft_count_if(char **tab, int (*f)(char *)) {
  int i;
  int nb;
  i = 0;
  nb = 0;
  while (tab[i]) {
    if (f(tab[i]))
      nb++;
    i++;
  }
  return (nb);
}


x86 assembly (clang, -O0):
<ft_count_if>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1163 <ft_count_if+0x63>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq -0x14(%rbp),%rdx
mov    (%rcx,%rdx,8),%rdi
call   *%rax
cmp    $0x0,%eax
je     1155 <ft_count_if+0x55>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111e <ft_count_if+0x1e>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_count_if>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1137 <ft_count_if+0x37>
mov    %rsi,%r14
add    $0x8,%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
call   *%r14
cmp    $0x1,%eax
sbb    $0xffffffff,%ebp
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1120 <ft_count_if+0x20>
jmp    1139 <ft_count_if+0x39>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @ft_count_if(i8** nocapture %0, i32 (i8*)* nocapture %1) {
%3 = load i8*, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %17, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %13, %5 ], [ 0, %2 ]
%7 = phi i8* [ %15, %5 ], [ %3, %2 ]
%8 = phi i32 [ %12, %5 ], [ 0, %2 ]
%9 = tail call i32 %1(i8* %7)
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i32
%12 = add nuw nsw i32 %8, %11
%13 = add nuw i64 %6, 1
%14 = getelementptr inbounds i8*, i8** %0, i64 %13
%15 = load i8*, i8** %14
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %5
17: ; preds = %5, %2
%18 = phi i32 [ 0, %2 ], [ %12, %5 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char buffer[64];
  printf("Your name: ");
  gets(buffer);
  printf("Hello, %s\n", buffer);
  return (0);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <gets@plt>
lea    0xec7(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"Your name: \00"
@.str.1 = [11 x i8] c"Hello, %s\0A\00"
define i32 @main() {
%1 = alloca [64 x i8]
%2 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int factorial(int);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int num = 5;
  printf("Factorial of %d is %d", num, factorial(num));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <factorial@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [22 x i8] c"Factorial of %d is %d\00"
define i32 @main() {
%1 = tail call i32 @factorial(i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 5, i32 %1)
ret i32 0
}