xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void transmit(const char *response, void *state) { printf("%s\n", response); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @transmit(i8* %0, i8* nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ hashlittle2(char *, int /*<<< orphan*/, int *, int *);
int /*<<< orphan*/ strlen(char *);
uint32_t hasht_default_hash(char *key, int perm) {
  uint32_t h1 = 0;
  uint32_t h2 = 0;
  hashlittle2(key, strlen(key), &h1, &h2);
  if (h2 % 2 == 0)
    --h2;
  return (h1 + perm * h2);
}


x86 assembly (clang, -O0):
<hasht_default_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
call   1040 <hashlittle2@plt>
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    117e <hasht_default_hash+0x5e>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hasht_default_hash>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
call   1030 <strlen@plt>
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <hashlittle2@plt>
mov    (%rsp),%eax
mov    %eax,%ecx
and    $0x1,%ecx
add    %ecx,%eax
add    $0xffffffff,%eax
imul   %ebp,%eax
add    0x4(%rsp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @hasht_default_hash(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%7 = load i8*, i8** %3
%8 = load i8*, i8** %3
%9 = call i32 @strlen(i8* %8)
%10 = call i32 @hashlittle2(i8* %7, i32 %9, i32* %5, i32* %6)
%11 = load i32, i32* %6
%12 = srem i32 %11, 2
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i32, i32* %6
%16 = add nsw i32 %15, -1
store i32 %16, i32* %6
br label %17
17: ; preds = %14, %2
%18 = load i32, i32* %5
%19 = load i32, i32* %4
%20 = load i32, i32* %6
%21 = mul nsw i32 %19, %20
%22 = add nsw i32 %18, %21
ret i32 %22
}

LLVM IR (-O2):
define i32 @hasht_default_hash(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%7 = tail call i32 @strlen(i8* %0)
%8 = call i32 @hashlittle2(i8* %0, i32 %7, i32* %3, i32* %4)
%9 = load i32, i32* %4
%10 = and i32 %9, 1
%11 = add nsw i32 %10, -1
%12 = add nsw i32 %9, %11
%13 = load i32, i32* %3
%14 = mul nsw i32 %12, %1
%15 = add nsw i32 %14, %13
ret i32 %15
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ ta_debug_printf(char *);
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char const *,
                            int /*<<< orphan*/);
void defaultAssertionExit(const char *format, va_list arg_list) {
  vfprintf(stderr, format, arg_list);
  ta_debug_printf("\n");
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<defaultAssertionExit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <vfprintf@plt>
lea    0xea5(%rip),%rdi
call   1050 <ta_debug_printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <pthread_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<defaultAssertionExit>:
push   %rax
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
call   1040 <vfprintf@plt>
lea    0xeb5(%rip),%rdi
call   1050 <ta_debug_printf@plt>
xor    %edi,%edi
pop    %rax
jmp    1030 <pthread_exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
define void @defaultAssertionExit(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @vfprintf(i32 %5, i8* %6, i32 %7)
%9 = call i32 @ta_debug_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @pthread_exit(i32* null)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
define void @defaultAssertionExit(i8* %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @vfprintf(i32 %3, i8* %0, i32 %1)
%5 = tail call i32 @ta_debug_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @pthread_exit(i32* null)
ret void
}
void g_io_channel_read_line() {}


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

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

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

LLVM IR (-O2):
define void @g_io_channel_read_line() {
ret void
}
int _pow2(int N, int M) {
  int pw = 1, n = N;
  while (M > 0) {
    if (M & 1)
      pw *= n;
    n *= n;
    M >>= 1;
  }
  return pw;
}


x86 assembly (clang, -O0):
<_pow2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1152 <_pow2+0x52>
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     113a <_pow2+0x3a>
mov    -0x10(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1117 <_pow2+0x17>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_pow2>:
test   %esi,%esi
jle    113a <_pow2+0x3a>
mov    $0x1,%r8d
mov    $0x1,%eax
mov    %esi,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
test   $0x1,%sil
mov    %edi,%ecx
cmove  %r8d,%ecx
imul   %ecx,%eax
imul   %edi,%edi
shr    %edx
cmp    $0x1,%esi
mov    %edx,%esi
ja     1120 <_pow2+0x20>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @_pow2(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %15
4: ; preds = %2, %4
%5 = phi i32 [ %12, %4 ], [ %0, %2 ]
%6 = phi i32 [ %11, %4 ], [ 1, %2 ]
%7 = phi i32 [ %13, %4 ], [ %1, %2 ]
%8 = and i32 %7, 1
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 1, i32 %5
%11 = mul nsw i32 %10, %6
%12 = mul nsw i32 %5, %5
%13 = lshr i32 %7, 1
%14 = icmp ult i32 %7, 2
br i1 %14, label %15, label %4
15: ; preds = %4, %2
%16 = phi i32 [ 1, %2 ], [ %11, %4 ]
ret i32 %16
}
void g_clear_error() {}


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

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

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

LLVM IR (-O2):
define void @g_clear_error() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
scalar_t__ le();
int /*<<< orphan*/ swap64(int /*<<< orphan*/);
void write64le(uint64_t *p, uint64_t w) { *p = (le() ? w : swap64(w)); }


x86 assembly (clang, -O0):
<write64le>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <le@plt>
cmp    $0x0,%rax
je     114b <write64le+0x2b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1156 <write64le+0x36>
mov    -0xc(%rbp),%edi
call   1040 <swap64@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write64le>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <le@plt>
test   %rax,%rax
jne    113d <write64le+0x1d>
mov    %ebp,%edi
call   1040 <swap64@plt>
mov    %eax,%ebp
mov    %ebp,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @write64le(i32* nocapture writeonly %0, i32 %1) {
%3 = tail call i64 (...) @le()
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @swap64(i32 %1)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %6, %5 ], [ %1, %2 ]
store i32 %8, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ isspace(char const);
int line_is_blank(const char *line) {
  const char *s;
  for (s = line; *s; s++) {
    if (!isspace(*s))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<line_is_blank>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1168 <line_is_blank+0x58>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
jne    1152 <line_is_blank+0x42>
movl   $0x0,-0x4(%rbp)
jmp    116f <line_is_blank+0x5f>
jmp    1157 <line_is_blank+0x47>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1124 <line_is_blank+0x14>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<line_is_blank>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     114b <line_is_blank+0x3b>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%edi
call   1030 <isspace@plt>
test   %eax,%eax
je     1149 <line_is_blank+0x39>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <line_is_blank+0x20>
jmp    114b <line_is_blank+0x3b>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @line_is_blank(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %7
4: ; preds = %7
%5 = load i8, i8* %12
%6 = icmp eq i8 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %12, %4 ], [ %0, %1 ]
%10 = tail call i32 @isspace(i8 signext %8)
%11 = icmp eq i32 %10, 0
%12 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %11, label %13, label %4
13: ; preds = %7, %4, %1
%14 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ PrintVersion();
int /*<<< orphan*/ Usage();
void Help() {
  PrintVersion();
  Usage();
}


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

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

LLVM IR (-O0):
define void @Help() {
%1 = call i32 (...) @PrintVersion()
%2 = call i32 (...) @Usage()
ret void
}

LLVM IR (-O2):
define void @Help() {
%1 = tail call i32 (...) @PrintVersion()
%2 = tail call i32 (...) @Usage()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ calculation(int, int *, int *, int *, int *);
int /*<<< orphan*/ print(int, int, int, int, int);
int /*<<< orphan*/ prompt(int *);
int main(void) {
  int input, a_hundred, a_fifty, a_twenty, a_ten;
  prompt(&input);
  calculation(input, &a_hundred, &a_fifty, &a_twenty, &a_ten);
  print(input, a_hundred, a_fifty, a_twenty, a_ten);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x4(%rbp),%rdi
call   1040 <prompt@plt>
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1030 <calculation@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1050 <print@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0x4(%rsp),%rdi
call   1040 <prompt@plt>
mov    0x4(%rsp),%edi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1030 <calculation@plt>
mov    0x4(%rsp),%edi
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
call   1050 <print@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = call i32 @prompt(i32* %1)
%7 = load i32, i32* %1
%8 = call i32 @calculation(i32 %7, i32* %2, i32* %3, i32* %4, i32* %5)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = call i32 @print(i32 %9, i32 %10, i32 %11, i32 %12, i32 %13)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = call i32 @prompt(i32* %1)
%12 = load i32, i32* %1
%13 = call i32 @calculation(i32 %12, i32* %2, i32* %3, i32* %4, i32* %5)
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = call i32 @print(i32 %14, i32 %15, i32 %16, i32 %17, i32 %18)
ret i32 0
}
void *rbtree_strcpy(void *p) {
  char *original = (char *)p;
  int size = (strlen(original) + 1);
  char *copy = (char *)mm_malloc(sizeof(char) * size);
  strncpy(copy, original, size);
  return copy;
}


x86 assembly (clang, -O0):
<rbtree_strcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x1,%rax
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rdi
shl    $0x0,%rdi
mov    $0x0,%al
call   1040 <mm_malloc@plt>
cltq
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rbtree_strcpy>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <strlen@plt>
add    $0x1,%eax
movslq %eax,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <mm_malloc@plt>
movslq %eax,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <strncpy@plt>

LLVM IR (-O0):
define i8* @rbtree_strcpy(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call i64 @strlen(i8* %7)
%9 = add i64 %8, 1
%10 = trunc i64 %9 to i32
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = mul i64 1, %12
%14 = call i32 (i64, ...) bitcast (i32 (...)* @mm_malloc to i32 (i64, ...)*)(i64 %13)
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %5
%17 = load i8*, i8** %5
%18 = load i8*, i8** %3
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = call i8* @strncpy(i8* %17, i8* %18, i64 %20)
%22 = load i8*, i8** %5
ret i8* %22
}

LLVM IR (-O2):
define i8* @rbtree_strcpy(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = shl i64 %2, 32
%4 = add i64 %3, 4294967296
%5 = ashr exact i64 %4, 32
%6 = tail call i32 (i64, ...) bitcast (i32 (...)* @mm_malloc to i32 (i64, ...)*)(i64 %5)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
%9 = tail call i8* @strncpy(i8* dereferenceable(1) %8, i8* %0, i64 %5)
ret i8* %8
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t RES_b_r(uint8_t val, uint8_t bit) { return val & ~(0x1 << bit); }


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

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

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

LLVM IR (-O2):
define i32 @RES_b_r(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = xor i32 %3, -1
%5 = and i32 %4, %0
ret i32 %5
}
void test(int x) {
#pragma omp target data map(x)
  ;
}


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

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

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

LLVM IR (-O2):
define void @test(i32 %0) {
ret void
}
void init_add_pixel_color_pt_funcs_c(void) {}


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

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

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

LLVM IR (-O2):
define void @init_add_pixel_color_pt_funcs_c() {
ret void
}
const char *C_Str_Description(void) {
  return "The `C_Str` class should be overridden by types which are "
         "representable "
         "as a C style String.";
}


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

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

LLVM IR (-O0):
@.str = [93 x i8] c"The `C_Str` class should be overridden by types which are representable as a C style String.\00"
define i8* @C_Str_Description() {
ret i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [93 x i8] c"The `C_Str` class should be overridden by types which are representable as a C style String.\00"
define i8* @C_Str_Description() {
ret i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str, i64 0, i64 0)
}
char *x(char *a, char *b) { return __builtin_memcpy(a, b, 4); }


x86 assembly (clang, -O0):
<x>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i8* @x(i8* returned writeonly %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = bitcast i8* %0 to i32*
%5 = load i32, i32* %3
store i32 %5, i32* %4
ret i8* %0
}
/* Type definitions */
struct ptr_region {
  int dummy;
};

/* Variables and functions */
int PROT_EXEC;
int PROT_READ;
int /*<<< orphan*/ _exit(int);
int mprotect(struct ptr_region *, int /*<<< orphan*/, int);
int /*<<< orphan*/ region_size(struct ptr_region *);
void lock(struct ptr_region *region) {
  if (mprotect(region, region_size(region), PROT_READ | PROT_EXEC) == -1) {
    _exit(71);
  }
}


x86 assembly (clang, -O0):
<lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <region_size@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
mov    0x2e9e(%rip),%rax
mov    (%rax),%edx
mov    0x2e7d(%rip),%rax
or     (%rax),%edx
call   1050 <mprotect@plt>
cmp    $0xffffffff,%eax
jne    117d <lock+0x4d>
mov    $0x47,%edi
call   1030 <_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lock>:
push   %rbx
mov    %rdi,%rbx
call   1040 <region_size@plt>
mov    0x2eb8(%rip),%rcx
mov    0x2e99(%rip),%rdx
mov    (%rdx),%edx
or     (%rcx),%edx
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <mprotect@plt>
cmp    $0xffffffff,%eax
je     115c <lock+0x2c>
pop    %rbx
ret
mov    $0x47,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
%struct.ptr_region = type { i32 }
@PROT_READ = global i32 0
@PROT_EXEC = global i32 0
define void @lock(%struct.ptr_region* %0) {
%2 = alloca %struct.ptr_region*
store %struct.ptr_region* %0, %struct.ptr_region** %2
%3 = load %struct.ptr_region*, %struct.ptr_region** %2
%4 = load %struct.ptr_region*, %struct.ptr_region** %2
%5 = call i32 @region_size(%struct.ptr_region* %4)
%6 = load i32, i32* @PROT_READ
%7 = load i32, i32* @PROT_EXEC
%8 = or i32 %6, %7
%9 = call i32 @mprotect(%struct.ptr_region* %3, i32 %5, i32 %8)
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 @_exit(i32 71)
unreachable
13: ; preds = %1
ret void
}

LLVM IR (-O2):
%struct.ptr_region = type { i32 }
@PROT_READ = global i32 0
@PROT_EXEC = global i32 0
define void @lock(%struct.ptr_region* %0) {
%2 = tail call i32 @region_size(%struct.ptr_region* %0)
%3 = load i32, i32* @PROT_READ
%4 = load i32, i32* @PROT_EXEC
%5 = or i32 %4, %3
%6 = tail call i32 @mprotect(%struct.ptr_region* %0, i32 %2, i32 %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = tail call i32 @_exit(i32 71)
unreachable
10: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ctoec(int);
int nextarg(char *, char *, int, int /*<<< orphan*/);
mlreply(char *prompt, char *buf, int nbuf) {
  return (nextarg(prompt, buf, nbuf, ctoec((int)'\r')));
}


x86 assembly (clang, -O0):
<mlreply>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0xd,%edi
call   1030 <ctoec@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    %eax,%ecx
call   1040 <nextarg@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mlreply>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    $0xd,%edi
call   1030 <ctoec@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
mov    %eax,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <nextarg@plt>

LLVM IR (-O0):
define i32 @mlreply(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @ctoec(i32 13)
%11 = call i32 @nextarg(i8* %7, i8* %8, i32 %9, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @mlreply(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @ctoec(i32 13)
%5 = tail call i32 @nextarg(i8* %0, i8* %1, i32 %2, i32 %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main() {
  puts("fork exec to login!");
  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 <puts@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 = [20 x i8] c"fork exec to login!\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"fork exec to login!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ width;
};
typedef TYPE_1__ XRectangle;

/* Variables and functions */
unsigned short get_XRectangle_width(void *_p) {
  return (unsigned short)((XRectangle *)_p)->width;
}


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

x86 assembly (clang, -O2):
<get_XRectangle_width>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define zeroext i16 @get_XRectangle_width(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i16
ret i16 %7
}

LLVM IR (-O2):
define zeroext i16 @get_XRectangle_width(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i16
ret i16 %4
}
/* Variables and functions */
int /*<<< orphan*/ take_f(double);
take_d(double d) { take_f(d); }


x86 assembly (clang, -O0):
<take_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <take_f@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<take_d>:
jmp    1030 <take_f@plt>

LLVM IR (-O0):
define i32 @take_d(double %0) {
%2 = alloca i32
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = call i32 @take_f(double %4)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
define i32 @take_d(double %0) {
%2 = tail call i32 @take_f(double %0)
ret i32 undef
}
void tegra124_init_speedo_data(struct tegra_sku_info *sku_info) {}


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

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

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

LLVM IR (-O2):
%struct.tegra_sku_info = type opaque
define void @tegra124_init_speedo_data(%struct.tegra_sku_info* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *, char *, char *, char *);
void print_columns(void) {
  printf("%s%-5s %-18s    %-18s %-9s SYMBOLNAME\n", "  ", "REG", "BEFORE",
         "AFTER", "CHANGED");
}


x86 assembly (clang, -O0):
<print_columns>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xf05(%rip),%rsi
lea    0xf01(%rip),%rdx
lea    0xefe(%rip),%rcx
lea    0xefe(%rip),%r8
lea    0xefd(%rip),%r9
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_columns>:
lea    0xee9(%rip),%rdi
lea    0xf09(%rip),%rsi
lea    0xf05(%rip),%rdx
lea    0xf02(%rip),%rcx
lea    0xf02(%rip),%r8
lea    0xf01(%rip),%r9
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"%s%-5s %-18s %-18s %-9s SYMBOLNAME\0A\00"
@.str.1 = [3 x i8] c" \00"
@.str.2 = [4 x i8] c"REG\00"
@.str.3 = [7 x i8] c"BEFORE\00"
@.str.4 = [6 x i8] c"AFTER\00"
@.str.5 = [8 x i8] c"CHANGED\00"
define void @print_columns() {
%1 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [39 x i8] c"%s%-5s %-18s %-18s %-9s SYMBOLNAME\0A\00"
@.str.1 = [3 x i8] c" \00"
@.str.2 = [4 x i8] c"REG\00"
@.str.3 = [7 x i8] c"BEFORE\00"
@.str.4 = [6 x i8] c"AFTER\00"
@.str.5 = [8 x i8] c"CHANGED\00"
define void @print_columns() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
void CompactAddress_init(char *compact) { memset(compact, 0, 25); }


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

x86 assembly (clang, -O2):
<CompactAddress_init>:
xor    %esi,%esi
mov    $0x19,%edx
jmp    1030 <memset@plt>

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

LLVM IR (-O2):
define void @CompactAddress_init(i8* %0) {
%2 = tail call i32 @memset(i8* %0, i32 0, i32 25)
ret void
}
XAutoRepeatOff() {}


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

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

LLVM IR (-O0):
define i32 @XAutoRepeatOff() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @XAutoRepeatOff() {
ret i32 undef
}
/* Variables and functions */
long random();
long int RandomVal(long int range) { return range ? random() % range : 0; }


x86 assembly (clang, -O0):
<RandomVal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     113d <RandomVal+0x2d>
mov    $0x0,%al
call   1030 <random@plt>
cqto
idivq  -0x8(%rbp)
mov    %rdx,-0x10(%rbp)
jmp    1148 <RandomVal+0x38>
xor    %eax,%eax
mov    %rax,-0x10(%rbp)
jmp    1148 <RandomVal+0x38>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomVal>:
push   %rbx
test   %rdi,%rdi
je     1136 <RandomVal+0x26>
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <random@plt>
mov    %rax,%rcx
or     %rbx,%rcx
shr    $0x20,%rcx
je     113a <RandomVal+0x2a>
cqto
idiv   %rbx
mov    %rdx,%rax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret
xor    %edx,%edx
div    %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @RandomVal(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = call i64 (...) @random()
%7 = load i64, i64* %2
%8 = srem i64 %6, %7
br label %10
9: ; preds = %1
br label %10
10: ; preds = %9, %5
%11 = phi i64 [ %8, %5 ], [ 0, %9 ]
ret i64 %11
}

LLVM IR (-O2):
define i64 @RandomVal(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i64 (...) @random()
%5 = srem i64 %4, %0
br label %6
6: ; preds = %1, %3
%7 = phi i64 [ %5, %3 ], [ 0, %1 ]
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ alias2_OK();
int loop0_bad() {
  for (int i = 0; i < 100; i++) {
    alias2_OK();
  }
  return 0;
}


x86 assembly (clang, -O0):
<loop0_bad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jge    113e <loop0_bad+0x2e>
mov    $0x0,%al
call   1030 <alias2_OK@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <loop0_bad+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loop0_bad>:
push   %rbx
mov    $0x64,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <alias2_OK@plt>
add    $0xffffffff,%ebx
jne    1120 <loop0_bad+0x10>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @loop0_bad() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %7, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 100
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = call i32 (...) @alias2_OK()
br label %7
7: ; preds = %5
%8 = load i32, i32* %1
%9 = add nsw i32 %8, 1
store i32 %9, i32* %1
br label %2
10: ; preds = %2
ret i32 0
}

LLVM IR (-O2):
define i32 @loop0_bad() {
br label %2
1: ; preds = %2
ret i32 0
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %5, %2 ]
%4 = tail call i32 (...) @alias2_OK()
%5 = add nuw nsw i32 %3, 1
%6 = icmp eq i32 %5, 100
br i1 %6, label %1, label %2
}
/* Type definitions */
typedef int /*<<< orphan*/ u_int8_t;
typedef int /*<<< orphan*/ u_int32_t;
struct kore_buf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ kore_buf_append(struct kore_buf *, int /*<<< orphan*/ *,
                                   int /*<<< orphan*/);
int /*<<< orphan*/ *kore_buf_release(struct kore_buf *, int /*<<< orphan*/ *);
int /*<<< orphan*/ kore_mem_free(int /*<<< orphan*/ *);
void kore_buf_appendb(struct kore_buf *buf, struct kore_buf *src) {
  u_int8_t *d;
  u_int32_t len;
  d = kore_buf_release(src, &len);
  kore_buf_append(buf, d, len);
  kore_mem_free(d);
}


x86 assembly (clang, -O0):
<kore_buf_appendb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1030 <kore_buf_release@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <kore_buf_append@plt>
mov    -0x18(%rbp),%rdi
call   1050 <kore_mem_free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kore_buf_appendb>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rax
mov    %rdi,%r14
lea    0x4(%rsp),%rsi
mov    %rax,%rdi
call   1030 <kore_buf_release@plt>
mov    %rax,%rbx
mov    0x4(%rsp),%edx
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <kore_buf_append@plt>
mov    %rbx,%rdi
call   1050 <kore_mem_free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.kore_buf = type { i32 }
define void @kore_buf_appendb(%struct.kore_buf* %0, %struct.kore_buf* %1) {
%3 = alloca %struct.kore_buf*
%4 = alloca %struct.kore_buf*
%5 = alloca i32*
%6 = alloca i32
store %struct.kore_buf* %0, %struct.kore_buf** %3
store %struct.kore_buf* %1, %struct.kore_buf** %4
%7 = load %struct.kore_buf*, %struct.kore_buf** %4
%8 = call i32* @kore_buf_release(%struct.kore_buf* %7, i32* %6)
store i32* %8, i32** %5
%9 = load %struct.kore_buf*, %struct.kore_buf** %3
%10 = load i32*, i32** %5
%11 = load i32, i32* %6
%12 = call i32 @kore_buf_append(%struct.kore_buf* %9, i32* %10, i32 %11)
%13 = load i32*, i32** %5
%14 = call i32 @kore_mem_free(i32* %13)
ret void
}

LLVM IR (-O2):
%struct.kore_buf = type { i32 }
define void @kore_buf_appendb(%struct.kore_buf* %0, %struct.kore_buf* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32* @kore_buf_release(%struct.kore_buf* %1, i32* %3)
%6 = load i32, i32* %3
%7 = call i32 @kore_buf_append(%struct.kore_buf* %0, i32* %5, i32 %6)
%8 = call i32 @kore_mem_free(i32* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void handler(int signum) { printf("b can not be zero\n"); }


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

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

LLVM IR (-O0):
@.str = [19 x i8] c"b can not be zero\0A\00"
define void @handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [18 x i8] c"b can not be zero\00"
define void @handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free_pages_fini();
int /*<<< orphan*/ mm_queues_fini();
void mm_fini() {
  mm_queues_fini();
  free_pages_fini();
}


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

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

LLVM IR (-O0):
define void @mm_fini() {
%1 = call i32 (...) @mm_queues_fini()
%2 = call i32 (...) @free_pages_fini()
ret void
}

LLVM IR (-O2):
define void @mm_fini() {
%1 = tail call i32 (...) @mm_queues_fini()
%2 = tail call i32 (...) @free_pages_fini()
ret void
}
/* Variables and functions */
int setcns(int, int, char *);
int cmd_gps_on(int argc, char **argv) {
  char data[] = {0x00, 0x01, 0x00, 0x00};
  return setcns(0x0F14, 4, data);
}


x86 assembly (clang, -O0):
<cmd_gps_on>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdx
mov    $0xf14,%edi
mov    $0x4,%esi
call   1030 <setcns@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_gps_on>:
push   %rax
movl   $0x100,0x4(%rsp)
lea    0x4(%rsp),%rdx
mov    $0xf14,%edi
mov    $0x4,%esi
call   1030 <setcns@plt>
pop    %rcx
ret

LLVM IR (-O0):
@__const.cmd_gps_on.data = [4 x i8] c"\00\01\00\00"
define i32 @cmd_gps_on(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [4 x i8]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = bitcast [4 x i8]* %5 to i8*
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%8 = call i32 @setcns(i32 3860, i32 4, i8* %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @cmd_gps_on(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 256, i32* %3
%5 = call i32 @setcns(i32 3860, i32 4, i8* %4)
ret i32 %5
}
int jsk_socket(int domain, int protocol) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @jsk_socket(i32 %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int _my_strcmp(char *, char *, int /*<<< orphan*/);
int my_strcmp(char *s1, char *s2) { return _my_strcmp(s1, s2, 0); }


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

x86 assembly (clang, -O2):
<my_strcmp>:
xor    %edx,%edx
jmp    1030 <_my_strcmp@plt>

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

LLVM IR (-O2):
define i32 @my_strcmp(i8* %0, i8* %1) {
%3 = tail call i32 @_my_strcmp(i8* %0, i8* %1, i32 0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ clear_io_bit(int, int);
void TOSH_MAKE_INT1_INPUT() { clear_io_bit(0x45, 1); }


x86 assembly (clang, -O0):
<TOSH_MAKE_INT1_INPUT>:
push   %rbp
mov    %rsp,%rbp
mov    $0x45,%edi
mov    $0x1,%esi
call   1030 <clear_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_MAKE_INT1_INPUT>:
mov    $0x45,%edi
mov    $0x1,%esi
jmp    1030 <clear_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_MAKE_INT1_INPUT() {
%1 = call i32 @clear_io_bit(i32 69, i32 1)
ret void
}

LLVM IR (-O2):
define void @TOSH_MAKE_INT1_INPUT() {
%1 = tail call i32 @clear_io_bit(i32 69, i32 1)
ret void
}
unsigned char ScaleColor6to8(const unsigned long color) {
  return ((unsigned char)(((color) << 2) | ((color) >> 4)));
}


x86 assembly (clang, -O0):
<ScaleColor6to8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x2,%rax
mov    -0x8(%rbp),%rcx
shr    $0x4,%rcx
or     %rcx,%rax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ScaleColor6to8>:
lea    0x0(,%rdi,4),%eax
shr    $0x4,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define zeroext i8 @ScaleColor6to8(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = shl i64 %3, 2
%5 = load i64, i64* %2
%6 = lshr i64 %5, 4
%7 = or i64 %4, %6
%8 = trunc i64 %7 to i8
ret i8 %8
}

LLVM IR (-O2):
define zeroext i8 @ScaleColor6to8(i64 %0) {
%2 = shl i64 %0, 2
%3 = lshr i64 %0, 4
%4 = or i64 %2, %3
%5 = trunc i64 %4 to i8
ret i8 %5
}
int getNumberLenght(int n) {
  int digits = 1;
  while (n >= 10) {
    n /= 10;
    digits++;
  }
  return digits;
}


x86 assembly (clang, -O0):
<getNumberLenght>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0xa,-0x4(%rbp)
jl     1134 <getNumberLenght+0x34>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <getNumberLenght+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNumberLenght>:
mov    $0x1,%eax
cmp    $0xa,%edi
jl     1134 <getNumberLenght+0x34>
mov    $0x1,%eax
mov    $0xcccccccd,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %edi,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
add    $0x1,%eax
cmp    $0x63,%edi
mov    %edx,%edi
ja     1120 <getNumberLenght+0x20>
ret

LLVM IR (-O0):
define i32 @getNumberLenght(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %2
%6 = icmp sge i32 %5, 10
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* %2
%9 = sdiv i32 %8, 10
store i32 %9, i32* %2
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
br label %4
12: ; preds = %4
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @getNumberLenght(i32 %0) {
%2 = icmp sgt i32 %0, 9
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 1, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = udiv i32 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = icmp ugt i32 %5, 99
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 1, %1 ], [ %7, %3 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char const *argv[]) {
  int f1, f2, f3;
  f1 = 1;
  f2 = 2;
  f3 = 4;
  int ret;
  for (int i = 4; i <= 15; ++i) {
    ret = f1 + f2 + f3;
    f1 = f2;
    f2 = f3;
    f3 = ret;
  }
  printf("%d\n", ret);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
movl   $0x4,-0x1c(%rbp)
movl   $0x4,-0x24(%rbp)
cmpl   $0xf,-0x24(%rbp)
jg     1178 <main+0x68>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1142 <main+0x32>
mov    -0x20(%rbp),%esi
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store i32 2, i32* %7
store i32 4, i32* %8
store i32 4, i32* %10
br label %11
11: ; preds = %23, %2
%12 = load i32, i32* %10
%13 = icmp sle i32 %12, 15
br i1 %13, label %14, label %26
14: ; preds = %11
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = add nsw i32 %15, %16
%18 = load i32, i32* %8
%19 = add nsw i32 %17, %18
store i32 %19, i32* %9
%20 = load i32, i32* %7
store i32 %20, i32* %6
%21 = load i32, i32* %8
store i32 %21, i32* %7
%22 = load i32, i32* %9
store i32 %22, i32* %8
br label %23
23: ; preds = %14
%24 = load i32, i32* %10
%25 = add nsw i32 %24, 1
store i32 %25, i32* %10
br label %11
26: ; preds = %11
%27 = load i32, i32* %9
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 5768)
ret i32 0
}