xunge/DecIR huggingface dataset:
int strcmp(char *s1, char *s2) {
  while (*s1 == *s2) {
    if (!*s1)
      return 0;
    s1++;
    s2++;
  }
  return -1;
}


x86 assembly (clang, -O0):
<strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1158 <strcmp+0x58>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    113b <strcmp+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    115f <strcmp+0x5f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    110c <strcmp+0xc>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
mov    (%rdi),%cl
mov    $0xffffffff,%eax
cmp    (%rsi),%cl
jne    1124 <strcmp+0x24>
mov    $0x1,%edx
test   %cl,%cl
je     1125 <strcmp+0x25>
movzbl (%rdi,%rdx,1),%ecx
lea    0x1(%rdx),%r8
cmp    (%rsi,%rdx,1),%cl
mov    %r8,%rdx
je     1110 <strcmp+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp eq i8 %3, %4
br i1 %5, label %6, label %17
6: ; preds = %2, %11
%7 = phi i8 [ %14, %11 ], [ %3, %2 ]
%8 = phi i8* [ %13, %11 ], [ %1, %2 ]
%9 = phi i8* [ %12, %11 ], [ %0, %2 ]
%10 = icmp eq i8 %7, 0
br i1 %10, label %17, label %11
11: ; preds = %6
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = load i8, i8* %12
%15 = load i8, i8* %13
%16 = icmp eq i8 %14, %15
br i1 %16, label %6, label %17
17: ; preds = %6, %11, %2
%18 = phi i32 [ -1, %2 ], [ -1, %11 ], [ 0, %6 ]
ret i32 %18
}
int main(int argc, char **argv) {
  char *v = (char)malloc(sizeof(char) * atoi(argv[1][0]));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%edi
mov    $0x0,%al
call   1040 <atoi@plt>
movslq %eax,%rdi
shl    $0x0,%rdi
call   1030 <malloc@plt>
movsbq %al,%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rax
movsbl (%rax),%edi
xor    %eax,%eax
call   1030 <atoi@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i8**, i8*** %4
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = call i32 (i32, ...) bitcast (i32 (...)* @atoi to i32 (i32, ...)*)(i32 %11)
%13 = sext i32 %12 to i64
%14 = mul i64 1, %13
%15 = call i8* @malloc(i64 %14)
%16 = ptrtoint i8* %15 to i8
%17 = sext i8 %16 to i64
%18 = inttoptr i64 %17 to i8*
store i8* %18, i8** %5
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = tail call i32 (i32, ...) bitcast (i32 (...)* @atoi to i32 (i32, ...)*)(i32 %6)
ret i32 0
}
/* Type definitions */
struct timespec {
  int tv_sec;
  int tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_nanosleep(int /*<<< orphan*/, int /*<<< orphan*/,
                                   struct timespec *, int /*<<< orphan*/ *);
void sleep_ns(int nanosec) {
  struct timespec interval;
  interval.tv_sec = nanosec / 1000000000;
  interval.tv_nsec = nanosec % 1000000000;
  clock_nanosleep(CLOCK_MONOTONIC, 0, &interval, NULL);
}


x86 assembly (clang, -O0):
<sleep_ns>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3b9aca00,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3b9aca00,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
lea    -0x10(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <clock_nanosleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sleep_ns>:
push   %rax
movslq %edi,%rax
imul   $0x44b82fa1,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x3c,%rcx
add    %edx,%ecx
mov    %ecx,(%rsp)
imul   $0x3b9aca00,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x4(%rsp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rdx
xor    %esi,%esi
xor    %ecx,%ecx
call   1030 <clock_nanosleep@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
@CLOCK_MONOTONIC = global i32 0
define void @sleep_ns(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timespec
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sdiv i32 %4, 1000000000
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
store i32 %5, i32* %6
%7 = load i32, i32* %2
%8 = srem i32 %7, 1000000000
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
store i32 %8, i32* %9
%10 = load i32, i32* @CLOCK_MONOTONIC
%11 = call i32 @clock_nanosleep(i32 %10, i32 0, %struct.timespec* %3, i32* null)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
@CLOCK_MONOTONIC = global i32 0
define void @sleep_ns(i32 %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = sdiv i32 %0, 1000000000
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
store i32 %4, i32* %5
%6 = srem i32 %0, 1000000000
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
store i32 %6, i32* %7
%8 = load i32, i32* @CLOCK_MONOTONIC
%9 = call i32 @clock_nanosleep(i32 %8, i32 0, %struct.timespec* %2, i32* null)
ret void
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ putchar(int);
int main(void) {
  int ch;
  printf("This is the value of EOF: %d\n", EOF);
  while ((ch = getchar()) != EOF)
    putchar(ch);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%esi
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e83(%rip),%rcx
cmp    (%rcx),%eax
je     117a <main+0x4a>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    1154 <main+0x24>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2eb0(%rip),%rbx
mov    (%rbx),%esi
lea    0xebf(%rip),%rdi
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
je     1164 <main+0x34>
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    1150 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"This is the value of EOF: %d\0A\00"
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @EOF
%4 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %3)
br label %5
5: ; preds = %9, %0
%6 = call i32 (...) @getchar()
store i32 %6, i32* %2
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i32, i32* %2
%11 = call i32 @putchar(i32 %10)
br label %5
12: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"This is the value of EOF: %d\0A\00"
@EOF = global i32 0
define i32 @main() {
%1 = load i32, i32* @EOF
%2 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %12, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %9, %6 ], [ %3, %0 ]
%8 = tail call i32 @putchar(i32 %7)
%9 = tail call i32 (...) @getchar()
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %6
12: ; preds = %6, %0
ret i32 0
}
void spin_stat_val() {}


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

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

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

LLVM IR (-O2):
define void @spin_stat_val() {
ret void
}
int tls13_client_key_update_recv(struct tls13_ctx *ctx) { return 1; }


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

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

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

LLVM IR (-O2):
%struct.tls13_ctx = type opaque
define i32 @tls13_client_key_update_recv(%struct.tls13_ctx* nocapture readnone %0) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ _Error(long, char *);
void Error_BytecodeNotAllowedInSafeContext(long p_position) {
  _Error(p_position, "Bytecode blocks can only be present in unsafe context");
}


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

x86 assembly (clang, -O2):
<Error_BytecodeNotAllowedInSafeContext>:
lea    0xee9(%rip),%rsi
jmp    1030 <_Error@plt>

LLVM IR (-O0):
@.str = [54 x i8] c"Bytecode blocks can only be present in unsafe context\00"
define void @Error_BytecodeNotAllowedInSafeContext(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @_Error(i64 %3, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [54 x i8] c"Bytecode blocks can only be present in unsafe context\00"
define void @Error_BytecodeNotAllowedInSafeContext(i64 %0) {
%2 = tail call i32 @_Error(i64 %0, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_enc();
int /*<<< orphan*/ test_id_map();
int main() {
  test_id_map();
  test_enc();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_id_map()
%2 = tail call i32 (...) @test_enc()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ some_function();
int /*<<< orphan*/ test();
int main() {
  int i;
  i = 1;
  printf("i => %d\n", i);
  i = 2;
  printf("i => %d\n", i);
  some_function();
  printf("SOME UGLY HACK\n", i);
  test();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <some_function@plt>
mov    -0x8(%rbp),%esi
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <test@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <some_function@plt>
lea    0xea9(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <test@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"i => %d\0A\00"
@.str.1 = [16 x i8] c"SOME UGLY HACK\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %3)
store i32 2, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 (...) @some_function()
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = call i32 (...) @test()
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"i => %d\0A\00"
@.str.1 = [16 x i8] c"SOME UGLY HACK\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 2)
%3 = tail call i32 (...) @some_function()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 2)
%5 = tail call i32 (...) @test()
ret i32 0
}
skrand(range) {
  int temp;
  temp = random(range) + random(range);
  if (temp > range - 1)
    temp = 2 * range - 1 - temp;
  return (temp);
}


x86 assembly (clang, -O0):
<skrand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <random@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <random@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jle    115c <skrand+0x4c>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skrand>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebp
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <random@plt>
add    %ebp,%eax
cmp    %ebx,%eax
mov    %eax,%ecx
not    %ecx
lea    (%rcx,%rbx,2),%ecx
cmovge %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @skrand(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 (i32, ...) bitcast (i32 (...)* @random to i32 (i32, ...)*)(i32 %4)
%6 = load i32, i32* %2
%7 = call i32 (i32, ...) bitcast (i32 (...)* @random to i32 (i32, ...)*)(i32 %6)
%8 = add nsw i32 %5, %7
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 1
%12 = icmp sgt i32 %9, %11
br i1 %12, label %13, label %19
13: ; preds = %1
%14 = load i32, i32* %2
%15 = mul nsw i32 2, %14
%16 = sub nsw i32 %15, 1
%17 = load i32, i32* %3
%18 = sub nsw i32 %16, %17
store i32 %18, i32* %3
br label %19
19: ; preds = %13, %1
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @skrand(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @random to i32 (i32, ...)*)(i32 %0)
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @random to i32 (i32, ...)*)(i32 %0)
%4 = add nsw i32 %3, %2
%5 = icmp slt i32 %4, %0
%6 = shl nsw i32 %0, 1
%7 = xor i32 %4, -1
%8 = add i32 %6, %7
%9 = select i1 %5, i32 %4, i32 %8
ret i32 %9
}
unsigned int celix_utils_stringHash(const char *string) {
  unsigned int hc = 5381;
  char ch;
  while ((ch = *string++) != '\0') {
    hc = (hc << 5) + hc + ch;
  }
  return hc;
}


x86 assembly (clang, -O0):
<celix_utils_stringHash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1505,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0xd(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     1146 <celix_utils_stringHash+0x46>
mov    -0xc(%rbp),%eax
shl    $0x5,%eax
add    -0xc(%rbp),%eax
movsbl -0xd(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <celix_utils_stringHash+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<celix_utils_stringHash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1138 <celix_utils_stringHash+0x38>
add    $0x1,%rdi
mov    $0x1505,%edx
mov    %edx,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %cl,%ecx
shl    $0x5,%eax
add    %edx,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
mov    %eax,%edx
test   %cl,%cl
jne    1120 <celix_utils_stringHash+0x20>
ret
mov    $0x1505,%eax
ret

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

LLVM IR (-O2):
define i32 @celix_utils_stringHash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %9, %4 ], [ %0, %1 ]
%7 = phi i32 [ %11, %4 ], [ 5381, %1 ]
%8 = sext i8 %5 to i32
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = mul i32 %7, 33
%11 = add i32 %10, %8
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 5381, %1 ], [ %11, %4 ]
ret i32 %15
}
/* Type definitions */
struct frame {
  int dummy;
};
struct fcgi {
  int dummy;
};

/* Variables and functions */
int process_unknown_type(struct frame *f, struct fcgi *fcgi, const char *str,
                         size_t num) {
  return 1;
}


x86 assembly (clang, -O0):
<process_unknown_type>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.frame = type { i32 }
%struct.fcgi = type { i32 }
define i32 @process_unknown_type(%struct.frame* %0, %struct.fcgi* %1, i8* %2, i64 %3) {
%5 = alloca %struct.frame*
%6 = alloca %struct.fcgi*
%7 = alloca i8*
%8 = alloca i64
store %struct.frame* %0, %struct.frame** %5
store %struct.fcgi* %1, %struct.fcgi** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
ret i32 1
}

LLVM IR (-O2):
%struct.frame = type { i32 }
%struct.fcgi = type { i32 }
define i32 @process_unknown_type(%struct.frame* nocapture readnone %0, %struct.fcgi* nocapture readnone %1, i8* nocapture readnone %2, i64 %3) {
ret i32 1
}
/* Type definitions */
typedef char uint8_t;

/* Variables and functions */
int /*<<< orphan*/ size_buffer(char **, size_t *, size_t);
size_t uint8Pack(const uint8_t *data, char **buffer, size_t *size,
                 size_t *pos) {
  size_buffer(buffer, size, *pos + sizeof(uint8_t));
  (*buffer)[(*pos)++] = *data;
  return sizeof(uint8_t);
}


x86 assembly (clang, -O0):
<uint8Pack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
add    $0x1,%rdx
call   1030 <size_buffer@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%dl
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x20(%rbp),%rsi
mov    (%rsi),%rcx
mov    %rcx,%rdi
add    $0x1,%rdi
mov    %rdi,(%rsi)
mov    %dl,(%rax,%rcx,1)
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uint8Pack>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    (%rcx),%rax
add    $0x1,%rax
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rax,%rdx
call   1030 <size_buffer@plt>
mov    (%r15),%al
mov    (%r14),%rcx
mov    (%rbx),%rdx
lea    0x1(%rdx),%rsi
mov    %rsi,(%rbx)
mov    %al,(%rcx,%rdx,1)
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @uint8Pack(i8* %0, i8** %1, i64* %2, i64* %3) {
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i64*
%8 = alloca i64*
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i64* %2, i64** %7
store i64* %3, i64** %8
%9 = load i8**, i8*** %6
%10 = load i64*, i64** %7
%11 = load i64*, i64** %8
%12 = load i64, i64* %11
%13 = add i64 %12, 1
%14 = call i32 @size_buffer(i8** %9, i64* %10, i64 %13)
%15 = load i8*, i8** %5
%16 = load i8, i8* %15
%17 = load i8**, i8*** %6
%18 = load i8*, i8** %17
%19 = load i64*, i64** %8
%20 = load i64, i64* %19
%21 = add i64 %20, 1
store i64 %21, i64* %19
%22 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 %16, i8* %22
ret i64 1
}

LLVM IR (-O2):
define i64 @uint8Pack(i8* nocapture %0, i8** %1, i64* %2, i64* nocapture %3) {
%5 = load i64, i64* %3
%6 = add i64 %5, 1
%7 = tail call i32 @size_buffer(i8** %1, i64* %2, i64 %6)
%8 = load i8, i8* %0
%9 = load i8*, i8** %1
%10 = load i64, i64* %3
%11 = add i64 %10, 1
store i64 %11, i64* %3
%12 = getelementptr inbounds i8, i8* %9, i64 %10
store i8 %8, i8* %12
ret i64 1
}
unsigned long long saturatingSub(unsigned long long a, unsigned long long b) {
  return a > b ? a - b : 0;
}


x86 assembly (clang, -O0):
<saturatingSub>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    112b <saturatingSub+0x2b>
mov    -0x8(%rbp),%rax
sub    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1136 <saturatingSub+0x36>
xor    %eax,%eax
mov    %rax,-0x18(%rbp)
jmp    1136 <saturatingSub+0x36>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<saturatingSub>:
xor    %eax,%eax
sub    %rsi,%rdi
cmovae %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @saturatingSub(i64 %0, i64 %1) {
%3 = tail call i64 @llvm.usub.sat.i64(i64 %0, i64 %1)
ret i64 %3
}
/* Variables and functions */
int getc(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
getchar_unlocked() { return (getc(stdin)); }


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

x86 assembly (clang, -O2):
<getchar_unlocked>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <getc@plt>

LLVM IR (-O0):
@stdin = global i32 0
define i32 @getchar_unlocked() {
%1 = load i32, i32* @stdin
%2 = call i32 @getc(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @getchar_unlocked() {
%1 = load i32, i32* @stdin
%2 = tail call i32 @getc(i32 %1)
ret i32 %2
}
/* Variables and functions */
int errno;
int ioctl(int, unsigned int, unsigned long);
int os_ioctl_generic(int fd, unsigned int cmd, unsigned long arg) {
  int err;
  err = ioctl(fd, cmd, arg);
  if (err < 0)
    return -errno;
  return err;
}


x86 assembly (clang, -O0):
<os_ioctl_generic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <ioctl@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1151 <os_ioctl_generic+0x41>
xor    %eax,%eax
mov    0x2e99(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1157 <os_ioctl_generic+0x47>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_ioctl_generic>:
push   %rax
call   1030 <ioctl@plt>
mov    0x2ec3(%rip),%rcx
xor    %edx,%edx
sub    (%rcx),%edx
test   %eax,%eax
cmovs  %edx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@errno = global i32 0
define i32 @os_ioctl_generic(i32 %0, i32 %1, i64 %2) {
%4 = tail call i32 @ioctl(i32 %0, i32 %1, i64 %2)
%5 = icmp slt i32 %4, 0
%6 = load i32, i32* @errno
%7 = sub nsw i32 0, %6
%8 = select i1 %5, i32 %7, i32 %4
ret i32 %8
}
/* Type definitions */
struct msghdr {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ sendmsg(int, struct msghdr *, int);
ssize_t test(void) {
  int sockfd = 4;
  struct msghdr msg;
  int flags = 7;
  return sendmsg(sockfd, &msg, flags);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x4,-0x4(%rbp)
movl   $0x7,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%edx
lea    -0x8(%rbp),%rsi
call   1030 <sendmsg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
mov    %rsp,%rsi
mov    $0x4,%edi
mov    $0x7,%edx
call   1030 <sendmsg@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.msghdr = type { i32 }
define i32 @test() {
%1 = alloca i32
%2 = alloca %struct.msghdr
%3 = alloca i32
store i32 4, i32* %1
store i32 7, i32* %3
%4 = load i32, i32* %1
%5 = load i32, i32* %3
%6 = call i32 @sendmsg(i32 %4, %struct.msghdr* %2, i32 %5)
ret i32 %6
}

LLVM IR (-O2):
%struct.msghdr = type { i32 }
define i32 @test() {
%1 = alloca %struct.msghdr
%2 = bitcast %struct.msghdr* %1 to i8*
%3 = call i32 @sendmsg(i32 4, %struct.msghdr* %1, i32 7)
ret i32 %3
}
int sampleLdrState() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @sampleLdrState() {
ret i32 0
}
void do_readmsg(char *user) {}


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

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

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

LLVM IR (-O2):
define void @do_readmsg(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int read(int, char *, int);
int user_input(int fd, char *msg_buf) {
  int bytes = 0;
  memset(msg_buf, 0, 128);
  bytes = read(fd, msg_buf, 128);
  return bytes;
}


x86 assembly (clang, -O0):
<user_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1030 <memset@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x80,%edx
call   1040 <read@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<user_input>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1030 <memset@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x80,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <read@plt>

LLVM IR (-O0):
define i32 @user_input(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
%6 = load i8*, i8** %4
%7 = call i32 @memset(i8* %6, i32 0, i32 128)
%8 = load i32, i32* %3
%9 = load i8*, i8** %4
%10 = call i32 @read(i32 %8, i8* %9, i32 128)
store i32 %10, i32* %5
%11 = load i32, i32* %5
ret i32 %11
}

LLVM IR (-O2):
define i32 @user_input(i32 %0, i8* %1) {
%3 = tail call i32 @memset(i8* %1, i32 0, i32 128)
%4 = tail call i32 @read(i32 %0, i8* %1, i32 128)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i = 10;
  while (i < 10)
    i++;
  printf("i = %d\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    113e <main+0x2e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    -0x8(%rbp),%esi
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [8 x i8] c"i = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 10
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1
store i32 %8, i32* %2
br label %3
9: ; preds = %3
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"i = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ data_set(int, int);
void rcv_on() { data_set(2, 2); }


x86 assembly (clang, -O0):
<rcv_on>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%esi
mov    %esi,%edi
call   1030 <data_set@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rcv_on>:
mov    $0x2,%edi
mov    $0x2,%esi
jmp    1030 <data_set@plt>

LLVM IR (-O0):
define void @rcv_on() {
%1 = call i32 @data_set(i32 2, i32 2)
ret void
}

LLVM IR (-O2):
define void @rcv_on() {
%1 = tail call i32 @data_set(i32 2, i32 2)
ret void
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
void QEIConfigure(uint32_t ui32Base, uint32_t ui32Config,
                  uint32_t ui32MaxPosition) {
  ;
  (*((volatile unsigned long *)(ui32Base + 0x00000000))) =
      (((*((volatile unsigned long *)(ui32Base + 0x00000000))) &
        ~(0x00000008 | 0x00000010 | 0x00000004 | 0x00000002)) |
       ui32Config);
  (*((volatile unsigned long *)(ui32Base + 0x0000000C))) = ui32MaxPosition;
}


x86 assembly (clang, -O0):
<QEIConfigure>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
and    $0xffffffffffffffe1,%rcx
mov    -0x10(%rbp),%rax
or     %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<QEIConfigure>:
mov    %rdi,-0x18(%rsp)
mov    %rsi,-0x8(%rsp)
mov    %rdx,-0x10(%rsp)
mov    -0x18(%rsp),%rax
mov    (%rax),%rax
and    $0xffffffffffffffe1,%rax
or     -0x8(%rsp),%rax
mov    -0x18(%rsp),%rcx
mov    %rax,(%rcx)
mov    -0x10(%rsp),%rax
mov    -0x18(%rsp),%rcx
mov    %rax,0xc(%rcx)
ret

LLVM IR (-O0):
define void @QEIConfigure(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store volatile i64 %0, i64* %4
store volatile i64 %1, i64* %5
store volatile i64 %2, i64* %6
%7 = load volatile i64, i64* %4
%8 = add i64 %7, 0
%9 = inttoptr i64 %8 to i64*
%10 = load volatile i64, i64* %9
%11 = and i64 %10, -31
%12 = load volatile i64, i64* %5
%13 = or i64 %11, %12
%14 = load volatile i64, i64* %4
%15 = add i64 %14, 0
%16 = inttoptr i64 %15 to i64*
store volatile i64 %13, i64* %16
%17 = load volatile i64, i64* %6
%18 = load volatile i64, i64* %4
%19 = add i64 %18, 12
%20 = inttoptr i64 %19 to i64*
store volatile i64 %17, i64* %20
ret void
}

LLVM IR (-O2):
define void @QEIConfigure(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store volatile i64 %0, i64* %4
store volatile i64 %1, i64* %5
store volatile i64 %2, i64* %6
%7 = load volatile i64, i64* %4
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = and i64 %9, -31
%11 = load volatile i64, i64* %5
%12 = or i64 %10, %11
%13 = load volatile i64, i64* %4
%14 = inttoptr i64 %13 to i64*
store volatile i64 %12, i64* %14
%15 = load volatile i64, i64* %6
%16 = load volatile i64, i64* %4
%17 = add i64 %16, 12
%18 = inttoptr i64 %17 to i64*
store volatile i64 %15, i64* %18
ret void
}
/* Type definitions */
struct timespec {
  int tv_nsec;
  int /*<<< orphan*/ tv_sec;
};
struct timeb {
  int millitm;
  int /*<<< orphan*/ time;
};

/* Variables and functions */
int /*<<< orphan*/ ftime(struct timeb *);
struct timespec tpu_now_timespec() {
  struct timeb base;
  ftime(&base);
  struct timespec spec;
  spec.tv_sec = base.time;
  spec.tv_nsec = base.millitm * 1000000;
  return spec;
}


x86 assembly (clang, -O0):
<tpu_now_timespec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
call   1030 <ftime@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
imul   $0xf4240,-0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tpu_now_timespec>:
push   %rax
mov    %rsp,%rdi
call   1030 <ftime@plt>
imul   $0xf4240,(%rsp),%eax
mov    0x4(%rsp),%ecx
shl    $0x20,%rcx
or     %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
%struct.timeb = type { i32, i32 }
define i64 @tpu_now_timespec() {
%1 = alloca %struct.timespec
%2 = alloca %struct.timeb
%3 = call i32 @ftime(%struct.timeb* %2)
%4 = getelementptr inbounds %struct.timeb, %struct.timeb* %2, i32 0, i32 1
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
store i32 %5, i32* %6
%7 = getelementptr inbounds %struct.timeb, %struct.timeb* %2, i32 0, i32 0
%8 = load i32, i32* %7
%9 = mul nsw i32 %8, 1000000
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
store i32 %9, i32* %10
%11 = bitcast %struct.timespec* %1 to i64*
%12 = load i64, i64* %11
ret i64 %12
}

LLVM IR (-O2):
%struct.timeb = type { i32, i32 }
define i64 @tpu_now_timespec() {
%1 = alloca %struct.timeb
%2 = bitcast %struct.timeb* %1 to i8*
%3 = call i32 @ftime(%struct.timeb* %1)
%4 = getelementptr inbounds %struct.timeb, %struct.timeb* %1, i64 0, i32 1
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.timeb, %struct.timeb* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 1000000
%9 = zext i32 %5 to i64
%10 = shl nuw i64 %9, 32
%11 = zext i32 %8 to i64
%12 = or i64 %10, %11
ret i64 %12
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
int HAL_core_subsystem_version(char *patchstr, int bufLen) {
  strcpy(patchstr, "1.30");
  return 5;
}


x86 assembly (clang, -O0):
<HAL_core_subsystem_version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed6(%rip),%rsi
call   1030 <strcpy@plt>
mov    $0x5,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HAL_core_subsystem_version>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strcpy@plt>
mov    $0x5,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"1.30\00"
define i32 @HAL_core_subsystem_version(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 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 5
}

LLVM IR (-O2):
@.str = [5 x i8] c"1.30\00"
define i32 @HAL_core_subsystem_version(i8* %0, i32 %1) {
%3 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  char a[] = "hello";
  a[0] = 'x';
  char(*b)[6];
  b = &"hello";
  (*b)[0];
  char c[] = "hello\n";
  c[0] = 'x';
  printf("hello\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xed5(%rip),%ax
mov    %ax,-0x6(%rbp)
movb   $0x78,-0xa(%rbp)
lea    0xec2(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xebe(%rip),%eax
mov    %eax,-0x1f(%rbp)
mov    0xeb8(%rip),%ax
mov    %ax,-0x1b(%rbp)
mov    0xeb0(%rip),%al
mov    %al,-0x19(%rbp)
movb   $0x78,-0x1f(%rbp)
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%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):
@__const.main.a = [6 x i8] c"hello\00"
@.str = [6 x i8] c"hello\00"
@__const.main.c = [7 x i8] c"hello\0A\00"
@.str.1 = [7 x i8] c"hello\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8]
%3 = alloca [6 x i8]*
%4 = alloca [7 x i8]
store i32 0, i32* %1
%5 = bitcast [6 x i8]* %2 to i8*
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
store i8 120, i8* %6
store [6 x i8]* @.str, [6 x i8]** %3
%7 = load [6 x i8]*, [6 x i8]** %3
%8 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%9 = load i8, i8* %8
%10 = bitcast [7 x i8]* %4 to i8*
%11 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
store i8 120, i8* %11
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [6 x i8] c"hello\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i32 0
}
__attribute__((no, noclone)) long double ceill(long double x) { return x; }


x86 assembly (clang, -O0):
<ceill>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ceill>:
fldt   0x8(%rsp)
ret

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

LLVM IR (-O2):
define x86_fp80 @ceill(x86_fp80 returned %0) {
ret x86_fp80 %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ separator(int, char);
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main() {
  long int r;
  srand((unsigned)time(NULL));
  printf("Here are today's secret number values %c\n", 31);
  separator(10, '*');
  separator(15, '_');
  separator(20, '#');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xe9a(%rip),%rdi
mov    $0x1f,%esi
call   1030 <printf@plt>
mov    $0xa,%edi
mov    $0x2a,%esi
call   1060 <separator@plt>
mov    $0xf,%edi
mov    $0x5f,%esi
call   1060 <separator@plt>
mov    $0x14,%edi
mov    $0x23,%esi
call   1060 <separator@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xeaa(%rip),%rdi
mov    $0x1f,%esi
call   1030 <printf@plt>
mov    $0xa,%edi
mov    $0x2a,%esi
call   1060 <separator@plt>
mov    $0xf,%edi
mov    $0x5f,%esi
call   1060 <separator@plt>
mov    $0x14,%edi
mov    $0x23,%esi
call   1060 <separator@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Here are today's secret number values %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
%3 = call i64 @time(i32* null)
%4 = trunc i64 %3 to i32
%5 = call i32 @srand(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 31)
%7 = call i32 @separator(i32 10, i8 signext 42)
%8 = call i32 @separator(i32 15, i8 signext 95)
%9 = call i32 @separator(i32 20, i8 signext 35)
ret i32 0
}

LLVM IR (-O2):
@.str = [42 x i8] c"Here are today's secret number values %c\0A\00"
define i32 @main() {
%1 = tail call i64 @time(i32* null)
%2 = trunc i64 %1 to i32
%3 = tail call i32 @srand(i32 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 31)
%5 = tail call i32 @separator(i32 10, i8 signext 42)
%6 = tail call i32 @separator(i32 15, i8 signext 95)
%7 = tail call i32 @separator(i32 20, i8 signext 35)
ret i32 0
}
int cmodel_is_float(int colormodel) {
  switch (colormodel) {
  case 29:
  case 30:
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<cmodel_is_float>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffe3,%eax
sub    $0x1,%eax
ja     1127 <cmodel_is_float+0x27>
jmp    111b <cmodel_is_float+0x1b>
movl   $0x1,-0x4(%rbp)
jmp    112e <cmodel_is_float+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmodel_is_float>:
add    $0xffffffe3,%edi
xor    %eax,%eax
cmp    $0x2,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @cmodel_is_float(i32 %0) {
%2 = add i32 %0, -29
%3 = icmp ult i32 %2, 2
%4 = zext i1 %3 to i32
ret i32 %4
}
int main() {
  int arg1 = 0xAAAAAAAA;
  int arg2 = 0xDEADBEEF;
  int out1 = 0;
  int out2 = 0;
  int out3 = 0;
  __asm__("movl %3, %0; movl %3, %1; movl %4, %2;"
          : "=m"(out1), "=m"(out2), "=r"(out3)
          : "r"(arg1), "m"(arg2));
  return (arg1 == out1) && (arg1 == out2) && (arg2 == out3);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0xaaaaaaaa,-0x8(%rbp)
movl   $0xdeadbeef,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%ecx
xor    %eax,%eax
cmp    -0x10(%rbp),%ecx
mov    %al,-0x19(%rbp)
jne    116b <main+0x6b>
mov    -0x8(%rbp),%ecx
xor    %eax,%eax
cmp    -0x14(%rbp),%ecx
mov    %al,-0x19(%rbp)
jne    116b <main+0x6b>
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
movl   $0xdeadbeef,-0x4(%rsp)
de
movl   $0x0,-0x8(%rsp)
movl   $0x0,-0xc(%rsp)
mov    $0xaaaaaaaa,%ecx
mov    %ecx,-0x8(%rsp)
mov    %ecx,-0xc(%rsp)
mov    -0x4(%rsp),%edx
mov    -0x8(%rsp),%eax
xor    %ecx,%eax
xor    -0xc(%rsp),%ecx
xor    -0x4(%rsp),%edx
or     %eax,%ecx
xor    %eax,%eax
or     %ecx,%edx
sete   %al
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 -1431655766, i32* %2
store i32 -559038737, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%7 = load i32, i32* %2
%8 = call i32 asm "movl $3, $0; movl $3, $1; movl $4, $2;", "=*m,=*m,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %4, i32* elementtype(i32) %5, i32 %7, i32* elementtype(i32) %3)
store i32 %8, i32* %6
%9 = load i32, i32* %2
%10 = load i32, i32* %4
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %20
12: ; preds = %0
%13 = load i32, i32* %2
%14 = load i32, i32* %5
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i32, i32* %3
%18 = load i32, i32* %6
%19 = icmp eq i32 %17, %18
br label %20
20: ; preds = %16, %12, %0
%21 = phi i1 [ false, %12 ], [ false, %0 ], [ %19, %16 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
store i32 -559038737, i32* %1
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = call i32 asm "movl $3, $0; movl $3, $1; movl $4, $2;", "=*m,=*m,=r,r,*m,~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %2, i32* elementtype(i32) %3, i32 -1431655766, i32* elementtype(i32) %1)
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, -1431655766
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, -1431655766
%12 = select i1 %9, i1 %11, i1 false
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, %7
%15 = select i1 %12, i1 %14, i1 false
%16 = zext i1 %15 to i32
ret i32 %16
}
/* Variables and functions */
char *_getenv(char *);
int /*<<< orphan*/ monLock();
int /*<<< orphan*/ monUnlock();
char *mon_getenv(char *name) {
  char *ret;
  monLock();
  ret = _getenv(name);
  monUnlock();
  return (ret);
}


x86 assembly (clang, -O0):
<mon_getenv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <monLock@plt>
mov    -0x8(%rbp),%rdi
call   1050 <_getenv@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <monUnlock@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mon_getenv>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <monLock@plt>
mov    %rbx,%rdi
call   1050 <_getenv@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <monUnlock@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @mon_getenv(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = call i32 (...) @monLock()
%5 = load i8*, i8** %2
%6 = call i8* @_getenv(i8* %5)
store i8* %6, i8** %3
%7 = call i32 (...) @monUnlock()
%8 = load i8*, i8** %3
ret i8* %8
}

LLVM IR (-O2):
define i8* @mon_getenv(i8* %0) {
%2 = tail call i32 (...) @monLock()
%3 = tail call i8* @_getenv(i8* %0)
%4 = tail call i32 (...) @monUnlock()
ret i8* %3
}