xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
size_t strlen(char const *);
int /*<<< orphan*/ ta_print_spaces(size_t);
void ta_print_help(const char *arg, const char *help, size_t maxlen) {
  size_t alen = strlen(arg);
  printf("  %s", arg);
  ta_print_spaces((maxlen - alen) + 3);
  printf("%s\n", help);
}


x86 assembly (clang, -O0):
<ta_print_help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
sub    -0x20(%rbp),%rdi
add    $0x3,%rdi
call   1050 <ta_print_spaces@plt>
mov    -0x10(%rbp),%rsi
lea    0xe88(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ta_print_help>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %rax,%r12
lea    0xeb0(%rip),%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
sub    %r12,%rbx
add    $0x3,%rbx
mov    %rbx,%rdi
call   1050 <ta_print_spaces@plt>
lea    0xe97(%rip),%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c" %s\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @ta_print_help(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
store i64 %9, i64* %7
%10 = load i8*, i8** %4
%11 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i64, i64* %6
%13 = load i64, i64* %7
%14 = sub i64 %12, %13
%15 = add i64 %14, 3
%16 = call i32 @ta_print_spaces(i64 %15)
%17 = load i8*, i8** %5
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %17)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c" %s\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @ta_print_help(i8* %0, i8* %1, i64 %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = add i64 %2, 3
%7 = sub i64 %6, %4
%8 = tail call i32 @ta_print_spaces(i64 %7)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ fork();
int /*<<< orphan*/ unix_error(char *);
pid_t Fork(void) {
  pid_t pid;
  if ((pid = fork()) < 0) {
    unix_error("Fork error");
  }
  return pid;
}


