xunge/DecIR huggingface dataset:
/* Variables and functions */
int getAudioSample();
int /*<<< orphan*/ storeSample(int);
void sample(void) {
  int newAudio = 380 + getAudioSample();
  storeSample(newAudio);
}


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

x86 assembly (clang, -O2):
<sample>:
push   %rax
xor    %eax,%eax
call   1040 <getAudioSample@plt>
lea    0x17c(%rax),%edi
pop    %rax
jmp    1030 <storeSample@plt>

LLVM IR (-O0):
define void @sample() {
%1 = alloca i32
%2 = call i32 (...) @getAudioSample()
%3 = add nsw i32 380, %2
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = call i32 @storeSample(i32 %4)
ret void
}

LLVM IR (-O2):
define void @sample() {
%1 = tail call i32 (...) @getAudioSample()
%2 = add nsw i32 %1, 380
%3 = tail call i32 @storeSample(i32 %2)
ret void
}
const char *zlibVersion() { return "1.2.2"; }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"1.2.2\00"
define i8* @zlibVersion() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ luaL_check_lstr(int, int /*<<< orphan*/);
scalar_t__ luaL_check_number(int);
int /*<<< orphan*/ lua_gettagmethod(int, int /*<<< orphan*/);
int /*<<< orphan*/ lua_pushobject(int /*<<< orphan*/);
void gettagmethod(void) {
  lua_pushobject(
      lua_gettagmethod((int)luaL_check_number(1), (luaL_check_lstr((2), 0))));
}


x86 assembly (clang, -O0):
<gettagmethod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1030 <luaL_check_number@plt>
mov    %eax,-0x4(%rbp)
mov    $0x2,%edi
xor    %esi,%esi
call   1050 <luaL_check_lstr@plt>
mov    -0x4(%rbp),%edi
mov    %eax,%esi
call   1040 <lua_gettagmethod@plt>
mov    %eax,%edi
call   1060 <lua_pushobject@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettagmethod>:
push   %rbx
mov    $0x1,%edi
call   1030 <luaL_check_number@plt>
mov    %rax,%rbx
mov    $0x2,%edi
xor    %esi,%esi
call   1050 <luaL_check_lstr@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <lua_gettagmethod@plt>
mov    %eax,%edi
pop    %rbx
jmp    1060 <lua_pushobject@plt>

LLVM IR (-O0):
define void @gettagmethod() {
%1 = call i64 @luaL_check_number(i32 1)
%2 = trunc i64 %1 to i32
%3 = call i32 @luaL_check_lstr(i32 2, i32 0)
%4 = call i32 @lua_gettagmethod(i32 %2, i32 %3)
%5 = call i32 @lua_pushobject(i32 %4)
ret void
}

LLVM IR (-O2):
define void @gettagmethod() {
%1 = tail call i64 @luaL_check_number(i32 1)
%2 = trunc i64 %1 to i32
%3 = tail call i32 @luaL_check_lstr(i32 2, i32 0)
%4 = tail call i32 @lua_gettagmethod(i32 %2, i32 %3)
%5 = tail call i32 @lua_pushobject(i32 %4)
ret void
}
/* Variables and functions */
void reset(size_t n, double c[(n)][(n)]) {
  size_t i, j;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      c[i][j] = 0.0;
    }
  }
}


