xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int findmax(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int, int);
void main() {
  int a[] = {-3, -4, 1, 3, 4, 8, 6, 5, 4, 1};
  int len = sizeof(a) / sizeof(a[0]);
  printf(" Max is %d  %d", findmax(a, 0, len - 1), len);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movl   $0xa,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1050 <findmax@plt>
mov    %eax,%esi
mov    -0x34(%rbp),%edx
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1040 <findmax@plt>
lea    0xecb(%rip),%rdi
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <printf@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [10 x i32] [i32 -3, i32 -4, i32 1, i32 3, i32 4, i32 8, i32 6, i32 5, i32 4, i32 1]
@.str = [15 x i8] c" Max is %d %d\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = bitcast [10 x i32]* %1 to i8*
store i32 10, i32* %2
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = load i32, i32* %2
%6 = sub nsw i32 %5, 1
%7 = call i32 @findmax(i32* %4, i32 0, i32 %6)
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
ret void
}

LLVM IR (-O2):
@__const.main.a = [10 x i32] [i32 -3, i32 -4, i32 1, i32 3, i32 4, i32 8, i32 6, i32 5, i32 4, i32 1]
@.str = [15 x i8] c" Max is %d %d\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @findmax(i32* %3, i32 0, i32 9)
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %4, i32 10)
ret void
}
int SubReg(int a, int b) {
  __asm__ __volatile__("subl %%ebx, %%eax;" : "=a"(a) : "b"(b), "a"(a));
  return a;
}