x86 assembly (clang, -O0):
<Fork>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <fork@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jge    1147 <Fork+0x27>
lea    0xebe(%rip),%rdi
call   1030 <unix_error@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fork>:
push   %rbx
xor    %eax,%eax
call   1040 <fork@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    113a <Fork+0x1a>
lea    0xecb(%rip),%rdi
call   1030 <unix_error@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Fork error\00"
define i32 @Fork() {
%1 = alloca i32
%2 = call i32 (...) @fork()
store i32 %2, i32* %1
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @unix_error(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
@.str = [11 x i8] c"Fork error\00"
define i32 @Fork() {
%1 = tail call i32 (...) @fork()
%2 = icmp slt i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @unix_error(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int mod_init(void) {
  fprintf(stderr, "postgres - initializing\n");
  return 0;
}


x86 assembly (clang, -O0):
<mod_init>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod_init>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"postgres - initializing\0A\00"
define i32 @mod_init() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"postgres - initializing\0A\00"
define i32 @mod_init() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void d2i_X509_EXTENSION(void) {}


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

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

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

LLVM IR (-O2):
define void @d2i_X509_EXTENSION() {
ret void
}
/* Variables and functions */
size_t strxfrm(char *restrict dest, const char *restrict src, size_t count) {
  size_t i;
  for (i = 0; i < count; i++) {
    dest[i] = src[i];
    if (!src[i])
      break;
  }
  return i;
}


x86 assembly (clang, -O0):
<strxfrm>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1169 <strxfrm+0x69>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
jne    1153 <strxfrm+0x53>
jmp    1169 <strxfrm+0x69>
jmp    1158 <strxfrm+0x58>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1118 <strxfrm+0x18>
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strxfrm>:
xor    %eax,%eax
test   %rdx,%rdx
je     1127 <strxfrm+0x27>
nopw   0x0(%rax,%rax,1)
movzbl (%rsi,%rax,1),%ecx
mov    %cl,(%rdi,%rax,1)
test   %cl,%cl
je     1127 <strxfrm+0x27>
add    $0x1,%rax
cmp    %rax,%rdx
jne    1110 <strxfrm+0x10>
mov    %rdx,%rax
ret

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

LLVM IR (-O2):
define i64 @strxfrm(i8* noalias nocapture writeonly %0, i8* noalias nocapture %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %14, label %5
5: ; preds = %3, %11
%6 = phi i64 [ %12, %11 ], [ 0, %3 ]
%7 = getelementptr inbounds i8, i8* %1, i64 %6
%8 = load i8, i8* %7
%9 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 %8, i8* %9
%10 = icmp eq i8 %8, 0
br i1 %10, label %14, label %11
11: ; preds = %5
%12 = add nuw i64 %6, 1
%13 = icmp eq i64 %12, %2
br i1 %13, label %14, label %5
14: ; preds = %11, %5, %3
%15 = phi i64 [ 0, %3 ], [ %6, %5 ], [ %2, %11 ]
ret i64 %15
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *);
void start_usage(const char *cmd) {
  printf("%s logfile.txt IDdata.txt", cmd);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<start_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<start_usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"%s logfile.txt IDdata.txt\00"
@EXIT_FAILURE = global i32 0
define void @start_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i32, i32* @EXIT_FAILURE
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@.str = [26 x i8] c"%s logfile.txt IDdata.txt\00"
@EXIT_FAILURE = global i32 0
define void @start_usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ rcu_sched_force_quiescent_state();
void rcu_force_quiescent_state(void) { rcu_sched_force_quiescent_state(); }


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

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

LLVM IR (-O0):
define void @rcu_force_quiescent_state() {
%1 = call i32 (...) @rcu_sched_force_quiescent_state()
ret void
}

LLVM IR (-O2):
define void @rcu_force_quiescent_state() {
%1 = tail call i32 (...) @rcu_sched_force_quiescent_state()
ret void
}
long long longlong_ignoring_signedchar(long long x, signed char y) { return x; }


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

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

LLVM IR (-O0):
define i64 @longlong_ignoring_signedchar(i64 %0, i8 signext %1) {
%3 = alloca i64
%4 = alloca i8
store i64 %0, i64* %3
store i8 %1, i8* %4
%5 = load i64, i64* %3
ret i64 %5
}

LLVM IR (-O2):
define i64 @longlong_ignoring_signedchar(i64 returned %0, i8 signext %1) {
ret i64 %0
}
/* Variables and functions */
double fmod(int, int);
double rnd() {
  static double seed = 38467.;
  seed = fmod(1027. * seed, 1048576.);
  return seed / 1048576.;
}


x86 assembly (clang, -O0):
<rnd>:
push   %rbp
mov    %rsp,%rbp
movsd  0xeec(%rip),%xmm0
mulsd  0x2f04(%rip),%xmm0
cvttsd2si %xmm0,%edi
mov    $0x100000,%esi
call   1030 <fmod@plt>
movsd  %xmm0,0x2eee(%rip)
movsd  0x2ee6(%rip),%xmm0
movsd  0xeb6(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rnd>:
push   %rax
movsd  0x2f0f(%rip),%xmm0
mulsd  0xedf(%rip),%xmm0
cvttsd2si %xmm0,%edi
mov    $0x100000,%esi
call   1030 <fmod@plt>
movsd  %xmm0,0x2ef1(%rip)
mulsd  0xec9(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@rnd.seed = internal global double 3.846700e+04
define double @rnd() {
%1 = load double, double* @rnd.seed
%2 = fmul double 1.027000e+03, %1
%3 = fptosi double %2 to i32
%4 = call double @fmod(i32 %3, i32 1048576)
store double %4, double* @rnd.seed
%5 = load double, double* @rnd.seed
%6 = fdiv double %5, 0x4130000000000000
ret double %6
}

LLVM IR (-O2):
@rnd.seed = internal unnamed_addr global double 3.846700e+04
define double @rnd() {
%1 = load double, double* @rnd.seed
%2 = fmul double %1, 1.027000e+03
%3 = fptosi double %2 to i32
%4 = tail call double @fmod(i32 %3, i32 1048576)
store double %4, double* @rnd.seed
%5 = fmul double %4, 0x3EB0000000000000
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ __mp_diag(char *, ...);
void __mp_printsize(size_t l) {
  __mp_diag("%lu byte", l);
  if (l != 1)
    __mp_diag("s");
}


x86 assembly (clang, -O0):
<__mp_printsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <__mp_diag@plt>
cmpq   $0x1,-0x8(%rbp)
je     1147 <__mp_printsize+0x37>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <__mp_diag@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__mp_printsize>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <__mp_diag@plt>
cmp    $0x1,%rbx
jne    112d <__mp_printsize+0x1d>
pop    %rbx
ret
lea    0xed5(%rip),%rdi
xor    %eax,%eax
pop    %rbx
jmp    1030 <__mp_diag@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"%lu byte\00"
@.str.1 = [2 x i8] c"s\00"
define void @__mp_printsize(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 (i8*, ...) @__mp_diag(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 %3)
%5 = load i64, i64* %2
%6 = icmp ne i64 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 (i8*, ...) @__mp_diag(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%lu byte\00"
@.str.1 = [2 x i8] c"s\00"
define void @__mp_printsize(i64 %0) {
%2 = tail call i32 (i8*, ...) @__mp_diag(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 %0)
%3 = icmp eq i64 %0, 1
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @__mp_diag(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_hello() { printf("Haha, hijacked print_hello!"); }


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

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

LLVM IR (-O0):
@.str = [28 x i8] c"Haha, hijacked print_hello!\00"
define void @print_hello() {
%1 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"Haha, hijacked print_hello!\00"
define void @print_hello() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ is_empty();
int /*<<< orphan*/ pop();
void make_empty(void) {
  while (!is_empty())
    pop();
}


x86 assembly (clang, -O0):
<make_empty>:
push   %rbp
mov    %rsp,%rbp
jmp    1129 <make_empty+0x9>
mov    $0x0,%al
call   1030 <is_empty@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1145 <make_empty+0x25>
jmp    1151 <make_empty+0x31>
mov    $0x0,%al
call   1040 <pop@plt>
jmp    1129 <make_empty+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_empty>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <is_empty@plt>
test   %eax,%eax
jne    1144 <make_empty+0x24>
xor    %eax,%eax
call   1040 <pop@plt>
jmp    1130 <make_empty+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @make_empty() {
br label %1
1: ; preds = %5, %0
%2 = call i32 (...) @is_empty()
%3 = icmp ne i32 %2, 0
%4 = xor i1 %3, true
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @pop()
br label %1
7: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @make_empty() {
%1 = tail call i32 (...) @is_empty()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %7
3: ; preds = %0, %3
%4 = tail call i32 (...) @pop()
%5 = tail call i32 (...) @is_empty()
%6 = icmp eq i32 %5, 0
br i1 %6, label %3, label %7
7: ; preds = %3, %0
ret void
}
int __log2Int(int a) {
  int i;
  for (i = 1; a > 1; i++, a = a >> 1)
    ;
  return i - 1;
}


x86 assembly (clang, -O0):
<__log2Int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    1134 <__log2Int+0x34>
jmp    111d <__log2Int+0x1d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <__log2Int+0xe>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__log2Int>:
xor    %eax,%eax
cmp    $0x2,%edi
jl     111c <__log2Int+0x1c>
xor    %eax,%eax
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
shr    %ecx
add    $0x1,%eax
cmp    $0x3,%edi
mov    %ecx,%edi
ja     1110 <__log2Int+0x10>
ret

LLVM IR (-O0):
define i32 @__log2Int(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
br label %4
4: ; preds = %8, %1
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %13
7: ; preds = %4
br label %8
8: ; preds = %7
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
store i32 %10, i32* %3
%11 = load i32, i32* %2
%12 = ashr i32 %11, 1
store i32 %12, i32* %2
br label %4
13: ; preds = %4
%14 = load i32, i32* %3
%15 = sub nsw i32 %14, 1
ret i32 %15
}

LLVM IR (-O2):
define i32 @__log2Int(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 1, %1 ]
%5 = phi i32 [ %7, %3 ], [ %0, %1 ]
%6 = add nuw nsw i32 %4, 1
%7 = lshr i32 %5, 1
%8 = icmp ugt i32 %5, 3
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %4, %3 ]
ret i32 %10
}
int SDL_imageFilterAddMMX(unsigned char *Src1, unsigned char *Src2,
                          unsigned char *Dest, int length) {
  return (0);
}


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

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

LLVM IR (-O0):
define i32 @SDL_imageFilterAddMMX(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
ret i32 0
}

LLVM IR (-O2):
define i32 @SDL_imageFilterAddMMX(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i32 %3) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit_error(char *);
int /*<<< orphan*/ printf(char *);
void test_msg_end(int pass) {
  if (pass == 0) {
    printf("PASSED\n");
  } else {
    printf("FAILED\n\n");
    exit_error("UNIT TESTING FAILED.\n\n");
  }
}


x86 assembly (clang, -O0):
<test_msg_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1146 <test_msg_end+0x26>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
jmp    115e <test_msg_end+0x3e>
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
call   1040 <exit_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_msg_end>:
test   %edi,%edi
je     113e <test_msg_end+0x1e>
push   %rax
lea    0xeeb(%rip),%rdi
call   1030 <puts@plt>
lea    0xec8(%rip),%rdi
pop    %rax
jmp    1040 <exit_error@plt>
lea    0xeda(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"PASSED\0A\00"
@.str.1 = [9 x i8] c"FAILED\0A\0A\00"
@.str.2 = [23 x i8] c"UNIT TESTING FAILED.\0A\0A\00"
define void @test_msg_end(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %10
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @exit_error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
@.str.2 = [23 x i8] c"UNIT TESTING FAILED.\0A\0A\00"
@str = [8 x i8] c"FAILED\0A\00"
@str.3 = [7 x i8] c"PASSED\00"
define void @test_msg_end(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.3, i64 0, i64 0))
br label %8
5: ; preds = %1
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @exit_error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
br label %8
8: ; preds = %5, %3
ret void
}
int test_imm_DFuint8_reg(unsigned char val) {
  return ((val) & (-0xDF << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_DFuint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xffffff21,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_DFuint8_reg>:
test   $0x21,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_DFuint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 33
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct query {
  int dummy;
};
struct module {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ decorate(struct module *, struct query *,
                            int /*<<< orphan*/);
void process(struct module *module, struct query *query) {
  decorate(module, query, 0);
}


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

x86 assembly (clang, -O2):
<process>:
xor    %edx,%edx
jmp    1030 <decorate@plt>

LLVM IR (-O0):
%struct.module = type { i32 }
%struct.query = type { i32 }
define void @process(%struct.module* %0, %struct.query* %1) {
%3 = alloca %struct.module*
%4 = alloca %struct.query*
store %struct.module* %0, %struct.module** %3
store %struct.query* %1, %struct.query** %4
%5 = load %struct.module*, %struct.module** %3
%6 = load %struct.query*, %struct.query** %4
%7 = call i32 @decorate(%struct.module* %5, %struct.query* %6, i32 0)
ret void
}

LLVM IR (-O2):
%struct.module = type { i32 }
%struct.query = type { i32 }
define void @process(%struct.module* %0, %struct.query* %1) {
%3 = tail call i32 @decorate(%struct.module* %0, %struct.query* %1, i32 0)
ret void
}
/* Variables and functions */
scalar_t__ ft_isspace(char);
char *skip_white_space(const char *s) {
  char *str;
  str = (char *)s;
  while (str && ft_isspace(*str))
    str++;
  return (str);
}


x86 assembly (clang, -O0):
<skip_white_space>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     114a <skip_white_space+0x3a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <ft_isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115a <skip_white_space+0x4a>
jmp    116b <skip_white_space+0x5b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <skip_white_space+0x14>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_white_space>:
push   %rbx
test   %rdi,%rdi
je     1134 <skip_white_space+0x24>
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
nopl   (%rax)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <ft_isspace@plt>
test   %rax,%rax
jne    1120 <skip_white_space+0x10>
jmp    1136 <skip_white_space+0x26>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @skip_white_space(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 = %15, %1
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = call i64 @ft_isspace(i8 signext %10)
%12 = icmp ne i64 %11, 0
br label %13
13: ; preds = %8, %5
%14 = phi i1 [ false, %5 ], [ %12, %8 ]
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %3
br label %5
18: ; preds = %13
%19 = load i8*, i8** %3
ret i8* %19
}

LLVM IR (-O2):
define i8* @skip_white_space(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i8* [ %8, %3 ], [ %0, %1 ]
%5 = load i8, i8* %4
%6 = tail call i64 @ft_isspace(i8 signext %5)
%7 = icmp eq i64 %6, 0
%8 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %7, label %9, label %3
9: ; preds = %3, %1
%10 = phi i8* [ null, %1 ], [ %4, %3 ]
ret i8* %10
}
int selectPivotIndex(void **vals, int left, int right) { return left; }


x86 assembly (clang, -O0):
<selectPivotIndex>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @selectPivotIndex(i8** nocapture readnone %0, i32 returned %1, i32 %2) {
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(void *, void *);
int match_route_keylist_handler(void *key1, void *key2) {
  return !strcmp(key1, key2);
}


x86 assembly (clang, -O0):
<match_route_keylist_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @match_route_keylist_handler(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @strcmp(i8* %5, i8* %6)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @match_route_keylist_handler(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ gpio_set_dir_with_mask(int, int);
int /*<<< orphan*/ gpio_write_data_with_mask(int, int);
void operation_i2c_stop() {
  gpio_set_dir_with_mask((1 << 1) | (1 << 0), (1 << 1) | (1 << 0));
  gpio_write_data_with_mask((1 << 1) | (1 << 0), (0 << 1) | (1 << 0));
  gpio_write_data_with_mask((1 << 1) | (1 << 0), (1 << 1) | (1 << 0));
}


x86 assembly (clang, -O0):
<operation_i2c_stop>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%esi
mov    %esi,%edi
call   1040 <gpio_set_dir_with_mask@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1030 <gpio_write_data_with_mask@plt>
mov    $0x3,%esi
mov    %esi,%edi
call   1030 <gpio_write_data_with_mask@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<operation_i2c_stop>:
push   %rax
mov    $0x3,%edi
mov    $0x3,%esi
call   1040 <gpio_set_dir_with_mask@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1030 <gpio_write_data_with_mask@plt>
mov    $0x3,%edi
mov    $0x3,%esi
pop    %rax
jmp    1030 <gpio_write_data_with_mask@plt>

LLVM IR (-O0):
define void @operation_i2c_stop() {
%1 = call i32 @gpio_set_dir_with_mask(i32 3, i32 3)
%2 = call i32 @gpio_write_data_with_mask(i32 3, i32 1)
%3 = call i32 @gpio_write_data_with_mask(i32 3, i32 3)
ret void
}

LLVM IR (-O2):
define void @operation_i2c_stop() {
%1 = tail call i32 @gpio_set_dir_with_mask(i32 3, i32 3)
%2 = tail call i32 @gpio_write_data_with_mask(i32 3, i32 1)
%3 = tail call i32 @gpio_write_data_with_mask(i32 3, i32 3)
ret void
}
/* Type definitions */
struct genlist {
  int dummy;
};
struct fc_sockaddr_list {
  int dummy;
};

/* Variables and functions */
int genlist_size(struct genlist const *);
int fc_sockaddr_list_size(const struct fc_sockaddr_list *tthis) {
  return genlist_size((const struct genlist *)tthis);
}


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

x86 assembly (clang, -O2):
<fc_sockaddr_list_size>:
jmp    1030 <genlist_size@plt>

LLVM IR (-O0):
%struct.fc_sockaddr_list = type { i32 }
%struct.genlist = type { i32 }
define i32 @fc_sockaddr_list_size(%struct.fc_sockaddr_list* %0) {
%2 = alloca %struct.fc_sockaddr_list*
store %struct.fc_sockaddr_list* %0, %struct.fc_sockaddr_list** %2
%3 = load %struct.fc_sockaddr_list*, %struct.fc_sockaddr_list** %2
%4 = bitcast %struct.fc_sockaddr_list* %3 to %struct.genlist*
%5 = call i32 @genlist_size(%struct.genlist* %4)
ret i32 %5
}

LLVM IR (-O2):
%struct.fc_sockaddr_list = type { i32 }
%struct.genlist = type { i32 }
define i32 @fc_sockaddr_list_size(%struct.fc_sockaddr_list* %0) {
%2 = bitcast %struct.fc_sockaddr_list* %0 to %struct.genlist*
%3 = tail call i32 @genlist_size(%struct.genlist* %2)
ret i32 %3
}
/* Variables and functions */
int umount2(char const *, int /*<<< orphan*/);
int umount(const char *dir) { return umount2(dir, 0); }


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

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

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

LLVM IR (-O2):
define i32 @umount(i8* %0) {
%2 = tail call i32 @umount2(i8* %0, i32 0)
ret i32 %2
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
void UARTParityModeSet(uint32_t ui32Base, uint32_t ui32Parity) {
  ;

  ;
  (*((volatile unsigned long *)(ui32Base + 0x0000002C))) =
      (((*((volatile unsigned long *)(ui32Base + 0x0000002C))) &
        ~(0x00000080 | 0x00000004 | 0x00000002)) |
       ui32Parity);
}


x86 assembly (clang, -O0):
<UARTParityModeSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2c(%rax),%rcx
and    $0xffffffffffffff79,%rcx
mov    -0x10(%rbp),%rax
or     %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x2c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTParityModeSet>:
mov    %rdi,-0x10(%rsp)
mov    %rsi,-0x8(%rsp)
mov    -0x10(%rsp),%rax
mov    $0xffffffffffffff79,%rcx
and    0x2c(%rax),%rcx
or     -0x8(%rsp),%rcx
mov    -0x10(%rsp),%rax
mov    %rcx,0x2c(%rax)
ret

LLVM IR (-O0):
define void @UARTParityModeSet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store volatile i64 %0, i64* %3
store volatile i64 %1, i64* %4
%5 = load volatile i64, i64* %3
%6 = add i64 %5, 44
%7 = inttoptr i64 %6 to i64*
%8 = load volatile i64, i64* %7
%9 = and i64 %8, -135
%10 = load volatile i64, i64* %4
%11 = or i64 %9, %10
%12 = load volatile i64, i64* %3
%13 = add i64 %12, 44
%14 = inttoptr i64 %13 to i64*
store volatile i64 %11, i64* %14
ret void
}

LLVM IR (-O2):
define void @UARTParityModeSet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store volatile i64 %0, i64* %3
store volatile i64 %1, i64* %4
%5 = load volatile i64, i64* %3
%6 = add i64 %5, 44
%7 = inttoptr i64 %6 to i64*
%8 = load volatile i64, i64* %7
%9 = and i64 %8, -135
%10 = load volatile i64, i64* %4
%11 = or i64 %9, %10
%12 = load volatile i64, i64* %3
%13 = add i64 %12, 44
%14 = inttoptr i64 %13 to i64*
store volatile i64 %11, i64* %14
ret void
}
int main() {
  int x;
  int y;
  int z;
  x = 1;
  y = 2;
  z = x * y + 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 1, i32* %1
store i32 2, i32* %2
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = mul nsw i32 %4, %5
%7 = add nsw i32 %6, 2
store i32 %7, i32* %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ lib_main_entry();
void __attribute__((constructor)) lib_constructor() { lib_main_entry(); }


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

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

LLVM IR (-O0):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @lib_constructor, i8* null }]
define void @lib_constructor() {
%1 = call i32 (...) @lib_main_entry()
ret void
}

LLVM IR (-O2):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @lib_constructor, i8* null }]
define void @lib_constructor() {
%1 = tail call i32 (...) @lib_main_entry()
ret void
}
/* Variables and functions */
void g(int);
void f(void) { return g(3); }


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

x86 assembly (clang, -O2):
<f>:
mov    $0x3,%edi
jmp    1030 <g@plt>

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

LLVM IR (-O2):
define void @f() {
tail call void @g(i32 3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isodigit(int);
void t_isodigit_0xef() {
  Assert_real((isodigit(239) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isodigit.c",
              1200, ("isodigit should be 0 for 0xef"));
}


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

x86 assembly (clang, -O2):
<t_isodigit_0xef>:
push   %rax
mov    $0xef,%edi
call   1040 <isodigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x4b0,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isodigit.c\00"
@.str.1 = [30 x i8] c"isodigit should be 0 for 0xef\00"
define void @t_isodigit_0xef() {
%1 = call i64 @isodigit(i32 239)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 1200, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isodigit.c\00"
@.str.1 = [30 x i8] c"isodigit should be 0 for 0xef\00"
define void @t_isodigit_0xef() {
%1 = tail call i64 @isodigit(i32 239)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 1200, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ configureMultiProtocolPatch();
int /*<<< orphan*/ enterMultiProtocolCpeHdPatch();
void refreshMultiProtocolPatch(void) {
  enterMultiProtocolCpeHdPatch();
  configureMultiProtocolPatch();
}


x86 assembly (clang, -O0):
<refreshMultiProtocolPatch>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <enterMultiProtocolCpeHdPatch@plt>
mov    $0x0,%al
call   1040 <configureMultiProtocolPatch@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @refreshMultiProtocolPatch() {
%1 = call i32 (...) @enterMultiProtocolCpeHdPatch()
%2 = call i32 (...) @configureMultiProtocolPatch()
ret void
}

LLVM IR (-O2):
define void @refreshMultiProtocolPatch() {
%1 = tail call i32 (...) @enterMultiProtocolCpeHdPatch()
%2 = tail call i32 (...) @configureMultiProtocolPatch()
ret void
}
/* Variables and functions */
char *strdup(char const *);
char *qstrdup(const char *string) { return strdup(string); }


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

x86 assembly (clang, -O2):
<qstrdup>:
jmp    1030 <strdup@plt>

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

LLVM IR (-O2):
define noalias i8* @qstrdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
ret i8* %2
}
void boki(wysokosc) {
  int i;
  for (i = 0; i < wysokosc; i++)
    putchar('*');
  putchar(' ');
  putchar(' ');
  putchar(' ');
  putchar('*');
}


x86 assembly (clang, -O0):
<boki>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1148 <boki+0x38>
mov    $0x2a,%edi
mov    $0x0,%al
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <boki+0x12>
mov    $0x20,%edi
mov    $0x0,%al
call   1030 <putchar@plt>
mov    $0x20,%edi
mov    $0x0,%al
call   1030 <putchar@plt>
mov    $0x20,%edi
mov    $0x0,%al
call   1030 <putchar@plt>
mov    $0x2a,%edi
mov    $0x0,%al
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boki>:
push   %rbx
test   %edi,%edi
jle    1131 <boki+0x21>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x2a,%edi
xor    %eax,%eax
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <boki+0x10>
mov    $0x20,%edi
xor    %eax,%eax
call   1030 <putchar@plt>
mov    $0x20,%edi
xor    %eax,%eax
call   1030 <putchar@plt>
mov    $0x20,%edi
xor    %eax,%eax
call   1030 <putchar@plt>
mov    $0x2a,%edi
xor    %eax,%eax
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @boki(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %10, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 42)
br label %10
10: ; preds = %8
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %4
13: ; preds = %4
%14 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 32)
%15 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 32)
%16 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 32)
%17 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 42)
ret void
}

LLVM IR (-O2):
define void @boki(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 42)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 32)
%10 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 32)
%11 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 32)
%12 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 42)
ret void
}
int test_imm_0Buint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x0B << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_0Buint64_highword_reg(i64 %0) {
%2 = and i64 %0, 47244640256
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
void volatile_clear_bit_u16(uint16_t *mask, uint8_t bit) {
  *((volatile uint16_t *)mask) &= ~(1 << bit);
}


x86 assembly (clang, -O0):
<volatile_clear_bit_u16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
xor    $0xffffffff,%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
and    %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<volatile_clear_bit_u16>:
mov    %esi,%ecx
mov    $0xfffffffe,%eax
rol    %cl,%eax
and    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @volatile_clear_bit_u16(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = shl i32 1, %5
%7 = xor i32 %6, -1
%8 = load i32*, i32** %3
%9 = load volatile i32, i32* %8
%10 = and i32 %9, %7
store volatile i32 %10, i32* %8
ret void
}

LLVM IR (-O2):
define void @volatile_clear_bit_u16(i32* %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = xor i32 %3, -1
%5 = load volatile i32, i32* %0
%6 = and i32 %5, %4
store volatile i32 %6, i32* %0
ret void
}
int foo(int a1, int a2, int a3, int a4, int a5, int a6) { return a6; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %r9d,%eax
ret

LLVM IR (-O0):
define i32 @foo(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
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load i32, i32* %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 returned %5) {
ret i32 %5
}
void clear_bit(unsigned long bit, unsigned long *b) {
  (b)[bit / (8 * sizeof(long))] &= ~(1 << (bit % (8 * sizeof(long))));
}


x86 assembly (clang, -O0):
<clear_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
and    $0x3f,%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
movslq %eax,%rdx
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x6,%rcx
and    (%rax,%rcx,8),%rdx
mov    %rdx,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_bit>:
mov    %rdi,%rcx
mov    $0xfffffffe,%eax
rol    %cl,%eax
cltq
shr    $0x6,%rcx
and    %rax,(%rsi,%rcx,8)
ret

LLVM IR (-O0):
define void @clear_bit(i64 %0, i64* %1) {
%3 = alloca i64
%4 = alloca i64*
store i64 %0, i64* %3
store i64* %1, i64** %4
%5 = load i64, i64* %3
%6 = urem i64 %5, 64
%7 = trunc i64 %6 to i32
%8 = shl i32 1, %7
%9 = xor i32 %8, -1
%10 = sext i32 %9 to i64
%11 = load i64*, i64** %4
%12 = load i64, i64* %3
%13 = udiv i64 %12, 64
%14 = getelementptr inbounds i64, i64* %11, i64 %13
%15 = load i64, i64* %14
%16 = and i64 %15, %10
store i64 %16, i64* %14
ret void
}

LLVM IR (-O2):
define void @clear_bit(i64 %0, i64* nocapture %1) {
%3 = trunc i64 %0 to i32
%4 = and i32 %3, 63
%5 = shl nuw i32 1, %4
%6 = xor i32 %5, -1
%7 = sext i32 %6 to i64
%8 = lshr i64 %0, 6
%9 = getelementptr inbounds i64, i64* %1, i64 %8
%10 = load i64, i64* %9
%11 = and i64 %10, %7
store i64 %11, i64* %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ UtilsDelay(int);
void PRCMHIBRegWrite(unsigned long ulRegAddr, unsigned long ulValue) {
  (*((volatile unsigned long *)(ulRegAddr))) = ulValue;
  UtilsDelay((80 * 200) / 3);
}


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

x86 assembly (clang, -O2):
<PRCMHIBRegWrite>:
mov    %rsi,(%rdi)
mov    $0x14d5,%edi
jmp    1030 <UtilsDelay@plt>

LLVM IR (-O0):
define void @PRCMHIBRegWrite(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %3
%7 = inttoptr i64 %6 to i64*
store volatile i64 %5, i64* %7
%8 = call i32 @UtilsDelay(i32 5333)
ret void
}

LLVM IR (-O2):
define void @PRCMHIBRegWrite(i64 %0, i64 %1) {
%3 = inttoptr i64 %0 to i64*
store volatile i64 %1, i64* %3
%4 = tail call i32 @UtilsDelay(i32 5333)
ret void
}
void *Tcl_Ckalloc(size)
unsigned int size;
{
  char *result;
  result = malloc(size);
  if (result == 0)
    panic("unable to alloc %d bytes", size);
  return result;
}


x86 assembly (clang, -O0):
<Tcl_Ckalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1155 <Tcl_Ckalloc+0x35>
mov    -0x4(%rbp),%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <panic@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Tcl_Ckalloc>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    %edi,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1144 <Tcl_Ckalloc+0x24>
lea    0xec5(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <panic@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"unable to alloc %d bytes\00"
define i8* @Tcl_Ckalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = zext i32 %4 to i64
%6 = call i8* @malloc(i64 %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %2
%11 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @panic to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %9, %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@.str = [25 x i8] c"unable to alloc %d bytes\00"
define i8* @Tcl_Ckalloc(i32 %0) {
%2 = zext i32 %0 to i64
%3 = tail call i8* @malloc(i64 %2)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @panic to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %7
7: ; preds = %5, %1
ret i8* %3
}