x86 assembly (clang, -O0):
<reset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1187 <reset+0x87>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1171 <reset+0x71>
mov    -0x28(%rbp),%rcx
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    -0x20(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1132 <reset+0x32>
jmp    1176 <reset+0x76>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    111c <reset+0x1c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset>:
test   %rdi,%rdi
je     112f <reset+0x1f>
push   %rax
mov    %rdi,%rdx
imul   %rdi,%rdx
shl    $0x3,%rdx
mov    %rsi,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @reset(i64 %0, double* nocapture writeonly %1) {
%3 = icmp eq i64 %0, 0
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = bitcast double* %1 to i8*
%6 = mul i64 %0, %0
%7 = shl i64 %6, 3
br label %8
8: ; preds = %4, %2
ret void
}
/* Variables and functions */
long sockShutdown();
long NETshutdown() { return sockShutdown(); }


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

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

LLVM IR (-O0):
define i64 @NETshutdown() {
%1 = call i64 (...) @sockShutdown()
ret i64 %1
}

LLVM IR (-O2):
define i64 @NETshutdown() {
%1 = tail call i64 (...) @sockShutdown()
ret i64 %1
}
/* Variables and functions */
void *solv_realloc2(void *, size_t, size_t);
void *solv_extend_resize(void *buf, size_t len, size_t size, size_t block) {
  if (len)
    buf = solv_realloc2(buf, (len + block) & ~block, size);
  return buf;
}


x86 assembly (clang, -O0):
<solv_extend_resize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1157 <solv_extend_resize+0x47>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    -0x20(%rbp),%rsi
mov    -0x20(%rbp),%rax
xor    $0xffffffffffffffff,%rax
and    %rax,%rsi
mov    -0x18(%rbp),%rdx
call   1030 <solv_realloc2@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solv_extend_resize>:
test   %rsi,%rsi
je     1126 <solv_extend_resize+0x16>
add    %rcx,%rsi
not    %rcx
and    %rsi,%rcx
mov    %rcx,%rsi
jmp    1030 <solv_realloc2@plt>
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @solv_extend_resize(i8* %0, i64 %1, i64 %2, i64 %3) {
%5 = icmp eq i64 %1, 0
br i1 %5, label %11, label %6
6: ; preds = %4
%7 = add i64 %3, %1
%8 = xor i64 %3, -1
%9 = and i64 %7, %8
%10 = tail call i8* @solv_realloc2(i8* %0, i64 %9, i64 %2)
br label %11
11: ; preds = %6, %4
%12 = phi i8* [ %10, %6 ], [ %0, %4 ]
ret i8* %12
}
/* Variables and functions */
scalar_t__ WEXITSTATUS(int);
scalar_t__ WIFEXITED(int);
int child_ok(int status) {
  if (WIFEXITED(status)) {
    if (WEXITSTATUS(status)) {
      return 0;
    } else {
      return 1;
    }
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<child_ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <WIFEXITED@plt>
cmp    $0x0,%rax
je     1167 <child_ok+0x47>
mov    -0x8(%rbp),%edi
call   1030 <WEXITSTATUS@plt>
cmp    $0x0,%rax
je     115b <child_ok+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    116e <child_ok+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    116e <child_ok+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<child_ok>:
push   %rbx
mov    %edi,%ebx
call   1040 <WIFEXITED@plt>
test   %rax,%rax
je     1141 <child_ok+0x21>
mov    %ebx,%edi
call   1030 <WEXITSTATUS@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @child_ok(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i64 @WIFEXITED(i32 %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %1
%8 = load i32, i32* %3
%9 = call i64 @WEXITSTATUS(i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 0, i32* %2
br label %14
12: ; preds = %7
store i32 1, i32* %2
br label %14
13: ; preds = %1
store i32 0, i32* %2
br label %14
14: ; preds = %13, %12, %11
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @child_ok(i32 %0) {
%2 = tail call i64 @WIFEXITED(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i64 @WEXITSTATUS(i32 %0)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ 0, %1 ]
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
void write16(void *addr, uint16_t val) { *(volatile uint16_t *)addr = val; }


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

x86 assembly (clang, -O2):
<write16>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @write16(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
store volatile i32 %5, i32* %7
ret void
}

LLVM IR (-O2):
define void @write16(i8* %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store volatile i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void cb_caller(void *cbdata, void *data) {
  int *i;
  i = data;
  printf("%d ", *i);
}


x86 assembly (clang, -O0):
<cb_caller>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cb_caller>:
mov    (%rsi),%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define void @cb_caller(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** %4
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = load i32, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @cb_caller(i8* nocapture readnone %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ disp_msg();
int /*<<< orphan*/ printf(char *);
main() {
  disp_msg();
  printf("for good learning");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <disp_msg@plt>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <disp_msg@plt>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"for good learning\00"
define i32 @main() {
%1 = call i32 (...) @disp_msg()
%2 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"for good learning\00"
define i32 @main() {
%1 = tail call i32 (...) @disp_msg()
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ handle_Command(char *);
int /*<<< orphan*/ print_Prompt();
int /*<<< orphan*/ stdin;
int main() {
  char command[4096];
  while (1) {
    print_Prompt();
    if (fgets(command, 4096, stdin) != NULL)
      handle_Command(command);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1010,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <print_Prompt@plt>
lea    -0x1010(%rbp),%rdi
mov    0x2e91(%rip),%rax
mov    (%rax),%edx
mov    $0x1000,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     1179 <main+0x49>
lea    -0x1010(%rbp),%rdi
call   1030 <handle_Command@plt>
jmp    1142 <main+0x12>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1008,%rsp
mov    0x2ea7(%rip),%r14
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <print_Prompt@plt>
mov    (%r14),%edx
mov    %rbx,%rdi
mov    $0x1000,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     1150 <main+0x20>
mov    %rbx,%rdi
call   1030 <handle_Command@plt>
jmp    1150 <main+0x20>

LLVM IR (-O0):
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [4096 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %0, %12
%4 = call i32 (...) @print_Prompt()
%5 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i32* @fgets(i8* %5, i32 4096, i32 %6)
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%11 = call i32 @handle_Command(i8* %10)
br label %12
12: ; preds = %9, %3
br label %3
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @main() {
%1 = alloca [4096 x i8]
%2 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %10, %0
%4 = call i32 (...) @print_Prompt()
%5 = load i32, i32* @stdin
%6 = call i32* @fgets(i8* %2, i32 4096, i32 %5)
%7 = icmp eq i32* %6, null
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = call i32 @handle_Command(i8* %2)
br label %10
10: ; preds = %8, %3
br label %3
}
void Inc(ptr) char **ptr;
{
  if (**ptr != '\0')
    (*ptr)++;
  else
    return;
}


x86 assembly (clang, -O0):
<Inc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     112e <Inc+0x2e>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    1133 <Inc+0x33>
jmp    1133 <Inc+0x33>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Inc>:
mov    (%rdi),%rax
cmpb   $0x0,(%rax)
je     110f <Inc+0xf>
add    $0x1,%rax
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
define void @Inc(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i8**, i8*** %2
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %9
br label %13
12: ; preds = %1
br label %13
13: ; preds = %12, %8
ret void
}

LLVM IR (-O2):
define void @Inc(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %2, i64 1
store i8* %6, i8** %0
br label %7
7: ; preds = %1, %5
ret void
}
int isNonZero(int x) {
  return (((x >> 31) & 0x01) | (((~x + 1) >> 31) & 0x01));
}


x86 assembly (clang, -O0):
<isNonZero>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
and    $0x1,%eax
mov    -0x4(%rbp),%ecx
xor    $0xffffffff,%ecx
add    $0x1,%ecx
sar    $0x1f,%ecx
and    $0x1,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isNonZero>:
xor    %eax,%eax
test   %edi,%edi
setne  %al
ret

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

LLVM IR (-O2):
define i32 @isNonZero(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
const char *zlibVersion(void) { return "1.2.7"; }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"1.2.7\00"
define i8* @zlibVersion() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
int letter(int j) {
  if ((j >= 'a' && j <= 'z') || (j >= 'A' && j <= 'Z'))
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<letter>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x61,-0x8(%rbp)
jl     111b <letter+0x1b>
cmpl   $0x7a,-0x8(%rbp)
jle    112f <letter+0x2f>
cmpl   $0x41,-0x8(%rbp)
jl     113b <letter+0x3b>
cmpl   $0x5a,-0x8(%rbp)
jg     113b <letter+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1142 <letter+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<letter>:
and    $0xffffffdf,%edi
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @letter(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 97
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 122
br i1 %8, label %15, label %9
9: ; preds = %6, %1
%10 = load i32, i32* %3
%11 = icmp sge i32 %10, 65
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i32, i32* %3
%14 = icmp sle i32 %13, 90
br i1 %14, label %15, label %16
15: ; preds = %12, %6
store i32 1, i32* %2
br label %17
16: ; preds = %12, %9
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 @letter(i32 %0) {
%2 = and i32 %0, -33
%3 = add i32 %2, -65
%4 = icmp ult i32 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *getcwd(char *, int);
char *gpwd() {
  char *buf = NULL;
  int size = 8;
  char *cwd;
  while ((cwd = getcwd(buf, size)) == NULL) {
    free(buf);
    buf = NULL;
    size *= 2;
  }
  return cwd;
}


x86 assembly (clang, -O0):
<gpwd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x8(%rbp)
movl   $0x8,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <getcwd@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1170 <gpwd+0x50>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1137 <gpwd+0x17>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpwd>:
push   %rbx
mov    $0x8,%ebx
xor    %edi,%edi
mov    $0x8,%esi
nopl   (%rax)
call   1040 <getcwd@plt>
test   %rax,%rax
jne    1149 <gpwd+0x29>
xor    %edi,%edi
call   1030 <free@plt>
add    %ebx,%ebx
xor    %edi,%edi
mov    %ebx,%esi
jmp    1130 <gpwd+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define i8* @gpwd() {
%1 = alloca i8*
%2 = alloca i32
%3 = alloca i8*
store i8* null, i8** %1
store i32 8, i32* %2
br label %4
4: ; preds = %9, %0
%5 = load i8*, i8** %1
%6 = load i32, i32* %2
%7 = call i8* @getcwd(i8* %5, i32 %6)
store i8* %7, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = load i8*, i8** %1
%11 = call i32 @free(i8* %10)
store i8* null, i8** %1
%12 = load i32, i32* %2
%13 = mul nsw i32 %12, 2
store i32 %13, i32* %2
br label %4
14: ; preds = %4
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
define i8* @gpwd() {
%1 = tail call i8* @getcwd(i8* null, i32 8)
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %9
3: ; preds = %0, %3
%4 = phi i32 [ %6, %3 ], [ 8, %0 ]
%5 = tail call i32 @free(i8* null)
%6 = shl nsw i32 %4, 1
%7 = tail call i8* @getcwd(i8* null, i32 %6)
%8 = icmp eq i8* %7, null
br i1 %8, label %3, label %9
9: ; preds = %3, %0
%10 = phi i8* [ %1, %0 ], [ %7, %3 ]
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
int strlen(char *);
void odwroc(char a[]) {
  int n = strlen(a);
  if (n == 0)
    return;
  else {
    putchar(a[n - 1]);
    a[n - 1] = '\0';
    odwroc(a);
  }
}


x86 assembly (clang, -O0):
<odwroc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1157 <odwroc+0x27>
jmp    1187 <odwroc+0x57>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
call   1040 <odwroc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<odwroc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
nopw   0x0(%rax,%rax,1)
call   1040 <strlen@plt>
test   %eax,%eax
je     1152 <odwroc+0x32>
movslq %eax,%rbx
movsbl -0x1(%rbx,%r14,1),%edi
call   1030 <putchar@plt>
movb   $0x0,-0x1(%rbx,%r14,1)
mov    %r14,%rdi
jmp    1130 <odwroc+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @odwroc(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %11, %4 ], [ %2, %1 ]
%6 = add nsw i32 %5, -1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = tail call i32 @putchar(i8 signext %9)
store i8 0, i8* %8
%11 = tail call i32 @strlen(i8* %0)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
ret void
}
void x86_write_cr2(unsigned long val) {
  __asm__ __volatile__("mov %0, %%cr2" ::"r"(val));
}


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

x86 assembly (clang, -O2):
<x86_write_cr2>:
mov    %rdi,%cr2
ret

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

LLVM IR (-O2):
define void @x86_write_cr2(i64 %0) {
tail call void asm sideeffect "mov $0, %cr2", "r,~{dirflag},~{fpsr},~{flags}"(i64 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ range_print(int, int);
int main() {
  range_print(1, 3);
  range_print(1, 3);
  range_print(1, 3);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x3,%esi
call   1030 <range_print@plt>
mov    $0x1,%edi
mov    $0x3,%esi
call   1030 <range_print@plt>
mov    $0x1,%edi
mov    $0x3,%esi
call   1030 <range_print@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @range_print(i32 1, i32 3)
%2 = tail call i32 @range_print(i32 1, i32 3)
%3 = tail call i32 @range_print(i32 1, i32 3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ err_sys(char *);
int isfdtype(int, int);
int Isfdtype(int fd, int fdtype) {
  int n;
  if ((n = isfdtype(fd, fdtype)) < 0)
    err_sys("isfdtype error");
  return (n);
}


x86 assembly (clang, -O0):
<Isfdtype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <isfdtype@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jge    1151 <Isfdtype+0x31>
lea    0xeb4(%rip),%rdi
call   1030 <err_sys@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Isfdtype>:
push   %rbx
call   1040 <isfdtype@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1138 <Isfdtype+0x18>
lea    0xecd(%rip),%rdi
call   1030 <err_sys@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"isfdtype error\00"
define i32 @Isfdtype(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 = call i32 @isfdtype(i32 %6, i32 %7)
store i32 %8, i32* %5
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @err_sys(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
%13 = load i32, i32* %5
ret i32 %13
}

LLVM IR (-O2):
@.str = [15 x i8] c"isfdtype error\00"
define i32 @Isfdtype(i32 %0, i32 %1) {
%3 = tail call i32 @isfdtype(i32 %0, i32 %1)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @err_sys(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i32 %3
}
/* Variables and functions */
int bar(int);
int f1_b() {
  int x;
  return bar(x) + 1;
}


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

x86 assembly (clang, -O2):
<f1_b>:
push   %rax
call   1030 <bar@plt>
add    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @f1_b() {
%1 = tail call i32 @bar(i32 undef)
%2 = add nsw i32 %1, 1
ret i32 %2
}
char *strcat(char *s1, register const char *s2) {
  register char *s = s1;
  while (*s++)
    ;
  --s;
  while ((*s++ = *s2++) != 0)
    ;
  return s1;
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
cmpb   $0x0,(%rax)
je     1131 <strcat+0x31>
jmp    1114 <strcat+0x14>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     1170 <strcat+0x70>
jmp    113d <strcat+0x3d>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat>:
mov    %rdi,%rax
mov    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x0,(%rcx)
lea    0x1(%rcx),%rcx
jne    1110 <strcat+0x10>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movzbl (%rsi,%rdx,1),%edi
mov    %dil,-0x1(%rcx,%rdx,1)
add    $0x1,%rdx
test   %dil,%dil
jne    1120 <strcat+0x20>
ret

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

LLVM IR (-O2):
define i8* @strcat(i8* returned %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %5, %3 ]
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %4
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %3
8: ; preds = %3, %8
%9 = phi i8* [ %11, %8 ], [ %1, %3 ]
%10 = phi i8* [ %13, %8 ], [ %4, %3 ]
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = load i8, i8* %9
%13 = getelementptr inbounds i8, i8* %10, i64 1
store i8 %12, i8* %10
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %8
15: ; preds = %8
ret i8* %0
}
/* Type definitions */
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ inet_ntop(int /*<<< orphan*/, int /*<<< orphan*/ *, char *,
                             int);
void print_ip(struct sockaddr_in *sin, char *buf) {
  inet_ntop(AF_INET, &sin->sin_addr, buf, 20);
}


x86 assembly (clang, -O0):
<print_ip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x14,%ecx
call   1030 <inet_ntop@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_ip>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    0x2ecb(%rip),%rax
mov    (%rax),%edi
mov    $0x14,%ecx
jmp    1030 <inet_ntop@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
@AF_INET = global i32 0
define void @print_ip(%struct.sockaddr_in* %0, i8* %1) {
%3 = alloca %struct.sockaddr_in*
%4 = alloca i8*
store %struct.sockaddr_in* %0, %struct.sockaddr_in** %3
store i8* %1, i8** %4
%5 = load i32, i32* @AF_INET
%6 = load %struct.sockaddr_in*, %struct.sockaddr_in** %3
%7 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
%8 = load i8*, i8** %4
%9 = call i32 @inet_ntop(i32 %5, i32* %7, i8* %8, i32 20)
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
@AF_INET = global i32 0
define void @print_ip(%struct.sockaddr_in* %0, i8* %1) {
%3 = load i32, i32* @AF_INET
%4 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 0
%5 = tail call i32 @inet_ntop(i32 %3, i32* %4, i8* %1, i32 20)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_memblockq_new() {
  printf("NOT IMPLEMENTED:"
         "pa_memblockq_new"
         "\n");
}


x86 assembly (clang, -O0):
<pa_memblockq_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [34 x i8] c"NOT IMPLEMENTED:pa_memblockq_new\0A\00"
define i32 @pa_memblockq_new() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [33 x i8] c"NOT IMPLEMENTED:pa_memblockq_new\00"
define i32 @pa_memblockq_new() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
int fun270() { return 270; }


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

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

LLVM IR (-O0):
define i32 @fun270() {
ret i32 270
}

LLVM IR (-O2):
define i32 @fun270() {
ret i32 270
}
int test_imm_31int32_reg(int val) { return ((val) & (0x31 << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_31int32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x31,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_31int32_reg(i32 %0) {
%2 = and i32 %0, 49
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void print_elem_list(char *value) { printf("%s \n", value); }


x86 assembly (clang, -O0):
<print_elem_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_elem_list>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%s \0A\00"
define void @print_elem_list(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s \0A\00"
define void @print_elem_list(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_script_error(void) {
  fprintf(stderr, "\nExternal script must print three strings:\n"
                  "\t"
                  "battery="
                  "value between 0 and 100\n"
                  "\t"
                  "ac_line="
                  "on|off\n"
                  "example 1:\n"
                  "\t"
                  "battery="
                  "25\n"
                  "\t"
                  "ac_line="
                  "on\n"
                  "example 2:\n"
                  "\t"
                  "battery="
                  "75\n"
                  "\t"
                  "ac_line="
                  "off\n");
}


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

x86 assembly (clang, -O2):
<print_script_error>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [164 x i8] c"\0AExternal script must print three strings:\0A\09battery=value between 0 and 100\0A\09ac_line=on|off\0Aexample 1:\0A\09battery=25\0A\09ac_line=on\0Aexample 2:\0A\09battery=75\0A\09ac_line=off\0A\00"
define void @print_script_error() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [164 x i8] c"\0AExternal script must print three strings:\0A\09battery=value between 0 and 100\0A\09ac_line=on|off\0Aexample 1:\0A\09battery=25\0A\09ac_line=on\0Aexample 2:\0A\09battery=75\0A\09ac_line=off\0A\00"
define void @print_script_error() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set_recursive_depth(int /*<<< orphan*/);
void set_recursive_depth_0() { set_recursive_depth(0); }


x86 assembly (clang, -O0):
<set_recursive_depth_0>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <set_recursive_depth@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @set_recursive_depth_0() {
%1 = call i32 @set_recursive_depth(i32 0)
ret void
}

LLVM IR (-O2):
define void @set_recursive_depth_0() {
%1 = tail call i32 @set_recursive_depth(i32 0)
ret void
}
unsigned int cast_uchar_uint(unsigned char x) { return (unsigned int)x; }


x86 assembly (clang, -O0):
<cast_uchar_uint>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @cast_uchar_uint(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @cast_uchar_uint(i8 zeroext %0) {
%2 = zext i8 %0 to i32
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ leftShift(int, int);
int rightShift(int /*<<< orphan*/, int);
int getRD(int instruction) {
  return rightShift(leftShift(instruction, 16), 27);
}


x86 assembly (clang, -O0):
<getRD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x10,%esi
call   1040 <leftShift@plt>
mov    %eax,%edi
mov    $0x1b,%esi
call   1030 <rightShift@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRD>:
push   %rax
mov    $0x10,%esi
call   1040 <leftShift@plt>
mov    %eax,%edi
mov    $0x1b,%esi
pop    %rax
jmp    1030 <rightShift@plt>

LLVM IR (-O0):
define i32 @getRD(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @leftShift(i32 %3, i32 16)
%5 = call i32 @rightShift(i32 %4, i32 27)
ret i32 %5
}

LLVM IR (-O2):
define i32 @getRD(i32 %0) {
%2 = tail call i32 @leftShift(i32 %0, i32 16)
%3 = tail call i32 @rightShift(i32 %2, i32 27)
ret i32 %3
}
/* Variables and functions */
int keylen(char *key[]) {
  int i = 0;
  while (key[i++] != NULL)
    ;
  return i - 1;
}


x86 assembly (clang, -O0):
<keylen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1131 <keylen+0x31>
jmp    110f <keylen+0xf>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<keylen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpq   $0x0,(%rdi)
lea    0x8(%rdi),%rdi
jne    1110 <keylen+0x10>
ret

LLVM IR (-O0):
define i32 @keylen(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %1
%5 = load i8**, i8*** %2
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 1
store i32 %7, i32* %3
%8 = sext i32 %6 to i64
%9 = getelementptr inbounds i8*, i8** %5, i64 %8
%10 = load i8*, i8** %9
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %13
12: ; preds = %4
br label %4
13: ; preds = %4
%14 = load i32, i32* %3
%15 = sub nsw i32 %14, 1
ret i32 %15
}

LLVM IR (-O2):
define i32 @keylen(i8** nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %4, %2 ], [ 0, %1 ]
%4 = add nuw i64 %3, 1
%5 = getelementptr inbounds i8*, i8** %0, i64 %3
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
int ev3_battery_voltage_mV(void) { return 8900; }


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

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

LLVM IR (-O0):
define i32 @ev3_battery_voltage_mV() {
ret i32 8900
}

LLVM IR (-O2):
define i32 @ev3_battery_voltage_mV() {
ret i32 8900
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
void EEPROMIntDisable(unsigned long ulIntFlags) {
  DEBUG_ASSERT(ulIntFlags == 0x00000004);
  (*((volatile unsigned long *)(0x400FD010))) &= ~0x00000004;
  (*((volatile unsigned long *)(0x400AF040))) &= ~0x00000001;
}


x86 assembly (clang, -O0):
<EEPROMIntDisable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x4,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    $0x400fd010,%eax
mov    (%rax),%rcx
and    $0xfffffffffffffffb,%rcx
mov    $0x400fd010,%eax
mov    %rcx,(%rax)
mov    $0x400af040,%eax
mov    (%rax),%rcx
and    $0xfffffffffffffffe,%rcx
mov    $0x400af040,%eax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EEPROMIntDisable>:
push   %rax
xor    %eax,%eax
cmp    $0x4,%rdi
sete   %al
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
andq   $0xfffffffffffffffb,0x400fd010
40 fb
andq   $0xfffffffffffffffe,0x400af040
40 fe
pop    %rax
ret

LLVM IR (-O0):
define void @EEPROMIntDisable(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp eq i64 %3, 4
%5 = zext i1 %4 to i32
%6 = call i32 @DEBUG_ASSERT(i32 %5)
%7 = load volatile i64, i64* inttoptr (i64 1074778128 to i64*)
%8 = and i64 %7, -5
store volatile i64 %8, i64* inttoptr (i64 1074778128 to i64*)
%9 = load volatile i64, i64* inttoptr (i64 1074458688 to i64*)
%10 = and i64 %9, -2
store volatile i64 %10, i64* inttoptr (i64 1074458688 to i64*)
ret void
}

LLVM IR (-O2):
define void @EEPROMIntDisable(i64 %0) {
%2 = icmp eq i64 %0, 4
%3 = zext i1 %2 to i32
%4 = tail call i32 @DEBUG_ASSERT(i32 %3)
%5 = load volatile i64, i64* inttoptr (i64 1074778128 to i64*)
%6 = and i64 %5, -5
store volatile i64 %6, i64* inttoptr (i64 1074778128 to i64*)
%7 = load volatile i64, i64* inttoptr (i64 1074458688 to i64*)
%8 = and i64 %7, -2
store volatile i64 %8, i64* inttoptr (i64 1074458688 to i64*)
ret void
}
/* Variables and functions */
int strcmp(char *, char *);
int compare(const void *elem1, const void *elem2) {
  return (strcmp((char *)elem1, (char *)elem2));
}


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

x86 assembly (clang, -O2):
<compare>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
const char *str_expr_stmt() { return "statement"; }


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"statement\00"
define i8* @str_expr_stmt() {
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [10 x i8] c"statement\00"
define i8* @str_expr_stmt() {
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ f(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, int /*<<< orphan*/ *);
int main() {
  uint32_t n = 0;
  scanf("%u", &n);
  printf("%llu\n", f(n));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1030 <f@plt>
mov    %eax,%esi
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xec0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1030 <f@plt>
lea    0xea9(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%u\00"
@.str.1 = [6 x i8] c"%llu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%4 = load i32, i32* %2
%5 = call i32 @f(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%u\00"
@.str.1 = [6 x i8] c"%llu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @f(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ print_error(char *, char const *, int);
void exit_error(const char *message, int err) {
  print_error("error", message, err);
  exit(1);
}


x86 assembly (clang, -O0):
<exit_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xec3(%rip),%rdi
call   1030 <print_error@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<exit_error>:
push   %rax
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xed3(%rip),%rdi
call   1030 <print_error@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"error\00"
define void @exit_error(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @print_error(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
%8 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [6 x i8] c"error\00"
define void @exit_error(i8* %0, i32 %1) {
%3 = tail call i32 @print_error(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
%4 = tail call i32 @exit(i32 1)
unreachable
}
unsigned long ftrace_call_adjust(unsigned long addr) { return addr - 4; }


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

x86 assembly (clang, -O2):
<ftrace_call_adjust>:
lea    -0x4(%rdi),%rax
ret

LLVM IR (-O0):
define i64 @ftrace_call_adjust(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sub i64 %3, 4
ret i64 %4
}

LLVM IR (-O2):
define i64 @ftrace_call_adjust(i64 %0) {
%2 = add i64 %0, -4
ret i64 %2
}