xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hi,OpenWRT!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%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
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hi,OpenWRT!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [12 x i8] c"Hi,OpenWRT!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
scalar_t__ dlclose(void *);
int /*<<< orphan*/ dlerror();
int /*<<< orphan*/ print_error(char *, int /*<<< orphan*/);
void unload_shared_object(void *handle) {
  if (NULL != handle) {
    if (dlclose(handle)) {
      print_error("dlclose", dlerror());
    }
  }
}


x86 assembly (clang, -O0):
<unload_shared_object>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
je     1175 <unload_shared_object+0x45>
mov    -0x8(%rbp),%rdi
call   1050 <dlclose@plt>
cmp    $0x0,%rax
je     1170 <unload_shared_object+0x40>
mov    $0x0,%al
call   1030 <dlerror@plt>
mov    %eax,%esi
lea    0xe95(%rip),%rdi
call   1040 <print_error@plt>
jmp    1175 <unload_shared_object+0x45>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unload_shared_object>:
push   %rax
test   %rdi,%rdi
je     1156 <unload_shared_object+0x26>
call   1050 <dlclose@plt>
test   %rax,%rax
je     1156 <unload_shared_object+0x26>
xor    %eax,%eax
call   1030 <dlerror@plt>
lea    0xeb2(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1040 <print_error@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"dlclose\00"
define void @unload_shared_object(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* null, %3
br i1 %4, label %5, label %13
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i64 @dlclose(i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = call i32 (...) @dlerror()
%11 = call i32 @print_error(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %9, %5
br label %13
13: ; preds = %12, %1
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"dlclose\00"
define void @unload_shared_object(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = tail call i64 @dlclose(i8* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 (...) @dlerror()
%8 = tail call i32 @print_error(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %3, %6, %1
ret void
}
/* Variables and functions */
int doubler(int *x, int *result) {
  if (x == NULL || result == NULL) {
    return 1;
  }
  *result = *x * 2;
  return 0;
}


x86 assembly (clang, -O0):
<doubler>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1122 <doubler+0x22>
cmpq   $0x0,-0x18(%rbp)
jne    112e <doubler+0x2e>
movl   $0x1,-0x4(%rbp)
jmp    1144 <doubler+0x44>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
shl    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<doubler>:
mov    $0x1,%eax
test   %rdi,%rdi
je     1117 <doubler+0x17>
test   %rsi,%rsi
je     1117 <doubler+0x17>
mov    (%rdi),%eax
add    %eax,%eax
mov    %eax,(%rsi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @doubler(i32* %0, i32* writeonly %1) {
%3 = icmp eq i32* %0, null
%4 = icmp eq i32* %1, null
%5 = or i1 %3, %4
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i32, i32* %0
%8 = shl nsw i32 %7, 1
store i32 %8, i32* %1
br label %9
9: ; preds = %2, %6
%10 = phi i32 [ 0, %6 ], [ 1, %2 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned long long);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *misc_malloc(size_t size) {
  void *result;
  result = malloc(size);
  if (result == NULL) {
    fprintf(stderr, "Could not allocate %lld bytes of memory",
            (unsigned long long)size);
  }
  return result;
}


x86 assembly (clang, -O0):
<misc_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115d <misc_malloc+0x3d>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xea8(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<misc_malloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114c <misc_malloc+0x2c>
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
lea    0xebc(%rip),%rsi
mov    %r14,%rdx
call   1030 <fprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [40 x i8] c"Could not allocate %lld bytes of memory\00"
define i8* @misc_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i64, i64* %2
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i64 %10)
br label %12
12: ; preds = %8, %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"Could not allocate %lld bytes of memory\00"
define noalias i8* @misc_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i64 %0)
br label %7
7: ; preds = %4, %1
ret i8* %2
}
void ASN1_item_ndef_i2d(void) {}


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

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

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

LLVM IR (-O2):
define void @ASN1_item_ndef_i2d() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ i2d_of_void;
typedef int /*<<< orphan*/ RSA;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int PEM_ASN1_write(int /*<<< orphan*/ *, int /*<<< orphan*/,
                   int /*<<< orphan*/ *, void *, int /*<<< orphan*/ *,
                   int /*<<< orphan*/ *, int /*<<< orphan*/,
                   int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ PEM_STRING_RSA_PUBLIC;
scalar_t__ i2d_RSAPublicKey;
int PEM_write_RSAPublicKey(FILE *fp, const RSA *x) {
  return PEM_ASN1_write((i2d_of_void *)i2d_RSAPublicKey, PEM_STRING_RSA_PUBLIC,
                        fp, (void *)x, NULL, NULL, 0, NULL, NULL);
}


x86 assembly (clang, -O0):
<PEM_write_RSAPublicKey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%rdi
mov    0x2eb7(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r9d
xor    %eax,%eax
mov    %r9,%r8
movl   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
call   1030 <PEM_ASN1_write@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PEM_write_RSAPublicKey>:
sub    $0x18,%rsp
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2eaf(%rip),%rax
mov    (%rax),%rdi
mov    0x2ebd(%rip),%rax
mov    (%rax),%esi
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rsp)
movl   $0x0,(%rsp)
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <PEM_ASN1_write@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@i2d_RSAPublicKey = global i64 0
@PEM_STRING_RSA_PUBLIC = global i32 0
define i32 @PEM_write_RSAPublicKey(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i64, i64* @i2d_RSAPublicKey
%6 = inttoptr i64 %5 to i32*
%7 = load i32, i32* @PEM_STRING_RSA_PUBLIC
%8 = load i32*, i32** %3
%9 = load i32*, i32** %4
%10 = bitcast i32* %9 to i8*
%11 = call i32 @PEM_ASN1_write(i32* %6, i32 %7, i32* %8, i8* %10, i32* null, i32* null, i32 0, i32* null, i32* null)
ret i32 %11
}

LLVM IR (-O2):
@i2d_RSAPublicKey = global i64 0
@PEM_STRING_RSA_PUBLIC = global i32 0
define i32 @PEM_write_RSAPublicKey(i32* %0, i32* %1) {
%3 = load i64, i64* @i2d_RSAPublicKey
%4 = inttoptr i64 %3 to i32*
%5 = load i32, i32* @PEM_STRING_RSA_PUBLIC
%6 = bitcast i32* %1 to i8*
%7 = tail call i32 @PEM_ASN1_write(i32* %4, i32 %5, i32* %0, i8* %6, i32* null, i32* null, i32 0, i32* null, i32* null)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ free3(void ***);
void free3double(double ***p) { free3((void ***)p); }


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

x86 assembly (clang, -O2):
<free3double>:
jmp    1030 <free3@plt>

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

LLVM IR (-O2):
define void @free3double(double*** %0) {
%2 = bitcast double*** %0 to i8***
%3 = tail call i32 @free3(i8*** %2)
ret void
}
int _ht_cmp_int(void *d1, void *d2) {
  int i1 = *(int *)d1;
  int i2 = *(int *)d2;
  int i = i1 - i2;
  int result = 0;
  if (i < 0) {
    result = -1;
  } else if (i > 0) {
    result = 1;
  }
  return result;
}


x86 assembly (clang, -O0):
<_ht_cmp_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1144 <_ht_cmp_int+0x44>
movl   $0xffffffff,-0x20(%rbp)
jmp    115a <_ht_cmp_int+0x5a>
cmpl   $0x0,-0x1c(%rbp)
jle    1155 <_ht_cmp_int+0x55>
movl   $0x1,-0x20(%rbp)
jmp    115a <_ht_cmp_int+0x5a>
mov    -0x20(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ht_cmp_int>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setne  %cl
mov    $0xffffffff,%eax
cmovns %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @_ht_cmp_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i32
%10 = icmp sgt i32 %7, -1
%11 = select i1 %10, i32 %9, i32 -1
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int XGrabServer() {
  printf("XGrabServer called\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<XGrabServer>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"XGrabServer called\0A\00"
define i32 @XGrabServer() {
%1 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [19 x i8] c"XGrabServer called\00"
define i32 @XGrabServer() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void NET_pause() {}


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

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

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

LLVM IR (-O2):
define void @NET_pause() {
ret void
}
void test_stdbool_initialization(int y) {
  if (y < 0) {
    _Bool x = y;
    return;
  }
  if (y > 1) {
    _Bool x = y;
    return;
  }
  _Bool x = y;
}


x86 assembly (clang, -O0):
<test_stdbool_initialization>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1122 <test_stdbool_initialization+0x22>
cmpl   $0x0,-0x4(%rbp)
setne  %al
and    $0x1,%al
mov    %al,-0x5(%rbp)
jmp    1149 <test_stdbool_initialization+0x49>
cmpl   $0x1,-0x4(%rbp)
jle    113d <test_stdbool_initialization+0x3d>
cmpl   $0x0,-0x4(%rbp)
setne  %al
and    $0x1,%al
mov    %al,-0x6(%rbp)
jmp    1149 <test_stdbool_initialization+0x49>
cmpl   $0x0,-0x4(%rbp)
setne  %al
and    $0x1,%al
mov    %al,-0x7(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @test_stdbool_initialization(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ chSysLock();
int /*<<< orphan*/ port_get_irq_status();
scalar_t__ port_irq_enabled(int /*<<< orphan*/);
void chSysUnconditionalLock(void) {
  if (port_irq_enabled(port_get_irq_status()))
    chSysLock();
}


x86 assembly (clang, -O0):
<chSysUnconditionalLock>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <port_get_irq_status@plt>
mov    %eax,%edi
call   1050 <port_irq_enabled@plt>
cmp    $0x0,%rax
je     1153 <chSysUnconditionalLock+0x23>
mov    $0x0,%al
call   1040 <chSysLock@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<chSysUnconditionalLock>:
push   %rax
xor    %eax,%eax
call   1030 <port_get_irq_status@plt>
mov    %eax,%edi
call   1050 <port_irq_enabled@plt>
test   %rax,%rax
je     114c <chSysUnconditionalLock+0x1c>
xor    %eax,%eax
pop    %rcx
jmp    1040 <chSysLock@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @chSysUnconditionalLock() {
%1 = call i32 (...) @port_get_irq_status()
%2 = call i64 @port_irq_enabled(i32 %1)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @chSysLock()
br label %6
6: ; preds = %4, %0
ret void
}

LLVM IR (-O2):
define void @chSysUnconditionalLock() {
%1 = tail call i32 (...) @port_get_irq_status()
%2 = tail call i64 @port_irq_enabled(i32 %1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 (...) @chSysLock()
br label %6
6: ; preds = %4, %0
ret void
}
float myrand() {
  static int k = 0;
  k += 1231543214;
  return ((k % 12421) / 12421.0);
}


x86 assembly (clang, -O0):
<myrand>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f1a(%rip),%eax
add    $0x4967dbae,%eax
mov    %eax,0x2f0f(%rip)
mov    0x2f09(%rip),%eax
mov    $0x3085,%ecx
cltd
idiv   %ecx
cvtsi2sd %edx,%xmm0
movsd  0xed1(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<myrand>:
mov    0x2f1e(%rip),%eax
lea    0x4967dbae(%rax),%ecx
mov    %ecx,0x2f12(%rip)
movslq %ecx,%rcx
imul   $0xffffffffa8d6d761,%rcx,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
add    $0x4967dbae,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0xd,%ecx
add    %edx,%ecx
imul   $0x3085,%ecx,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x4967dbae,%eax
cvtsi2sd %eax,%xmm0
divsd  0xeb3(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
@myrand.k = internal global i32 0
define float @myrand() {
%1 = load i32, i32* @myrand.k
%2 = add nsw i32 %1, 1231543214
store i32 %2, i32* @myrand.k
%3 = load i32, i32* @myrand.k
%4 = srem i32 %3, 12421
%5 = sitofp i32 %4 to double
%6 = fdiv double %5, 1.242100e+04
%7 = fptrunc double %6 to float
ret float %7
}

LLVM IR (-O2):
@myrand.k = internal unnamed_addr global i32 0
define float @myrand() {
%1 = load i32, i32* @myrand.k
%2 = add nsw i32 %1, 1231543214
store i32 %2, i32* @myrand.k
%3 = srem i32 %2, 12421
%4 = sitofp i32 %3 to double
%5 = fdiv double %4, 1.242100e+04
%6 = fptrunc double %5 to float
ret float %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ OPENSSL_free(int /*<<< orphan*/ *);
void bridge_openssl_free_unsigned(uint8_t *buffer) { OPENSSL_free(buffer); }


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

x86 assembly (clang, -O2):
<bridge_openssl_free_unsigned>:
jmp    1030 <OPENSSL_free@plt>

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

LLVM IR (-O2):
define void @bridge_openssl_free_unsigned(i32* %0) {
%2 = tail call i32 @OPENSSL_free(i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ rul___emit_string(char *);
int /*<<< orphan*/ rul___emit_verify_newline();
void rul__emit_constant_definition(char *constant_name, char *constant_value) {
  rul___emit_verify_newline();
  rul___emit_string("#define ");
  rul___emit_string(constant_name);
  rul___emit_string(" ");
  rul___emit_string(constant_value);
}


x86 assembly (clang, -O0):
<rul__emit_constant_definition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <rul___emit_verify_newline@plt>
lea    0xec2(%rip),%rdi
call   1030 <rul___emit_string@plt>
mov    -0x8(%rbp),%rdi
call   1030 <rul___emit_string@plt>
lea    0xeb4(%rip),%rdi
call   1030 <rul___emit_string@plt>
mov    -0x10(%rbp),%rdi
call   1030 <rul___emit_string@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rul__emit_constant_definition>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <rul___emit_verify_newline@plt>
lea    0xec8(%rip),%rdi
call   1030 <rul___emit_string@plt>
mov    %rbx,%rdi
call   1030 <rul___emit_string@plt>
lea    0xebb(%rip),%rdi
call   1030 <rul___emit_string@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <rul___emit_string@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"#define \00"
@.str.1 = [2 x i8] c" \00"
define void @rul__emit_constant_definition(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = call i32 (...) @rul___emit_verify_newline()
%6 = call i32 @rul___emit_string(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %3
%8 = call i32 @rul___emit_string(i8* %7)
%9 = call i32 @rul___emit_string(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = load i8*, i8** %4
%11 = call i32 @rul___emit_string(i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"#define \00"
@.str.1 = [2 x i8] c" \00"
define void @rul__emit_constant_definition(i8* %0, i8* %1) {
%3 = tail call i32 (...) @rul___emit_verify_newline()
%4 = tail call i32 @rul___emit_string(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @rul___emit_string(i8* %0)
%6 = tail call i32 @rul___emit_string(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @rul___emit_string(i8* %1)
ret void
}
void vlistDefVarIntKey(int vlistID, int varID, const char *name, int value) {
  (void)vlistID;
  (void)varID;
  (void)name;
  (void)value;
}


x86 assembly (clang, -O0):
<vlistDefVarIntKey>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @vlistDefVarIntKey(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
ret void
}

LLVM IR (-O2):
define void @vlistDefVarIntKey(i32 %0, i32 %1, i8* nocapture %2, i32 %3) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, char *, int, int);
int main(void) {
  char *p =
      "#include <stdio.h>%cint "
      "main(void){char*p=%c%s%c;(void)printf(p,10,34,p,34,10);return 0;}%c";
  (void)printf(p, 10, 34, p, 34, 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0xa,%r9d
mov    $0x22,%r8d
mov    %r9d,%esi
mov    %r8d,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [92 x i8] c"#include <stdio.h>%cint main(void){char*p=%c%s%c;(void)printf(p,10,34,p,34,10);return 0;}%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @printf(i8* %3, i32 10, i32 34, i8* %4, i32 34, i32 10)
ret i32 0
}

LLVM IR (-O2):
@.str = [92 x i8] c"#include <stdio.h>%cint main(void){char*p=%c%s%c;(void)printf(p,10,34,p,34,10);return 0;}%c\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str, i64 0, i64 0), i32 10, i32 34, i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str, i64 0, i64 0), i32 34, i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ read(int, char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
int read_vuln(int sock, char *buf) {
  char buffer[10];
  bzero(buf, 10);
  read(sock, buf, 1024);
  strcpy(buffer, buf);
  printf("%s\n", buffer);
  return 0;
}


x86 assembly (clang, -O0):
<read_vuln>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1060 <bzero@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x400,%edx
call   1050 <read@plt>
lea    -0x1a(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x1a(%rbp),%rsi
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_vuln>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
mov    $0xa,%esi
call   1060 <bzero@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1050 <read@plt>
lea    0xe(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xe82(%rip),%rdi
mov    %rbp,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @read_vuln(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [10 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @bzero(i8* %6, i32 10)
%8 = load i32, i32* %3
%9 = load i8*, i8** %4
%10 = call i32 @read(i32 %8, i8* %9, i32 1024)
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%12 = load i8*, i8** %4
%13 = call i32 @strcpy(i8* %11, i8* %12)
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @read_vuln(i32 %0, i8* %1) {
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @bzero(i8* %1, i32 10)
%6 = tail call i32 @read(i32 %0, i8* %1, i32 1024)
%7 = call i32 @strcpy(i8* %4, i8* %1)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
void wrmsr(unsigned int addr, unsigned long long value) {
  asm volatile("wrmsr" ::"c"(addr), "A"(value));
}


x86 assembly (clang, -O0):
<wrmsr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
wrmsr
pop    %rbp
ret

x86 assembly (clang, -O2):
<wrmsr>:
mov    %rsi,%rax
mov    %edi,%ecx
wrmsr
ret

LLVM IR (-O0):
define void @wrmsr(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%5 = load i32, i32* %3
%6 = load i64, i64* %4
ret void
}

LLVM IR (-O2):
define void @wrmsr(i32 %0, i64 %1) {
tail call void asm sideeffect "wrmsr", "{cx},A,~{dirflag},~{fpsr},~{flags}"(i32 %0, i64 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
char *xmalloc(size_t);
char *xstrndup(const char *buf, size_t len) {
  char *s = xmalloc(len + 1);
  memcpy(s, buf, len);
  s[len] = '\0';
  return s;
}


x86 assembly (clang, -O0):
<xstrndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1030 <xmalloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrndup>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
lea    0x1(%rsi),%rdi
call   1030 <xmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
movb   $0x0,(%rbx,%r15,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @xstrndup(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = add i64 %6, 1
%8 = call i8* @xmalloc(i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = load i8*, i8** %3
%11 = load i64, i64* %4
%12 = call i32 @memcpy(i8* %9, i8* %10, i64 %11)
%13 = load i8*, i8** %5
%14 = load i64, i64* %4
%15 = getelementptr inbounds i8, i8* %13, i64 %14
store i8 0, i8* %15
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
define i8* @xstrndup(i8* %0, i64 %1) {
%3 = add i64 %1, 1
%4 = tail call i8* @xmalloc(i64 %3)
%5 = tail call i32 @memcpy(i8* %4, i8* %0, i64 %1)
%6 = getelementptr inbounds i8, i8* %4, i64 %1
store i8 0, i8* %6
ret i8* %4
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ ngaProcessOpcode(int);
void ngaProcessPackedOpcodes(int opcode) {
  int32_t raw = opcode;
  int i;
  for (i = 0; i < 4; i++) {
    ngaProcessOpcode(raw & 0xFF);
    raw = raw >> 8;
  }
}


x86 assembly (clang, -O0):
<ngaProcessPackedOpcodes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    1157 <ngaProcessPackedOpcodes+0x47>
mov    -0x8(%rbp),%edi
and    $0xff,%edi
call   1030 <ngaProcessOpcode@plt>
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1128 <ngaProcessPackedOpcodes+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ngaProcessPackedOpcodes>:
push   %rbx
mov    %edi,%ebx
movzbl %bl,%edi
call   1030 <ngaProcessOpcode@plt>
movzbl %bh,%edi
call   1030 <ngaProcessOpcode@plt>
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%edi
call   1030 <ngaProcessOpcode@plt>
shr    $0x18,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <ngaProcessOpcode@plt>

LLVM IR (-O0):
define void @ngaProcessPackedOpcodes(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
store i32 %5, i32* %3
store i32 0, i32* %4
br label %6
6: ; preds = %15, %1
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = load i32, i32* %3
%11 = and i32 %10, 255
%12 = call i32 @ngaProcessOpcode(i32 %11)
%13 = load i32, i32* %3
%14 = ashr i32 %13, 8
store i32 %14, i32* %3
br label %15
15: ; preds = %9
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
br label %6
18: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @ngaProcessPackedOpcodes(i32 %0) {
%2 = and i32 %0, 255
%3 = tail call i32 @ngaProcessOpcode(i32 %2)
%4 = lshr i32 %0, 8
%5 = and i32 %4, 255
%6 = tail call i32 @ngaProcessOpcode(i32 %5)
%7 = lshr i32 %0, 16
%8 = and i32 %7, 255
%9 = tail call i32 @ngaProcessOpcode(i32 %8)
%10 = lshr i32 %0, 24
%11 = tail call i32 @ngaProcessOpcode(i32 %10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
main() {
  int lista[] = {24, 30, 15, 45, 34};
  int ind;
  for (ind = 0; ind < 5; ind++)
    printf("%d  ", lista[ind]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed5(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    1171 <main+0x61>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1145 <main+0x35>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x18,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2d,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x22,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.lista = [5 x i32] [i32 24, i32 30, i32 15, i32 45, i32 34]
@.str = [5 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [5 x i32]* %2 to i8*
store i32 0, i32* %3
br label %5
5: ; preds = %14, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 5
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %8
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %5
17: ; preds = %5
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d \00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 24)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 30)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 15)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 45)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 34)
ret i32 0
}
int qsort_cmp_ushort(const void *x, const void *y) {
  if (*((unsigned short *)x) < *((unsigned short *)y))
    return (-1);
  else
    return (*((unsigned short *)x) > *((unsigned short *)y));
}


x86 assembly (clang, -O0):
<qsort_cmp_ushort>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movzwl (%rax),%eax
mov    -0x18(%rbp),%rcx
movzwl (%rcx),%ecx
cmp    %ecx,%eax
jge    112e <qsort_cmp_ushort+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1149 <qsort_cmp_ushort+0x49>
mov    -0x10(%rbp),%rax
movzwl (%rax),%eax
mov    -0x18(%rbp),%rcx
movzwl (%rcx),%ecx
cmp    %ecx,%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<qsort_cmp_ushort>:
movzwl (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%ax
seta   %cl
mov    $0xffffffff,%eax
cmovae %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @qsort_cmp_ushort(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i16*
%4 = load i16, i16* %3
%5 = bitcast i8* %1 to i16*
%6 = load i16, i16* %5
%7 = icmp ult i16 %4, %6
%8 = icmp ugt i16 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_resp3_reg(uint32_t *emmc) {
  uint32_t resp3 = *(emmc + 0x1C / 4);
  printf("RESP1:-----------------------------------------\n");
  printf("RESP1: 			%#08X\n", resp3);
}


x86 assembly (clang, -O0):
<print_resp3_reg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%eax
mov    %eax,-0xc(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xef3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_resp3_reg>:
push   %rbx
mov    0x1c(%rdi),%ebx
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"RESP1:-----------------------------------------\0A\00"
@.str.1 = [17 x i8] c"RESP1: \09\09\09%X\0A\00"
define void @print_resp3_reg(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 7
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret void
}

LLVM IR (-O2):
@.str.1 = [17 x i8] c"RESP1: \09\09\09%X\0A\00"
@str = [48 x i8] c"RESP1:-----------------------------------------\00"
define void @print_resp3_reg(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 7
%3 = load i32, i32* %2
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret void
}
float __ocl_normalize_float(float src) { return 1.0f; }


x86 assembly (clang, -O0):
<__ocl_normalize_float>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xeef(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ocl_normalize_float>:
movss  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @__ocl_normalize_float(float %0) {
%2 = alloca float
store float %0, float* %2
ret float 1.000000e+00
}

LLVM IR (-O2):
define float @__ocl_normalize_float(float %0) {
ret float 1.000000e+00
}
void update_freq(int *array_freq, unsigned char *buffer) {
  for (int i = 0; i < 20000; i++) {
    array_freq[buffer[i]]++;
  }
}


x86 assembly (clang, -O0):
<update_freq>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x4e20,-0x14(%rbp)
jge    1147 <update_freq+0x47>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <update_freq+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_freq>:
mov    $0x3,%eax
cs nopw 0x0(%rax,%rax,1)
nop
movzbl -0x3(%rsi,%rax,1),%ecx
addl   $0x1,(%rdi,%rcx,4)
movzbl -0x2(%rsi,%rax,1),%ecx
addl   $0x1,(%rdi,%rcx,4)
movzbl -0x1(%rsi,%rax,1),%ecx
addl   $0x1,(%rdi,%rcx,4)
movzbl (%rsi,%rax,1),%ecx
addl   $0x1,(%rdi,%rcx,4)
add    $0x4,%rax
cmp    $0x4e23,%rax
jne    1110 <update_freq+0x10>
ret

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

LLVM IR (-O2):
define void @update_freq(i32* nocapture %0, i8* nocapture %1) {
br label %4
3: ; preds = %4
ret void
4: ; preds = %4, %2
%5 = phi i64 [ 0, %2 ], [ %33, %4 ]
%6 = getelementptr inbounds i8, i8* %1, i64 %5
%7 = load i8, i8* %6
%8 = zext i8 %7 to i64
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = add nsw i32 %10, 1
store i32 %11, i32* %9
%12 = or i64 %5, 1
%13 = getelementptr inbounds i8, i8* %1, i64 %12
%14 = load i8, i8* %13
%15 = zext i8 %14 to i64
%16 = getelementptr inbounds i32, i32* %0, i64 %15
%17 = load i32, i32* %16
%18 = add nsw i32 %17, 1
store i32 %18, i32* %16
%19 = or i64 %5, 2
%20 = getelementptr inbounds i8, i8* %1, i64 %19
%21 = load i8, i8* %20
%22 = zext i8 %21 to i64
%23 = getelementptr inbounds i32, i32* %0, i64 %22
%24 = load i32, i32* %23
%25 = add nsw i32 %24, 1
store i32 %25, i32* %23
%26 = or i64 %5, 3
%27 = getelementptr inbounds i8, i8* %1, i64 %26
%28 = load i8, i8* %27
%29 = zext i8 %28 to i64
%30 = getelementptr inbounds i32, i32* %0, i64 %29
%31 = load i32, i32* %30
%32 = add nsw i32 %31, 1
store i32 %32, i32* %30
%33 = add nuw nsw i64 %5, 4
%34 = icmp eq i64 %33, 20000
br i1 %34, label %3, label %4
}
void setvisualpage(int i) {}


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

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

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

LLVM IR (-O2):
define void @setvisualpage(i32 %0) {
ret void
}
double max(double a, double b) { return a < b ? b : a; }


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1131 <max+0x31>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    113b <max+0x3b>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
maxsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @max(double %0, double %1) {
%3 = fcmp olt double %0, %1
%4 = select i1 %3, double %1, double %0
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ __console_tx_hex16(int, unsigned short);
void print_info_hex16(unsigned short value) { __console_tx_hex16(6, value); }


x86 assembly (clang, -O0):
<print_info_hex16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    $0x6,%edi
movzwl -0x2(%rbp),%esi
call   1030 <__console_tx_hex16@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_info_hex16>:
mov    %edi,%esi
mov    $0x6,%edi
jmp    1030 <__console_tx_hex16@plt>

LLVM IR (-O0):
define void @print_info_hex16(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = call i32 @__console_tx_hex16(i32 6, i16 zeroext %3)
ret void
}

LLVM IR (-O2):
define void @print_info_hex16(i16 zeroext %0) {
%2 = tail call i32 @__console_tx_hex16(i32 6, i16 zeroext %0)
ret void
}
unsigned int tune1(unsigned int t) {
  return (t * (((t >> 12) | (t >> 8)) & (63 & (t >> 4))));
}


x86 assembly (clang, -O0):
<tune1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
shr    $0xc,%ecx
mov    -0x4(%rbp),%edx
shr    $0x8,%edx
or     %edx,%ecx
mov    -0x4(%rbp),%edx
shr    $0x4,%edx
and    $0x3f,%edx
and    %edx,%ecx
imul   %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tune1>:
mov    %edi,%eax
shr    $0xc,%eax
mov    %edi,%ecx
shr    $0x8,%ecx
or     %eax,%ecx
mov    %edi,%eax
shr    $0x4,%eax
and    %ecx,%eax
and    $0x3f,%eax
imul   %edi,%eax
ret

LLVM IR (-O0):
define i32 @tune1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = lshr i32 %4, 12
%6 = load i32, i32* %2
%7 = lshr i32 %6, 8
%8 = or i32 %5, %7
%9 = load i32, i32* %2
%10 = lshr i32 %9, 4
%11 = and i32 63, %10
%12 = and i32 %8, %11
%13 = mul i32 %3, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @tune1(i32 %0) {
%2 = lshr i32 %0, 12
%3 = lshr i32 %0, 8
%4 = or i32 %2, %3
%5 = lshr i32 %0, 4
%6 = and i32 %5, 63
%7 = and i32 %6, %4
%8 = mul i32 %7, %0
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ displays_example_passed();
void Displayer_display_example_passed() { displays_example_passed(); }


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

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

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

LLVM IR (-O2):
define void @Displayer_display_example_passed() {
%1 = tail call i32 (...) @displays_example_passed()
ret void
}
grcter_(fd) int *fd;
{ close(*fd); }


x86 assembly (clang, -O0):
<grcter_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    $0x0,%al
call   1030 <close@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grcter_>:
mov    (%rdi),%edi
xor    %eax,%eax
jmp    1030 <close@plt>

LLVM IR (-O0):
define i32 @grcter_(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = load i32, i32* %4
%6 = call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %5)
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
define i32 @grcter_(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %2)
ret i32 undef
}
void display_update(void) {}


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

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

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

LLVM IR (-O2):
define void @display_update() {
ret void
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMR59_get(void) { return U_WMRCORENONE_get("U_WMR59"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMR59\00"
define i32 @U_WMR59_get() {
%1 = call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMR59\00"
define i32 @U_WMR59_get() {
%1 = tail call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int touchwin(int /*<<< orphan*/ *);
int ncurses_touchwin(WINDOW *win) { return touchwin(win); }


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

x86 assembly (clang, -O2):
<ncurses_touchwin>:
jmp    1030 <touchwin@plt>

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

LLVM IR (-O2):
define i32 @ncurses_touchwin(i32* %0) {
%2 = tail call i32 @touchwin(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ startShell();
int main() {
  startShell();
  return 1;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @startShell()
ret i32 1
}