x86 assembly (clang, -O0):
<SubReg>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0x10(%rbp),%ebx
mov    -0xc(%rbp),%eax
sub    %ebx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<SubReg>:
push   %rbx
mov    %esi,%ebx
mov    %edi,%eax
sub    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @SubReg(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 = load i32, i32* %3
%7 = call i32 asm sideeffect "subl %ebx, %eax;", "={ax},{bx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 %5, i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @SubReg(i32 %0, i32 %1) {
%3 = tail call i32 asm sideeffect "subl %ebx, %eax;", "={ax},{bx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 %1, i32 %0)
ret i32 %3
}
int main(int argc, char **argv) {
  int x = 12;
  return x << (argc + 5);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xc,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x5,%ecx
shl    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
lea    0x5(%rdi),%ecx
mov    $0xc,%eax
shl    %cl,%eax
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 12, i32* %6
%7 = load i32, i32* %6
%8 = load i32, i32* %4
%9 = add nsw i32 %8, 5
%10 = shl i32 %7, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = add nsw i32 %0, 5
%4 = shl i32 12, %3
ret i32 %4
}
int acpi_debug_init(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @acpi_debug_init() {
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t rot32r12(uint32_t x) { return (x >> 12) | (x << 20); }


x86 assembly (clang, -O0):
<rot32r12>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0xc,%eax
mov    -0x4(%rbp),%ecx
shl    $0x14,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rot32r12>:
mov    %edi,%eax
sar    $0xc,%eax
shl    $0x14,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @rot32r12(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 12
%5 = load i32, i32* %2
%6 = shl i32 %5, 20
%7 = or i32 %4, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @rot32r12(i32 %0) {
%2 = ashr i32 %0, 12
%3 = shl i32 %0, 20
%4 = or i32 %2, %3
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int pthread_join(int /*<<< orphan*/, void **);
void Pthread_join(pthread_t thread, void **value_ptr) {
  int rc = pthread_join(thread, value_ptr);
  assert(rc == 0);
}


x86 assembly (clang, -O0):
<Pthread_join>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <pthread_join@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pthread_join>:
push   %rax
call   1040 <pthread_join@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
pop    %rax
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @Pthread_join(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i32, i32* %3
%7 = load i8**, i8*** %4
%8 = call i32 @pthread_join(i32 %6, i8** %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
ret void
}

LLVM IR (-O2):
define void @Pthread_join(i32 %0, i8** %1) {
%3 = tail call i32 @pthread_join(i32 %0, i8** %1)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ start_threads();
int main() {
  start_threads();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @start_threads()
ret i32 0
}
__attribute__((no, noclone)) int l0(int A, int B) {
  int C = A & ~B;
  return ~C;
}


x86 assembly (clang, -O0):
<l0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
xor    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<l0>:
mov    %edi,%eax
not    %eax
or     %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @l0(i32 %0, i32 %1) {
%3 = xor i32 %0, -1
%4 = or i32 %3, %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "Usage:\n  install [-lcpsz#] [-o owner] [-g group] [-m mode] "
                  "[-S stack] [file1] file2\n  install [-lcpsz#] [-o owner] "
                  "[-g group] [-m mode] [-S stack] file ... dir\n  install -d "
                  "[-o owner] [-g group] [-m mode] directory\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [216 x i8] c"Usage:\0A install [-lcpsz#] [-o owner] [-g group] [-m mode] [-S stack] [file1] file2\0A install [-lcpsz#] [-o owner] [-g group] [-m mode] [-S stack] file ... dir\0A install -d [-o owner] [-g group] [-m mode] directory\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [216 x i8] c"Usage:\0A install [-lcpsz#] [-o owner] [-g group] [-m mode] [-S stack] [file1] file2\0A install [-lcpsz#] [-o owner] [-g group] [-m mode] [-S stack] file ... dir\0A install -d [-o owner] [-g group] [-m mode] directory\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
int get(int *arrs) {
  int ret = -1;
  while (*arrs == -1) {
    ++arrs;
  }
  ret = *arrs;
  *arrs = -1;
  return ret;
}


x86 assembly (clang, -O0):
<get>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0xffffffff,(%rax)
jne    112d <get+0x2d>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <get+0xf>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get>:
mov    (%rdi),%eax
add    $0x4,%rdi
cmp    $0xffffffff,%eax
je     1100 <get>
movl   $0xffffffff,-0x4(%rdi)
ret

LLVM IR (-O0):
define i32 @get(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 = load i32, i32* %5
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = load i32*, i32** %2
%10 = getelementptr inbounds i32, i32* %9, i32 1
store i32* %10, i32** %2
br label %4
11: ; preds = %4
%12 = load i32*, i32** %2
%13 = load i32, i32* %12
store i32 %13, i32* %3
%14 = load i32*, i32** %2
store i32 -1, i32* %14
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @get(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32* [ %0, %1 ], [ %6, %2 ]
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, -1
%6 = getelementptr inbounds i32, i32* %3, i64 1
br i1 %5, label %2, label %7
7: ; preds = %2
store i32 -1, i32* %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ buildregs();
int /*<<< orphan*/ initregs();
void cpuinit(void) {
  buildregs();
  initregs();
}


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

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

LLVM IR (-O0):
define void @cpuinit() {
%1 = call i32 (...) @buildregs()
%2 = call i32 (...) @initregs()
ret void
}

LLVM IR (-O2):
define void @cpuinit() {
%1 = tail call i32 (...) @buildregs()
%2 = tail call i32 (...) @initregs()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isbdigit(int);
void t_isbdigit_0x82() {
  Assert_real((isbdigit(130) == 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_isbdigit.c",
              655, ("isbdigit should be 0 for 0x82"));
}


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

x86 assembly (clang, -O2):
<t_isbdigit_0x82>:
push   %rax
mov    $0x82,%edi
call   1040 <isbdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x28f,%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_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0x82\00"
define void @t_isbdigit_0x82() {
%1 = call i64 @isbdigit(i32 130)
%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 655, 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_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0x82\00"
define void @t_isbdigit_0x82() {
%1 = tail call i64 @isbdigit(i32 130)
%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 655, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Fork();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void foo(int n) {
  int i;
  for (i = 0; i < n; i++)
    Fork();
  printf("hello\n");
  exit(0);
}


x86 assembly (clang, -O0):
<foo>:
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    1163 <foo+0x33>
mov    $0x0,%al
call   1030 <Fork@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <foo+0x12>
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<foo>:
push   %rbx
test   %edi,%edi
jle    114c <foo+0x1c>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <Fork@plt>
add    $0xffffffff,%ebx
jne    1140 <foo+0x10>
lea    0xead(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"hello\0A\00"
define void @foo(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 (...) @Fork()
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 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [6 x i8] c"hello\00"
define void @foo(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 (...) @Fork()
%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 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ prg4setBank5(int);
void m31setParams5005(uint16_t addr, uint8_t val) {
  (void)addr;
  prg4setBank5(val << 12);
}


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

x86 assembly (clang, -O2):
mov    %esi,%edi
shl    $0xc,%edi
jmp    1030 <prg4setBank5@plt>

LLVM IR (-O0):
define void @m31setParams5005(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = shl i32 %6, 12
%8 = call i32 @prg4setBank5(i32 %7)
ret void
}

LLVM IR (-O2):
define void @m31setParams5005(i32 %0, i32 %1) {
%3 = shl i32 %1, 12
%4 = tail call i32 @prg4setBank5(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  signed int w1 = -1 % 32;
  signed int flag;
  printf("%x\n", w1);
  w1 >>= 1;
  printf("%x\n", w1);
  flag = w1 >> 31;
  if (flag == -1)
    printf("SAR\n");
  else
    printf("SHR\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
sar    $0x1f,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1177 <main+0x67>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1185 <main+0x75>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%x\0A\00"
@str = [4 x i8] c"SAR\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 -1)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 -1)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ errorMessage(char *, int /*<<< orphan*/);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int i2cOpen(char *busDevice) {
  int fd;
  if ((fd = open(busDevice, O_RDWR)) < 0) {
    errorMessage("open failed: %s", strerror(errno));
    return -1;
  }
  return fd;
}


x86 assembly (clang, -O0):
<i2cOpen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1182 <i2cOpen+0x52>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %eax,%esi
lea    0xe8f(%rip),%rdi
call   1030 <errorMessage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1188 <i2cOpen+0x58>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2cOpen>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
test   %eax,%eax
js     1145 <i2cOpen+0x15>
pop    %rcx
ret
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xea6(%rip),%rdi
mov    %eax,%esi
call   1030 <errorMessage@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@O_RDWR = global i32 0
@.str = [16 x i8] c"open failed: %s\00"
@errno = global i32 0
define i32 @i2cOpen(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = load i32, i32* @O_RDWR
%7 = call i32 @open(i8* %5, i32 %6)
store i32 %7, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i32, i32* @errno
%11 = call i32 @strerror(i32 %10)
%12 = call i32 @errorMessage(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %11)
store i32 -1, i32* %2
br label %15
13: ; preds = %1
%14 = load i32, i32* %4
store i32 %14, i32* %2
br label %15
15: ; preds = %13, %9
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@O_RDWR = global i32 0
@.str = [16 x i8] c"open failed: %s\00"
@errno = global i32 0
define i32 @i2cOpen(i8* nocapture %0) {
%2 = load i32, i32* @O_RDWR
%3 = tail call i32 @open(i8* %0, i32 %2)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* @errno
%7 = tail call i32 @strerror(i32 %6)
%8 = tail call i32 @errorMessage(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ -1, %5 ], [ %3, %1 ]
ret i32 %10
}
int mkfifo(fifoname)
char *fifoname;
{ return (mknod(fifoname, (010000 | 0666), 0)); }


x86 assembly (clang, -O0):
<mkfifo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x11b6,%esi
xor    %edx,%edx
mov    $0x0,%al
call   1030 <mknod@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkfifo>:
mov    $0x11b6,%esi
xor    %edx,%edx
xor    %eax,%eax
jmp    1030 <mknod@plt>

LLVM IR (-O0):
define i32 @mkfifo(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @mknod to i32 (i8*, i32, i32, ...)*)(i8* %3, i32 4534, i32 0)
ret i32 %4
}

LLVM IR (-O2):
define i32 @mkfifo(i8* %0) {
%2 = tail call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @mknod to i32 (i8*, i32, i32, ...)*)(i8* %0, i32 4534, i32 0)
ret i32 %2
}
int not_just_blank(thestr)
char *thestr;
{
  char *thestr2;
  thestr2 = thestr;
  while (*thestr2 != '\0') {
    if (*thestr2 != ' ' && *thestr2 != '\t' && *thestr2 != '\n') {
      return (1);
    }
    ++thestr2;
  }
  return (0);
}


x86 assembly (clang, -O0):
<not_just_blank>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     116d <not_just_blank+0x6d>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     115c <not_just_blank+0x5c>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
je     115c <not_just_blank+0x5c>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     115c <not_just_blank+0x5c>
movl   $0x1,-0x4(%rbp)
jmp    1174 <not_just_blank+0x74>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1110 <not_just_blank+0x10>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<not_just_blank>:
jmp    1114 <not_just_blank+0x14>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rdi
movzbl (%rdi),%eax
lea    -0x9(%rax),%ecx
cmp    $0x2,%cl
jb     1110 <not_just_blank+0x10>
cmp    $0x20,%al
je     1110 <not_just_blank+0x10>
test   %al,%al
jne    112a <not_just_blank+0x2a>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @not_just_blank(i8* nocapture %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %7 [
i8 0, label %8
i8 32, label %5
i8 9, label %5
i8 10, label %5
]
5: ; preds = %2, %2, %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
br label %8
8: ; preds = %2, %7
%9 = phi i32 [ 1, %7 ], [ 0, %2 ]
ret i32 %9
}
void foo_2_1_2_1_2_2_2_1_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_1_2_1_2_2_2_1_2() {
ret void
}
/* Variables and functions */
int strlen(char *);
int strncmp(char *, char *, int);
int starts_with(char *match, char *buffer) {
  int size = strlen(match);
  return strncmp(match, buffer, size);
}


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

x86 assembly (clang, -O2):
<starts_with>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <strncmp@plt>

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

LLVM IR (-O2):
define i32 @starts_with(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strncmp(i8* %0, i8* %1, i32 %3)
ret i32 %4
}
int fun618() { return 618; }


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

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

LLVM IR (-O0):
define i32 @fun618() {
ret i32 618
}

LLVM IR (-O2):
define i32 @fun618() {
ret i32 618
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
void printhex(const char *data, size_t len) {
  const char *end = data + len;
  while (data < end)
    printf("%02x", *data++);
}


x86 assembly (clang, -O0):
<printhex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    115d <printhex+0x4d>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%esi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
jmp    112c <printhex+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printhex>:
push   %r15
push   %r14
push   %rbx
test   %rsi,%rsi
jle    1144 <printhex+0x34>
mov    %rsi,%r14
mov    %rdi,%rbx
add    %rdi,%r14
lea    0xed6(%rip),%r15
nopw   0x0(%rax,%rax,1)
movsbl (%rbx),%esi
add    $0x1,%rbx
mov    %r15,%rdi
call   1030 <printf@plt>
cmp    %r14,%rbx
jb     1130 <printhex+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%02x\00"
define void @printhex(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = getelementptr inbounds i8, i8* %6, i64 %7
store i8* %8, i8** %5
br label %9
9: ; preds = %13, %2
%10 = load i8*, i8** %3
%11 = load i8*, i8** %5
%12 = icmp ult i8* %10, %11
br i1 %12, label %13, label %19
13: ; preds = %9
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %3
%16 = load i8, i8* %14
%17 = sext i8 %16 to i32
%18 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %9
19: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%02x\00"
define void @printhex(i8* %0, i64 %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 %1
%4 = icmp sgt i64 %1, 0
br i1 %4, label %5, label %12
5: ; preds = %2, %5
%6 = phi i8* [ %7, %5 ], [ %0, %2 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
%10 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = icmp ult i8* %7, %3
br i1 %11, label %5, label %12
12: ; preds = %5, %2
ret void
}
void unlock_cache(void) {}


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

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

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

LLVM IR (-O2):
define void @unlock_cache() {
ret void
}
int foo() {
  int a[3];
  a[0] = 1;
  a[1] = 2;
  a[2] = 3;
  return a[0] + a[1] + a[2];
}


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

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

LLVM IR (-O0):
define i32 @foo() {
%1 = alloca [3 x i32]
%2 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
store i32 1, i32* %2
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
store i32 2, i32* %3
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
store i32 3, i32* %4
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%6 = load i32, i32* %5
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%8 = load i32, i32* %7
%9 = add nsw i32 %6, %8
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
%11 = load i32, i32* %10
%12 = add nsw i32 %9, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @foo() {
ret i32 6
}
const char *BZ2_bzlibVersion(void) { return "1.0.6, 6-Sept-2010"; }


x86 assembly (clang, -O0):
<BZ2_bzlibVersion>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BZ2_bzlibVersion>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [19 x i8] c"1.0.6, 6-Sept-2010\00"
define i8* @BZ2_bzlibVersion() {
ret i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [19 x i8] c"1.0.6, 6-Sept-2010\00"
define i8* @BZ2_bzlibVersion() {
ret i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ n;
typedef int __u64;

/* Variables and functions */
int microfs_ispow2(const __u64 n) { return ((n) > 1 && !((n) & ((n)-1))); }


x86 assembly (clang, -O0):
<microfs_ispow2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x1,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    112c <microfs_ispow2+0x2c>
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<microfs_ispow2>:
xor    %eax,%eax
cmp    $0x2,%edi
jl     1111 <microfs_ispow2+0x11>
lea    -0x1(%rdi),%ecx
xor    %eax,%eax
test   %ecx,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @microfs_ispow2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 1
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i32, i32* %2
%7 = load i32, i32* %2
%8 = sub nsw i32 %7, 1
%9 = and i32 %6, %8
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
br label %12
12: ; preds = %5, %1
%13 = phi i1 [ false, %1 ], [ %11, %5 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @microfs_ispow2(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = tail call i32 @llvm.ctpop.i32(i32 %0)
%5 = icmp ult i32 %4, 2
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %8
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ map_state;
};
typedef TYPE_1__ XWindowAttributes;

/* Variables and functions */
int get_XWindowAttributes_map_state(void *_p) {
  return (int)((XWindowAttributes *)_p)->map_state;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i32 @get_XWindowAttributes_map_state(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
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_XWindowAttributes_map_state(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Delay_ms(int);
int /*<<< orphan*/ UART1_Init(int);
int /*<<< orphan*/ UART1_Write_Text(char *);
void main() {
  UART1_Init(9600);
  Delay_ms(100);
  while (1) {
    UART1_Write_Text("hello123\r\n");
    Delay_ms(100);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2580,%edi
call   1030 <UART1_Init@plt>
mov    $0x64,%edi
call   1050 <Delay_ms@plt>
lea    0xeb1(%rip),%rdi
call   1040 <UART1_Write_Text@plt>
mov    $0x64,%edi
call   1050 <Delay_ms@plt>
jmp    1148 <main+0x18>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x2580,%edi
call   1030 <UART1_Init@plt>
mov    $0x64,%edi
call   1050 <Delay_ms@plt>
lea    0xeb4(%rip),%rbx
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1040 <UART1_Write_Text@plt>
mov    $0x64,%edi
call   1050 <Delay_ms@plt>
jmp    1150 <main+0x20>

LLVM IR (-O0):
@.str = [11 x i8] c"hello123\0D\0A\00"
define void @main() {
%1 = call i32 @UART1_Init(i32 9600)
%2 = call i32 @Delay_ms(i32 100)
br label %3
3: ; preds = %0, %3
%4 = call i32 @UART1_Write_Text(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @Delay_ms(i32 100)
br label %3
}

LLVM IR (-O2):
@.str = [11 x i8] c"hello123\0D\0A\00"
define void @main() {
%1 = tail call i32 @UART1_Init(i32 9600)
%2 = tail call i32 @Delay_ms(i32 100)
br label %3
3: ; preds = %0, %3
%4 = tail call i32 @UART1_Write_Text(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @Delay_ms(i32 100)
br label %3
}
int is_whitespace(char c) {
  if (c == ' ' || c == '\n' || c == '\t')
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<is_whitespace>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
je     1131 <is_whitespace+0x31>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
je     1131 <is_whitespace+0x31>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
jne    113d <is_whitespace+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    1144 <is_whitespace+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_whitespace>:
cmp    $0x20,%dil
ja     1120 <is_whitespace+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x100000600,%rdx
bt     %rcx,%rdx
jae    1120 <is_whitespace+0x20>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @is_whitespace(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 32
br i1 %6, label %15, label %7
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 10
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 9
br i1 %14, label %15, label %16
15: ; preds = %11, %7, %1
store i32 1, i32* %2
br label %17
16: ; preds = %11
store i32 0, i32* %2
br label %17
17: ; preds = %16, %15
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @is_whitespace(i8 signext %0) {
switch i8 %0, label %2 [
i8 32, label %3
i8 10, label %3
i8 9, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ CPUwfi();
void SysCtlDeepSleep(void) {
  (*((volatile uint32_t *)(0xE000ED10))) |= 0x00000004;
  CPUwfi();
  (*((volatile uint32_t *)(0xE000ED10))) &= ~(0x00000004);
}


x86 assembly (clang, -O0):
<SysCtlDeepSleep>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe000ed10,%eax
mov    (%rax),%ecx
or     $0x4,%ecx
mov    $0xe000ed10,%eax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <CPUwfi@plt>
mov    $0xe000ed10,%eax
mov    (%rax),%ecx
and    $0xfffffffb,%ecx
mov    $0xe000ed10,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlDeepSleep>:
push   %rbx
mov    $0xe000ed10,%ebx
orl    $0x4,(%rbx)
xor    %eax,%eax
call   1030 <CPUwfi@plt>
andl   $0xfffffffb,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @SysCtlDeepSleep() {
%1 = load volatile i32, i32* inttoptr (i64 3758157072 to i32*)
%2 = or i32 %1, 4
store volatile i32 %2, i32* inttoptr (i64 3758157072 to i32*)
%3 = call i32 (...) @CPUwfi()
%4 = load volatile i32, i32* inttoptr (i64 3758157072 to i32*)
%5 = and i32 %4, -5
store volatile i32 %5, i32* inttoptr (i64 3758157072 to i32*)
ret void
}

LLVM IR (-O2):
define void @SysCtlDeepSleep() {
%1 = load volatile i32, i32* inttoptr (i64 3758157072 to i32*)
%2 = or i32 %1, 4
store volatile i32 %2, i32* inttoptr (i64 3758157072 to i32*)
%3 = tail call i32 (...) @CPUwfi()
%4 = load volatile i32, i32* inttoptr (i64 3758157072 to i32*)
%5 = and i32 %4, -5
store volatile i32 %5, i32* inttoptr (i64 3758157072 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  printf("Course: EG1302A - Spring 2014\n");
  printf("Name: Donald A. Huskey\n");
  printf("Date: %d-%d-%d\n", 1, 28, 2014);
  printf("Assignment: %d\n", 5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
mov    $0x1,%esi
mov    $0x1c,%edx
mov    $0x7de,%ecx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
mov    $0x5,%esi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0a(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
mov    $0x1,%esi
mov    $0x1c,%edx
mov    $0x7de,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Course: EG1302A - Spring 2014\0A\00"
@.str.1 = [24 x i8] c"Name: Donald A. Huskey\0A\00"
@.str.2 = [16 x i8] c"Date: %d-%d-%d\0A\00"
@.str.3 = [16 x i8] c"Assignment: %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 28, i32 2014)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 5)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [16 x i8] c"Date: %d-%d-%d\0A\00"
@.str.3 = [16 x i8] c"Assignment: %d\0A\00"
@str = [30 x i8] c"Course: EG1302A - Spring 2014\00"
@str.4 = [23 x i8] c"Name: Donald A. Huskey\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 28, i32 2014)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr,
          "usage: mkuzixfs [-q] [-o name] [-f size] [-i size] [-r size]\n");
  fprintf(
      stderr,
      "size can be specified as a decimal number followed by an optional\n");
  fprintf(stderr,
          "letter: b,K b=blocks, K=kbytes, nothing=bytes. e.g.: 720K, 25b\n\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    0xf05(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
lea    0xf33(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf0f(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf44(%rip),%rsi
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [62 x i8] c"usage: mkuzixfs [-q] [-o name] [-f size] [-i size] [-r size]\0A\00"
@.str.1 = [67 x i8] c"size can be specified as a decimal number followed by an optional\0A\00"
@.str.2 = [65 x i8] c"letter: b,K b=blocks, K=kbytes, nothing=bytes. e.g.: 720K, 25b\0A\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [62 x i8] c"usage: mkuzixfs [-q] [-o name] [-f size] [-i size] [-r size]\0A\00"
@.str.1 = [67 x i8] c"size can be specified as a decimal number followed by an optional\0A\00"
@.str.2 = [65 x i8] c"letter: b,K b=blocks, K=kbytes, nothing=bytes. e.g.: 720K, 25b\0A\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0))
ret void
}
void what_is_a_nan_(n) int *n;
{ *n = 0xffc00000; }


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

x86 assembly (clang, -O2):
<what_is_a_nan_>:
movl   $0xffc00000,(%rdi)
ret

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

LLVM IR (-O2):
define void @what_is_a_nan_(i32* nocapture writeonly %0) {
store i32 -4194304, i32* %0
ret void
}
unsigned int ntohl(unsigned int v) {
  unsigned int res;
  asm volatile("bswap %%eax" : "=a"(res) : "a"(v));
  return res;
}


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

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

LLVM IR (-O0):
define i32 @ntohl(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 asm sideeffect "bswap %eax", "={ax},{ax},~{dirflag},~{fpsr},~{flags}"(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @ntohl(i32 %0) {
%2 = tail call i32 asm sideeffect "bswap %eax", "={ax},{ax},~{dirflag},~{fpsr},~{flags}"(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ doupdate();
int /*<<< orphan*/ signal_init();
void do_cont(int signal) {
  doupdate();
  signal_init();
}


x86 assembly (clang, -O0):
<do_cont>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <doupdate@plt>
mov    $0x0,%al
call   1030 <signal_init@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @do_cont(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @doupdate()
%4 = call i32 (...) @signal_init()
ret void
}

LLVM IR (-O2):
define void @do_cont(i32 %0) {
%2 = tail call i32 (...) @doupdate()
%3 = tail call i32 (...) @signal_init()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void fossil_free(void *p) { free(p); }


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

x86 assembly (clang, -O2):
<fossil_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @fossil_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
double random();
double get_rand() { return (1.0 * random()) / (1.0 * 2147483647); }


x86 assembly (clang, -O0):
<get_rand>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <random@plt>
movaps %xmm0,%xmm1
movsd  0xee2(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xece(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_rand>:
push   %rax
xor    %eax,%eax
call   1030 <random@plt>
divsd  0xee0(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @get_rand() {
%1 = call double (...) @random()
%2 = fmul double 1.000000e+00, %1
%3 = fdiv double %2, 0x41DFFFFFFFC00000
ret double %3
}

LLVM IR (-O2):
define double @get_rand() {
%1 = tail call double (...) @random()
%2 = fdiv double %1, 0x41DFFFFFFFC00000
ret double %2
}