xunge/DecIR huggingface dataset:
/* Type definitions */
typedef scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
scalar_t__ clock();
int /*<<< orphan*/ printf(char *, double);
void stub1();
void ht_timing(void (*f)(void)) {
  clock_t t = clock();
  (*f)();
  printf("[ht_timing] %.3lf sec\n", (double)(clock() - t) / CLOCKS_PER_SEC);
}


x86 assembly (clang, -O0):
<ht_timing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x10(%rbp)
call   *-0x8(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
sub    -0x10(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2e97(%rip),%rax
divsd  (%rax),%xmm0
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ht_timing>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%r14
call   *%rbx
xor    %eax,%eax
call   1030 <clock@plt>
sub    %r14,%rax
cvtsi2sd %rax,%xmm0
mov    0x2e9f(%rip),%rax
divsd  (%rax),%xmm0
lea    0xeac(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"[ht_timing] %.3lf sec\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
define void @ht_timing(void ()* %0) {
%2 = alloca void ()*
%3 = alloca i64
store void ()* %0, void ()** %2
%4 = call i64 (...) @clock()
store i64 %4, i64* %3
%5 = load void ()*, void ()** %2
%6 = call i64 (...) @clock()
%7 = load i64, i64* %3
%8 = sub nsw i64 %6, %7
%9 = sitofp i64 %8 to double
%10 = load double, double* @CLOCKS_PER_SEC
%11 = fdiv double %9, %10
%12 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), double %11)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"[ht_timing] %.3lf sec\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
define void @ht_timing(void ()* nocapture %0) {
%2 = tail call i64 (...) @clock()
tail call void %0()
%3 = tail call i64 (...) @clock()
%4 = sub nsw i64 %3, %2
%5 = sitofp i64 %4 to double
%6 = load double, double* @CLOCKS_PER_SEC
%7 = fdiv double %5, %6
%8 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), double %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
scalar_t__ calculate_tax(int);
void test1(void) { assert(0 == calculate_tax(200)); }


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc8,%edi
call   1030 <calculate_tax@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
push   %rax
mov    $0xc8,%edi
call   1030 <calculate_tax@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
pop    %rax
jmp    1040 <assert@plt>

LLVM IR (-O0):
define void @test1() {
%1 = call i64 @calculate_tax(i32 200)
%2 = icmp eq i64 0, %1
%3 = zext i1 %2 to i32
%4 = call i32 @assert(i32 %3)
ret void
}

LLVM IR (-O2):
define void @test1() {
%1 = tail call i64 @calculate_tax(i32 200)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t rotr32(const uint32_t x, const int b) {
  return (x >> b) | (x << (32 - b));
}


x86 assembly (clang, -O0):
<rotr32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sub    -0x8(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @rotr32(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = ashr i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub nsw i32 32, %9
%11 = shl i32 %8, %10
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @rotr32(i32 %0, i32 %1) {
%3 = ashr i32 %0, %1
%4 = sub nsw i32 32, %1
%5 = shl i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
/* Type definitions */
struct mtrr_gentry {
  int dummy;
};
typedef int /*<<< orphan*/ m;

/* Variables and functions */
int main(void) {
  struct mtrr_gentry m;
  (void)m;
  return sizeof(m);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 4
}
/* Type definitions */
typedef int mode_t;
typedef int /*<<< orphan*/ dev_t;

/* Variables and functions */
int S_IFIFO;
int mknod(char const *, int, int /*<<< orphan*/);
int mkfifo(const char *path, mode_t mode) {
  dev_t dev = 0;
  return mknod(path, mode | S_IFIFO, dev);
}


x86 assembly (clang, -O0):
<mkfifo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    0x2eac(%rip),%rax
or     (%rax),%esi
mov    -0x10(%rbp),%edx
call   1030 <mknod@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkfifo>:
mov    0x2ec9(%rip),%rax
or     (%rax),%esi
xor    %edx,%edx
jmp    1030 <mknod@plt>

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

LLVM IR (-O2):
@S_IFIFO = global i32 0
define i32 @mkfifo(i8* %0, i32 %1) {
%3 = load i32, i32* @S_IFIFO
%4 = or i32 %3, %1
%5 = tail call i32 @mknod(i8* %0, i32 %4, i32 0)
ret i32 %5
}
void authless_release(struct authhandle *auth) {}


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

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

LLVM IR (-O0):
%struct.authhandle = type opaque
define void @authless_release(%struct.authhandle* %0) {
%2 = alloca %struct.authhandle*
store %struct.authhandle* %0, %struct.authhandle** %2
ret void
}

LLVM IR (-O2):
%struct.authhandle = type opaque
define void @authless_release(%struct.authhandle* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ eat(int);
int /*<<< orphan*/ put_forks(int);
int /*<<< orphan*/ take_forks(int);
int /*<<< orphan*/ think(int);
void philosopher(int i) {
  while (1) {
    think(i);
    take_forks(i);
    eat(i);
    put_forks(i);
  }
}


x86 assembly (clang, -O0):
<philosopher>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <think@plt>
mov    -0x4(%rbp),%edi
call   1060 <take_forks@plt>
mov    -0x4(%rbp),%edi
call   1030 <eat@plt>
mov    -0x4(%rbp),%edi
call   1050 <put_forks@plt>
jmp    114b <philosopher+0xb>

x86 assembly (clang, -O2):
<philosopher>:
push   %rbx
mov    %edi,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1040 <think@plt>
mov    %ebx,%edi
call   1060 <take_forks@plt>
mov    %ebx,%edi
call   1030 <eat@plt>
mov    %ebx,%edi
call   1050 <put_forks@plt>
jmp    1150 <philosopher+0x10>

LLVM IR (-O0):
define void @philosopher(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %1, %3
%4 = load i32, i32* %2
%5 = call i32 @think(i32 %4)
%6 = load i32, i32* %2
%7 = call i32 @take_forks(i32 %6)
%8 = load i32, i32* %2
%9 = call i32 @eat(i32 %8)
%10 = load i32, i32* %2
%11 = call i32 @put_forks(i32 %10)
br label %3
}

LLVM IR (-O2):
define void @philosopher(i32 %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 @think(i32 %0)
%4 = tail call i32 @take_forks(i32 %0)
%5 = tail call i32 @eat(i32 %0)
%6 = tail call i32 @put_forks(i32 %0)
br label %2
}
/* Variables and functions */
size_t internal_min(size_t a, size_t b) { return a > b ? b : a; }


x86 assembly (clang, -O0):
<internal_min>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    1127 <internal_min+0x27>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <internal_min+0x2f>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_min>:
mov    %rdi,%rax
cmp    %rsi,%rdi
cmova  %rsi,%rax
ret

LLVM IR (-O0):
define i64 @internal_min(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 = load i64, i64* %4
%7 = icmp ugt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %4
br label %12
10: ; preds = %2
%11 = load i64, i64* %3
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @internal_min(i64 %0, i64 %1) {
%3 = icmp ugt i64 %0, %1
%4 = select i1 %3, i64 %1, i64 %0
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ printf(char *, char const *, char const *);
int rename(const char *oldpath, const char *newpath) {
  printf("TODO: rename not yet implemented! (from: %s to: %s)\n", oldpath,
         newpath);
  errno = -ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<rename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
xor    %ecx,%ecx
mov    0x2eab(%rip),%rax
sub    (%rax),%ecx
mov    0x2e92(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rename>:
push   %rax
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ebe(%rip),%rax
xor    %ecx,%ecx
sub    (%rax),%ecx
mov    0x2ea3(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [53 x i8] c"TODO: rename not yet implemented! (from: %s to: %s)\0A\00"
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @rename(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 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%8 = load i32, i32* @ENOSYS
%9 = sub nsw i32 0, %8
store i32 %9, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@.str = [53 x i8] c"TODO: rename not yet implemented! (from: %s to: %s)\0A\00"
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @rename(i8* %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%4 = load i32, i32* @ENOSYS
%5 = sub nsw i32 0, %4
store i32 %5, i32* @errno
ret i32 -1
}
void approximateDelay(int milliseconds) {
  if (milliseconds > 0) {
  }
}


x86 assembly (clang, -O0):
<approximateDelay>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1116 <approximateDelay+0x16>
jmp    1116 <approximateDelay+0x16>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @approximateDelay(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
br label %6
6: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @approximateDelay(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cheat_clear();
void cheat_init() { cheat_clear(); }


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

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

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

LLVM IR (-O2):
define void @cheat_init() {
%1 = tail call i32 (...) @cheat_clear()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/ *);
int dump_string_to_textfile(const char *given_filename,
                            const char *given_string) {
  FILE *my_file;
  if (my_file = fopen(given_filename, "w")) {
    fputs(given_string, my_file);
    fclose(my_file);
    return (0);
  }
  return (1);
}


x86 assembly (clang, -O0):
<dump_string_to_textfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1180 <dump_string_to_textfile+0x50>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <fputs@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1187 <dump_string_to_textfile+0x57>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_string_to_textfile>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
lea    0xec2(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1162 <dump_string_to_textfile+0x32>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <fputs@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
jmp    1167 <dump_string_to_textfile+0x37>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
define i32 @dump_string_to_textfile(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %8, i32** %6
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = load i32*, i32** %6
%13 = call i32 @fputs(i8* %11, i32* %12)
%14 = load i32*, i32** %6
%15 = call i32 @fclose(i32* %14)
store i32 0, i32* %3
br label %17
16: ; preds = %2
store i32 1, i32* %3
br label %17
17: ; preds = %16, %10
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
define i32 @dump_string_to_textfile(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @fputs(i8* %1, i32* %3)
%7 = tail call i32 @fclose(i32* %3)
br label %8
8: ; preds = %2, %5
%9 = phi i32 [ 0, %5 ], [ 1, %2 ]
ret i32 %9
}
void xen_raw_printk(const char *fmt, ...) {}


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

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

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

LLVM IR (-O2):
define void @xen_raw_printk(i8* nocapture %0, ...) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void flushout_() {
  fflush(stdout);
  return;
}


x86 assembly (clang, -O0):
<flushout_>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<flushout_>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @flushout_() {
%1 = load i32, i32* @stdout
%2 = call i32 @fflush(i32 %1)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @flushout_() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fflush(i32 %1)
ret void
}
/* Type definitions */
struct mq_attr {
  int dummy;
};
typedef int /*<<< orphan*/ mqd_t;

/* Variables and functions */
int syscall(int, int /*<<< orphan*/, struct mq_attr const *, struct mq_attr *);
int mq_setattr(mqd_t mqd, const struct mq_attr *restrict new,
               struct mq_attr *restrict old) {
  return syscall(279, mqd, new, old);
}


x86 assembly (clang, -O0):
<mq_setattr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x117,%edi
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mq_setattr>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0x117,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.mq_attr = type { i32 }
define i32 @mq_setattr(i32 %0, %struct.mq_attr* noalias %1, %struct.mq_attr* noalias %2) {
%4 = alloca i32
%5 = alloca %struct.mq_attr*
%6 = alloca %struct.mq_attr*
store i32 %0, i32* %4
store %struct.mq_attr* %1, %struct.mq_attr** %5
store %struct.mq_attr* %2, %struct.mq_attr** %6
%7 = load i32, i32* %4
%8 = load %struct.mq_attr*, %struct.mq_attr** %5
%9 = load %struct.mq_attr*, %struct.mq_attr** %6
%10 = call i32 @syscall(i32 279, i32 %7, %struct.mq_attr* %8, %struct.mq_attr* %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.mq_attr = type { i32 }
define i32 @mq_setattr(i32 %0, %struct.mq_attr* noalias %1, %struct.mq_attr* noalias %2) {
%4 = tail call i32 @syscall(i32 279, i32 %0, %struct.mq_attr* %1, %struct.mq_attr* %2)
ret i32 %4
}
/* Type definitions */
typedef int high;

/* Variables and functions */
int xor128();
int randInt(int low, int high) { return (int)(xor128() % ((high)-low) + low); }


x86 assembly (clang, -O0):
<randInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <xor128@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randInt>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <xor128@plt>
sub    %ebp,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @randInt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 (...) @xor128()
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = sub nsw i32 %6, %7
%9 = srem i32 %5, %8
%10 = load i32, i32* %3
%11 = add nsw i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @randInt(i32 %0, i32 %1) {
%3 = tail call i32 (...) @xor128()
%4 = sub nsw i32 %1, %0
%5 = srem i32 %3, %4
%6 = add nsw i32 %5, %0
ret i32 %6
}
int func(int i) { return i + 1; }


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

x86 assembly (clang, -O2):
<func>:
lea    0x1(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @func(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int main(void) {
  int n, n2, n3;
  n = 5;
  n2 = n * n;
  n3 = n2 * n2;
  printf("n = %d, n squared = %d, n cubed = %d\n", n, n2, n3);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [38 x i8] c"n = %d, n squared = %d, n cubed = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = mul nsw i32 %5, %6
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = load i32, i32* %3
%10 = mul nsw i32 %8, %9
store i32 %10, i32* %4
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12, i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"n = %d, n squared = %d, n cubed = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 5, i32 25, i32 625)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int terminal_set8(int /*<<< orphan*/ const *);
int terminal_set(const char *value) {
  return terminal_set8((const int8_t *)value);
}


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

x86 assembly (clang, -O2):
<terminal_set>:
jmp    1030 <terminal_set8@plt>

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

LLVM IR (-O2):
define i32 @terminal_set(i8* %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 @terminal_set8(i32* %2)
ret i32 %3
}
int gcd(int a, int b) {
  if (a < b) {
    int temp = a;
    a = b;
    b = temp;
  }
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113c <gcd+0x2c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1157 <gcd+0x47>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116b <gcd+0x5b>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%esi
call   1030 <gcd@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %esi,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %edi,%eax
cmp    %edx,%edi
mov    %edx,%edi
cmovl  %eax,%edi
cmovl  %edx,%eax
cltd
idiv   %edi
test   %edx,%edx
jne    1110 <gcd+0x10>
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ %0, %2 ], [ %8, %3 ]
%5 = phi i32 [ %1, %2 ], [ %9, %3 ]
%6 = icmp slt i32 %4, %5
%7 = select i1 %6, i32 %5, i32 %4
%8 = select i1 %6, i32 %4, i32 %5
%9 = srem i32 %7, %8
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %3
11: ; preds = %3
ret i32 %8
}
/* Variables and functions */
int nrf_802154_request_continuous_carrier(int);
bool nrf_802154_continuous_carrier(void) {
  bool result;
  (void)(0x0007UL);
  result = nrf_802154_request_continuous_carrier(0x00);
  (void)(0x0007UL);
  return result;
}


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

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

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

LLVM IR (-O2):
define i32 @nrf_802154_continuous_carrier() {
%1 = tail call i32 @nrf_802154_request_continuous_carrier(i32 0)
ret i32 %1
}
void ularith_sub_ul_2ul(unsigned long *r1, unsigned long *r2,
                        const unsigned long a) {
  unsigned long u = *r1;
  *r1 -= a;
  if (*r1 > u)
    (*r2)--;
}


x86 assembly (clang, -O0):
<ularith_sub_ul_2ul>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
sub    %rdx,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
cmp    -0x20(%rbp),%rax
jbe    114b <ularith_sub_ul_2ul+0x4b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ularith_sub_ul_2ul>:
sub    %rdx,(%rdi)
jae    1109 <ularith_sub_ul_2ul+0x9>
addq   $0xffffffffffffffff,(%rsi)
ret

LLVM IR (-O0):
define void @ularith_sub_ul_2ul(i64* %0, i64* %1, i64 %2) {
%4 = alloca i64*
%5 = alloca i64*
%6 = alloca i64
%7 = alloca i64
store i64* %0, i64** %4
store i64* %1, i64** %5
store i64 %2, i64* %6
%8 = load i64*, i64** %4
%9 = load i64, i64* %8
store i64 %9, i64* %7
%10 = load i64, i64* %6
%11 = load i64*, i64** %4
%12 = load i64, i64* %11
%13 = sub i64 %12, %10
store i64 %13, i64* %11
%14 = load i64*, i64** %4
%15 = load i64, i64* %14
%16 = load i64, i64* %7
%17 = icmp ugt i64 %15, %16
br i1 %17, label %18, label %22
18: ; preds = %3
%19 = load i64*, i64** %5
%20 = load i64, i64* %19
%21 = add i64 %20, -1
store i64 %21, i64* %19
br label %22
22: ; preds = %18, %3
ret void
}

LLVM IR (-O2):
define void @ularith_sub_ul_2ul(i64* nocapture %0, i64* nocapture %1, i64 %2) {
%4 = load i64, i64* %0
%5 = sub i64 %4, %2
store i64 %5, i64* %0
%6 = icmp ult i64 %4, %2
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load i64, i64* %1
%9 = add i64 %8, -1
store i64 %9, i64* %1
br label %10
10: ; preds = %7, %3
ret void
}
int test_imm_E1uint8_mem(unsigned char *val) {
  return ((*val) & (0xE1 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_E1uint8_mem>:
testb  $0xe1,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_E1uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -31
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int get_array(int a[2][5], int x, int y) { return a[x][y]; }


x86 assembly (clang, -O0):
<get_array>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_array>:
movslq %esi,%rax
movslq %edx,%rcx
lea    (%rax,%rax,4),%rax
lea    (%rdi,%rax,4),%rax
mov    (%rax,%rcx,4),%eax
ret

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

LLVM IR (-O2):
define i32 @get_array([5 x i32]* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 %4, i64 %5
%7 = load i32, i32* %6
ret i32 %7
}
int sub() {
  int age;
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @sub() {
%1 = alloca i32
ret i32 0
}

LLVM IR (-O2):
define i32 @sub() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  switch (argc) {
  case 1:
    sleep(0);
    break;
  default:
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
jne    1143 <main+0x33>
jmp    1137 <main+0x27>
xor    %edi,%edi
call   1030 <sleep@plt>
jmp    1148 <main+0x38>
jmp    1148 <main+0x38>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x1,%edi
jne    1121 <main+0x11>
push   %rax
xor    %edi,%edi
call   1030 <sleep@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @sleep(i32 0)
br label %6
6: ; preds = %2, %4
ret i32 0
}
/* Variables and functions */
double vec_mag(double, double);
void vec_norm(double *x, double *y) {
  double mag = vec_mag(*x, *y);
  *x /= mag;
  *y /= mag;
}


x86 assembly (clang, -O0):
<vec_norm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
call   1030 <vec_mag@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec_norm>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
call   1030 <vec_mag@plt>
movsd  (%rbx),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx)
movsd  (%r14),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @vec_norm(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%6 = load double*, double** %3
%7 = load double, double* %6
%8 = load double*, double** %4
%9 = load double, double* %8
%10 = call double @vec_mag(double %7, double %9)
store double %10, double* %5
%11 = load double, double* %5
%12 = load double*, double** %3
%13 = load double, double* %12
%14 = fdiv double %13, %11
store double %14, double* %12
%15 = load double, double* %5
%16 = load double*, double** %4
%17 = load double, double* %16
%18 = fdiv double %17, %15
store double %18, double* %16
ret void
}

LLVM IR (-O2):
define void @vec_norm(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = tail call double @vec_mag(double %3, double %4)
%6 = load double, double* %0
%7 = fdiv double %6, %5
store double %7, double* %0
%8 = load double, double* %1
%9 = fdiv double %8, %5
store double %9, double* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ playsound(int, int, int, int /*<<< orphan*/,
                             int /*<<< orphan*/);
void touch(void) { playsound(38, 18050, 6000, 0, 0); }


x86 assembly (clang, -O0):
<touch>:
push   %rbp
mov    %rsp,%rbp
mov    $0x26,%edi
mov    $0x4682,%esi
mov    $0x1770,%edx
xor    %r8d,%r8d
mov    %r8d,%ecx
call   1030 <playsound@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<touch>:
mov    $0x26,%edi
mov    $0x4682,%esi
mov    $0x1770,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
jmp    1030 <playsound@plt>

LLVM IR (-O0):
define void @touch() {
%1 = call i32 @playsound(i32 38, i32 18050, i32 6000, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @touch() {
%1 = tail call i32 @playsound(i32 38, i32 18050, i32 6000, i32 0, i32 0)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ chr1setBank2(int);
int /*<<< orphan*/ chr1setBank3(int);
void m33setParams8XX3(uint16_t addr, uint8_t val) {
  (void)addr;
  chr1setBank2((val << 11) | 0x000);
  chr1setBank3((val << 11) | 0x400);
}


x86 assembly (clang, -O0):
<m33setParams8XX3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
shl    $0xb,%edi
or     $0x0,%edi
call   1030 <chr1setBank2@plt>
mov    -0x8(%rbp),%edi
shl    $0xb,%edi
or     $0x400,%edi
call   1040 <chr1setBank3@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m33setParams8XX3>:
push   %rbx
mov    %esi,%ebx
shl    $0xb,%ebx
mov    %ebx,%edi
call   1030 <chr1setBank2@plt>
or     $0x400,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1040 <chr1setBank3@plt>

LLVM IR (-O0):
define void @m33setParams8XX3(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, 11
%8 = or i32 %7, 0
%9 = call i32 @chr1setBank2(i32 %8)
%10 = load i32, i32* %4
%11 = shl i32 %10, 11
%12 = or i32 %11, 1024
%13 = call i32 @chr1setBank3(i32 %12)
ret void
}

LLVM IR (-O2):
define void @m33setParams8XX3(i32 %0, i32 %1) {
%3 = shl i32 %1, 11
%4 = tail call i32 @chr1setBank2(i32 %3)
%5 = or i32 %3, 1024
%6 = tail call i32 @chr1setBank3(i32 %5)
ret void
}
/* Variables and functions */
char *realloc(char *, int /*<<< orphan*/);
void test_realloc(char *ptr) {
  char *foo = realloc(ptr, 0);
  for (unsigned i = 0; i < 100; i++) {
    foo[i] = 0;
  }
}


x86 assembly (clang, -O0):
<test_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <realloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jae    1155 <test_realloc+0x45>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1132 <test_realloc+0x22>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_realloc>:
push   %rax
xor    %esi,%esi
call   1030 <realloc@plt>
xorps  %xmm0,%xmm0
movups %xmm0,(%rax)
movups %xmm0,0x10(%rax)
movups %xmm0,0x20(%rax)
movups %xmm0,0x30(%rax)
movups %xmm0,0x40(%rax)
movups %xmm0,0x50(%rax)
movl   $0x0,0x60(%rax)
pop    %rax
ret

LLVM IR (-O0):
define void @test_realloc(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @realloc(i8* %5, i32 0)
store i8* %6, i8** %3
store i32 0, i32* %4
br label %7
7: ; preds = %15, %1
%8 = load i32, i32* %4
%9 = icmp ult i32 %8, 100
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
store i8 0, i8* %14
br label %15
15: ; preds = %10
%16 = load i32, i32* %4
%17 = add i32 %16, 1
store i32 %17, i32* %4
br label %7
18: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @test_realloc(i8* %0) {
%2 = tail call i8* @realloc(i8* %0, i32 0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
uint8_t *dns_query_append16(uint8_t *pq, uint16_t hval) {
  uint16_t nval;
  nval = htons(hval);
  memcpy(pq, &nval, 2);
  return pq + 2;
}


x86 assembly (clang, -O0):
<dns_query_append16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <htons@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x2,%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dns_query_append16>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <htons@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1040 <memcpy@plt>
add    $0x8,%rbx
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32* @dns_query_append16(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* %4
%7 = call i32 @htons(i32 %6)
store i32 %7, i32* %5
%8 = load i32*, i32** %3
%9 = call i32 @memcpy(i32* %8, i32* %5, i32 2)
%10 = load i32*, i32** %3
%11 = getelementptr inbounds i32, i32* %10, i64 2
ret i32* %11
}

LLVM IR (-O2):
define i32* @dns_query_append16(i32* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @htons(i32 %1)
store i32 %5, i32* %3
%6 = call i32 @memcpy(i32* %0, i32* %3, i32 2)
%7 = getelementptr inbounds i32, i32* %0, i64 2
ret i32* %7
}
unsigned xrop3_186_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = ~S;
  stk2 = T & stk3;
  stk1 = D | stk2;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}


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

x86 assembly (clang, -O2):
<xrop3_186_1_1>:
mov    %edi,%ecx
shl    $0x8,%ecx
mov    %esi,%edx
shl    $0x8,%edx
lea    (%rdx,%rsi,1),%eax
not    %ecx
and    %edx,%ecx
or     $0xff,%ecx
xor    %edi,%ecx
not    %eax
and    %ecx,%eax
or     %edi,%esi
or     %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @xrop3_186_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = zext i8 %1 to i32
%6 = shl nuw nsw i32 %5, 8
%7 = or i32 %6, %5
%8 = xor i32 %4, -1
%9 = and i32 %6, %8
%10 = or i32 %9, 255
%11 = xor i32 %10, %3
%12 = xor i32 %7, -1
%13 = and i32 %11, %12
%14 = or i8 %1, %0
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
ret i32 %16
}
/* Variables and functions */
size_t aaip_count_bytes(unsigned char *data, int flag) {
  int done = 0;
  unsigned char *aapt;
  for (aapt = data; !done; aapt += aapt[2])
    done = !(aapt[4] & 1);
  return ((size_t)(aapt - data));
}


x86 assembly (clang, -O0):
<aaip_count_bytes>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0x10(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1130 <aaip_count_bytes+0x30>
jmp    1166 <aaip_count_bytes+0x66>
mov    -0x18(%rbp),%rax
movzbl 0x4(%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
movzbl 0x2(%rax),%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
jmp    111a <aaip_count_bytes+0x1a>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<aaip_count_bytes>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rax,%rcx
movzbl 0x2(%rax),%eax
add    %rcx,%rax
testb  $0x1,0x4(%rcx)
jne    1110 <aaip_count_bytes+0x10>
sub    %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @aaip_count_bytes(i8* %0, i32 %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i8* [ %0, %2 ], [ %11, %3 ]
%5 = getelementptr inbounds i8, i8* %4, i64 4
%6 = load i8, i8* %5
%7 = and i8 %6, 1
%8 = getelementptr inbounds i8, i8* %4, i64 2
%9 = load i8, i8* %8
%10 = zext i8 %9 to i64
%11 = getelementptr inbounds i8, i8* %4, i64 %10
%12 = icmp eq i8 %7, 0
br i1 %12, label %13, label %3
13: ; preds = %3
%14 = ptrtoint i8* %11 to i64
%15 = ptrtoint i8* %0 to i64
%16 = sub i64 %14, %15
ret i64 %16
}
/* Type definitions */
struct fio_file {
  int dummy;
};
struct fio_dirent {
  int dummy;
};

/* Variables and functions */
void *q_readdir(struct fio_file *);
int /*<<< orphan*/ qprintf(char *, struct fio_dirent *, struct fio_file *);
void *q_FIO_FindNextEx(struct fio_dirent *dirent, struct fio_file *file) {
  qprintf("*** FIO_FindNextEx(%x, %x)\n", dirent, file);
  return q_readdir(file);
}


x86 assembly (clang, -O0):
<q_FIO_FindNextEx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xec1(%rip),%rdi
call   1040 <qprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <q_readdir@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<q_FIO_FindNextEx>:
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0xed2(%rip),%rdi
mov    %rbx,%rdx
call   1040 <qprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <q_readdir@plt>

LLVM IR (-O0):
%struct.fio_dirent = type { i32 }
%struct.fio_file = type { i32 }
@.str = [28 x i8] c"*** FIO_FindNextEx(%x, %x)\0A\00"
define i8* @q_FIO_FindNextEx(%struct.fio_dirent* %0, %struct.fio_file* %1) {
%3 = alloca %struct.fio_dirent*
%4 = alloca %struct.fio_file*
store %struct.fio_dirent* %0, %struct.fio_dirent** %3
store %struct.fio_file* %1, %struct.fio_file** %4
%5 = load %struct.fio_dirent*, %struct.fio_dirent** %3
%6 = load %struct.fio_file*, %struct.fio_file** %4
%7 = call i32 @qprintf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), %struct.fio_dirent* %5, %struct.fio_file* %6)
%8 = load %struct.fio_file*, %struct.fio_file** %4
%9 = call i8* @q_readdir(%struct.fio_file* %8)
ret i8* %9
}

LLVM IR (-O2):
%struct.fio_dirent = type { i32 }
%struct.fio_file = type { i32 }
@.str = [28 x i8] c"*** FIO_FindNextEx(%x, %x)\0A\00"
define i8* @q_FIO_FindNextEx(%struct.fio_dirent* %0, %struct.fio_file* %1) {
%3 = tail call i32 @qprintf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), %struct.fio_dirent* %0, %struct.fio_file* %1)
%4 = tail call i8* @q_readdir(%struct.fio_file* %1)
ret i8* %4
}
/* Variables and functions */
void *get_new_obj(int, int);
void *get_new_obj_set(int size, int id) {
  void *obj;
  int i;
  obj = get_new_obj(size, id);
  i = -1;
  while (++i < size)
    ((char *)(obj))[i] = 0;
  return (obj);
}


x86 assembly (clang, -O0):
<get_new_obj_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <get_new_obj@plt>
mov    %rax,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmp    -0x4(%rbp),%eax
jge    1157 <get_new_obj_set+0x47>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1134 <get_new_obj_set+0x24>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_new_obj_set>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1040 <get_new_obj@plt>
mov    %rax,%rbx
test   %ebp,%ebp
jle    113d <get_new_obj_set+0x1d>
mov    %ebp,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @get_new_obj_set(i32 %0, i32 %1) {
%3 = tail call i8* @get_new_obj(i32 %0, i32 %1)
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = zext i32 %0 to i64
br label %7
7: ; preds = %5, %2
ret i8* %3
}