xunge/DecIR huggingface dataset:
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ event;
};
typedef TYPE_1__ XDestroyWindowEvent;

/* Variables and functions */
unsigned long get_XDestroyWindowEvent_event(void *_p) {
  return (unsigned long)((XDestroyWindowEvent *)_p)->event;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i64 @get_XDestroyWindowEvent_event(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
ret i64 %6
}

LLVM IR (-O2):
define i64 @get_XDestroyWindowEvent_event(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint16_t;

/* Variables and functions */
uint16_t sg_get_unaligned_le16(const void *p) {
  return ((const uint8_t *)p)[1] << 8 | ((const uint8_t *)p)[0];
}


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

x86 assembly (clang, -O2):
<sg_get_unaligned_le16>:
mov    0x4(%rdi),%eax
shl    $0x8,%eax
or     (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @sg_get_unaligned_le16(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = getelementptr inbounds i32, i32* %4, i64 1
%6 = load i32, i32* %5
%7 = shl i32 %6, 8
%8 = load i8*, i8** %2
%9 = bitcast i8* %8 to i32*
%10 = getelementptr inbounds i32, i32* %9, i64 0
%11 = load i32, i32* %10
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @sg_get_unaligned_le16(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = getelementptr inbounds i8, i8* %0, i64 4
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = shl i32 %5, 8
%7 = load i32, i32* %2
%8 = or i32 %6, %7
ret i32 %8
}
/* Variables and functions */
size_t INT_MAX;
size_t LONG_MAX;
size_t SHRT_MAX;
size_t check_size_t_max(void) {
  size_t size_t_max;
  if (sizeof(size_t) == sizeof(int)) {
    size_t_max = INT_MAX;
  } else if (sizeof(size_t) == sizeof(short)) {
    size_t_max = SHRT_MAX;
  } else if (sizeof(size_t) == sizeof(long)) {
    size_t_max = LONG_MAX;
  }
  return size_t_max;
}


x86 assembly (clang, -O0):
<check_size_t_max>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_size_t_max>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%rax
ret

LLVM IR (-O0):
@LONG_MAX = global i64 0
@INT_MAX = global i64 0
@SHRT_MAX = global i64 0
define i64 @check_size_t_max() {
%1 = alloca i64
%2 = load i64, i64* @LONG_MAX
store i64 %2, i64* %1
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
@LONG_MAX = global i64 0
@INT_MAX = global i64 0
@SHRT_MAX = global i64 0
define i64 @check_size_t_max() {
%1 = load i64, i64* @LONG_MAX
ret i64 %1
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void b(char *foo, char *bar) { abort(); }


x86 assembly (clang, -O0):
<b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<b>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @b(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @b(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = tail call i32 (...) @abort()
unreachable
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void bit_set32(volatile uint32_t *ptr, uint8_t bit) { *ptr |= (1 << (bit)); }


x86 assembly (clang, -O0):
<bit_set32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_set32>:
mov    %esi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
or     %eax,(%rdi)
ret

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

LLVM IR (-O2):
define void @bit_set32(i32* %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = load volatile i32, i32* %0
%5 = or i32 %4, %3
store volatile i32 %5, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lib_a_init();
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello world from app1\n");
  lib_a_init();
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [23 x i8] c"Hello world from app1\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @lib_a_init()
ret i32 0
}

LLVM IR (-O2):
@str = [22 x i8] c"Hello world from app1\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @lib_a_init()
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t U8TO32_LE(const unsigned char *m) {
  return (uint32_t)m[0] | (uint32_t)m[1] << 8 | (uint32_t)m[2] << 16 |
         (uint32_t)m[3] << 24;
}


x86 assembly (clang, -O0):
<U8TO32_LE>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<U8TO32_LE>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @U8TO32_LE(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = shl i32 %10, 8
%12 = or i32 %6, %11
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 2
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = shl i32 %16, 16
%18 = or i32 %12, %17
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i64 3
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = shl i32 %22, 24
%24 = or i32 %18, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @U8TO32_LE(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl nuw nsw i32 %6, 8
%8 = or i32 %7, %3
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl nuw nsw i32 %11, 16
%13 = or i32 %8, %12
%14 = getelementptr inbounds i8, i8* %0, i64 3
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = shl nuw i32 %16, 24
%18 = or i32 %13, %17
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *random_bytes(int);
char random_long() {
  void *ptr = random_bytes(sizeof(long));
  long out = *(long *)ptr;
  free(ptr);
  return out;
}


x86 assembly (clang, -O0):
<random_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x8,%edi
call   1040 <random_bytes@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_long>:
push   %rbx
mov    $0x8,%edi
call   1040 <random_bytes@plt>
mov    (%rax),%bl
mov    %rax,%rdi
call   1030 <free@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @random_long() {
%1 = alloca i8*
%2 = alloca i64
%3 = call i8* @random_bytes(i32 8)
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = bitcast i8* %4 to i64*
%6 = load i64, i64* %5
store i64 %6, i64* %2
%7 = load i8*, i8** %1
%8 = call i32 @free(i8* %7)
%9 = load i64, i64* %2
%10 = trunc i64 %9 to i8
ret i8 %10
}

LLVM IR (-O2):
define signext i8 @random_long() {
%1 = tail call i8* @random_bytes(i32 8)
%2 = bitcast i8* %1 to i64*
%3 = load i64, i64* %2
%4 = tail call i32 @free(i8* %1)
%5 = trunc i64 %3 to i8
ret i8 %5
}
long unused(const void *p) { return ((long)p); }


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

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

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

LLVM IR (-O2):
define i64 @unused(i8* %0) {
%2 = ptrtoint i8* %0 to i64
ret i64 %2
}
/* Variables and functions */
int create_symlink_for_jdks();
int init_jdks() { return create_symlink_for_jdks(); }


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

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

LLVM IR (-O0):
define i32 @init_jdks() {
%1 = call i32 (...) @create_symlink_for_jdks()
ret i32 %1
}

LLVM IR (-O2):
define i32 @init_jdks() {
%1 = tail call i32 (...) @create_symlink_for_jdks()
ret i32 %1
}
/* Variables and functions */
int subtract_func(int, int, int, int, int /*<<< orphan*/);
int sub_func(int src, int dest, int is_word) {
  return subtract_func(src, dest, is_word, 1, 0);
}


x86 assembly (clang, -O0):
<sub_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
call   1030 <subtract_func@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub_func>:
mov    $0x1,%ecx
xor    %r8d,%r8d
jmp    1030 <subtract_func@plt>

LLVM IR (-O0):
define i32 @sub_func(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @subtract_func(i32 %7, i32 %8, i32 %9, i32 1, i32 0)
ret i32 %10
}

LLVM IR (-O2):
define i32 @sub_func(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @subtract_func(i32 %0, i32 %1, i32 %2, i32 1, i32 0)
ret i32 %4
}
void foo_2_1_1_1_2_1_1_2_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_1_1_1_2_1_1_2_1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ *strchr(char *, char);
char *skip_while(char *s, char *chars) {
  while ((*s != 0) && (strchr(chars, *s) != NULL))
    s++;
  return s;
}


x86 assembly (clang, -O0):
<skip_while>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     114f <skip_while+0x3f>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
movsbl (%rax),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115f <skip_while+0x4f>
jmp    1170 <skip_while+0x60>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1120 <skip_while+0x10>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_while>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     113c <skip_while+0x2c>
mov    %rsi,%r14
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
je     113c <skip_while+0x2c>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <skip_while+0x10>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @skip_while(i8* %0, i8* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2, %10
%6 = phi i8 [ %12, %10 ], [ %3, %2 ]
%7 = phi i8* [ %11, %10 ], [ %0, %2 ]
%8 = tail call i32* @strchr(i8* %1, i8 signext %6)
%9 = icmp eq i32* %8, null
br i1 %9, label %14, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %10, %2
%15 = phi i8* [ %0, %2 ], [ %11, %10 ], [ %7, %5 ]
ret i8* %15
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint64_t;

/* Variables and functions */
int /*<<< orphan*/ bb_lsb(int);
uint8_t bb_poplsb(uint64_t *bb) {
  uint8_t sq = bb_lsb(*bb);
  *bb &= *bb - 1;
  return sq;
}


x86 assembly (clang, -O0):
<bb_poplsb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <bb_lsb@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%rax
and    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bb_poplsb>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1030 <bb_lsb@plt>
mov    (%rbx),%ecx
lea    -0x1(%rcx),%edx
and    %ecx,%edx
mov    %edx,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define i32 @bb_poplsb(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = load i32, i32* %4
%6 = call i32 @bb_lsb(i32 %5)
store i32 %6, i32* %3
%7 = load i32*, i32** %2
%8 = load i32, i32* %7
%9 = sub nsw i32 %8, 1
%10 = load i32*, i32** %2
%11 = load i32, i32* %10
%12 = and i32 %11, %9
store i32 %12, i32* %10
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @bb_poplsb(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @bb_lsb(i32 %2)
%4 = load i32, i32* %0
%5 = add nsw i32 %4, -1
%6 = and i32 %5, %4
store i32 %6, i32* %0
ret i32 %3
}
/* Variables and functions */
int s_ntab(char *, int /*<<< orphan*/, char **, int);
int /*<<< orphan*/ strlen(char *);
int s_tab(char *s, char *tab[], int size) {
  return s_ntab(s, strlen(s), tab, size);
}


x86 assembly (clang, -O0):
<s_tab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-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
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1040 <s_ntab@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_tab>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1030 <strlen@plt>
mov    %rbp,%rdi
mov    %eax,%esi
mov    %rbx,%rdx
mov    %r14d,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <s_ntab@plt>

LLVM IR (-O0):
define i32 @s_tab(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** %4
%9 = call i32 @strlen(i8* %8)
%10 = load i8**, i8*** %5
%11 = load i32, i32* %6
%12 = call i32 @s_ntab(i8* %7, i32 %9, i8** %10, i32 %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @s_tab(i8* %0, i8** %1, i32 %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i32 @s_ntab(i8* %0, i32 %4, i8** %1, i32 %2)
ret i32 %5
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int, int);
void tostr(int64_t *m, char *outstr) {
  sprintf(outstr, "0x%08X%08X", (int)(*m >> 32), (int)*m);
}


x86 assembly (clang, -O0):
<tostr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
lea    0xec2(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tostr>:
mov    %rsi,%rax
mov    (%rdi),%ecx
lea    0xee4(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <sprintf@plt>

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

LLVM IR (-O2):
@.str = [11 x i8] c"0x%08X%08X\00"
define void @tostr(i32* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i32, i32* %0
%4 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 poison, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void sa_free(void *ptr) {
  void **tmp = ptr;
  free(*(tmp - 1));
}


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

x86 assembly (clang, -O2):
<sa_free>:
mov    -0x8(%rdi),%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @sa_free(i8* %0) {
%2 = alloca i8*
%3 = alloca i8**
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i8**
store i8** %5, i8*** %3
%6 = load i8**, i8*** %3
%7 = getelementptr inbounds i8*, i8** %6, i64 -1
%8 = load i8*, i8** %7
%9 = call i32 @free(i8* %8)
ret void
}

LLVM IR (-O2):
define void @sa_free(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 -8
%3 = bitcast i8* %2 to i8**
%4 = load i8*, i8** %3
%5 = tail call i32 @free(i8* %4)
ret void
}
/* Variables and functions */
float min(float, float);
float blendAdd(float base, float blend) { return min(base + blend, 1.0f); }


x86 assembly (clang, -O0):
<blendAdd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
movss  0xecc(%rip),%xmm1
call   1030 <min@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blendAdd>:
addss  %xmm1,%xmm0
movss  0xee4(%rip),%xmm1
jmp    1030 <min@plt>

LLVM IR (-O0):
define float @blendAdd(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fadd float %5, %6
%8 = call float @min(float %7, float 1.000000e+00)
ret float %8
}

LLVM IR (-O2):
define float @blendAdd(float %0, float %1) {
%3 = fadd float %0, %1
%4 = tail call float @min(float %3, float 1.000000e+00)
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ write_kernel_null_byte(int, int, unsigned long);
void escalate_creds(int fd, int id, unsigned long cred_kaddr) {
  unsigned int i;
  unsigned long tmp_kaddr;
  tmp_kaddr = cred_kaddr + sizeof(int);
  for (i = 0; i < (sizeof(int) * 8); i++)
    write_kernel_null_byte(fd, id, tmp_kaddr + i);
}


x86 assembly (clang, -O0):
<escalate_creds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    $0x20,%rax
jae    1165 <escalate_creds+0x55>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x14(%rbp),%eax
add    %rax,%rdx
call   1030 <write_kernel_null_byte@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1135 <escalate_creds+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<escalate_creds>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %edi,%r15d
add    $0x4,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
lea    (%rbx,%rbp,1),%rdx
mov    %r15d,%edi
mov    %r14d,%esi
call   1030 <write_kernel_null_byte@plt>
add    $0x1,%rbp
cmp    $0x20,%rbp
jne    1130 <escalate_creds+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @escalate_creds(i32 %0, i32 %1, i64 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
%7 = alloca i32
%8 = alloca i64
store i32 %0, i32* %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%9 = load i64, i64* %6
%10 = add i64 %9, 4
store i64 %10, i64* %8
store i32 0, i32* %7
br label %11
11: ; preds = %23, %3
%12 = load i32, i32* %7
%13 = zext i32 %12 to i64
%14 = icmp ult i64 %13, 32
br i1 %14, label %15, label %26
15: ; preds = %11
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = load i64, i64* %8
%19 = load i32, i32* %7
%20 = zext i32 %19 to i64
%21 = add i64 %18, %20
%22 = call i32 @write_kernel_null_byte(i32 %16, i32 %17, i64 %21)
br label %23
23: ; preds = %15
%24 = load i32, i32* %7
%25 = add i32 %24, 1
store i32 %25, i32* %7
br label %11
26: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @escalate_creds(i32 %0, i32 %1, i64 %2) {
%4 = add i64 %2, 4
br label %5
5: ; preds = %3, %5
%6 = phi i64 [ 0, %3 ], [ %9, %5 ]
%7 = add i64 %4, %6
%8 = tail call i32 @write_kernel_null_byte(i32 %0, i32 %1, i64 %7)
%9 = add nuw nsw i64 %6, 1
%10 = icmp eq i64 %9, 32
br i1 %10, label %11, label %5
11: ; preds = %5
ret void
}
void g_param_spec_uint() {}


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

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

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

LLVM IR (-O2):
define void @g_param_spec_uint() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ triptych(int);
int main(void) {
  printf("Largest prime of %ld is: %ld\n", 600851475143,
         triptych(600851475143));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xe589eac7,%edi
call   1040 <triptych@plt>
mov    %eax,%edx
lea    0xebe(%rip),%rdi
mov    $0xe589eac7,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [30 x i8] c"Largest prime of %ld is: %ld\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @triptych(i32 -443946297)
%3 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 -443946297, i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"Largest prime of %ld is: %ld\0A\00"
define i32 @main() {
%1 = tail call i32 @triptych(i32 -443946297)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 -443946297, i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int main(void) {
  int x = 15, y = 37;
  printf("%d减去%d的结果是%d.\n", x, y, x - y);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xf,-0x4(%rbp)
movl   $0x25,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x4(%rbp),%ecx
sub    -0x8(%rbp),%ecx
lea    0xec7(%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    $0xf,%esi
mov    $0x25,%edx
mov    $0xffffffea,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"%d\E5\87\8F\E5\8E\BB%d\E7\9A\84\E7\BB\93\E6\9E\9C\E6\98\AF%d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 15, i32* %1
store i32 37, i32* %2
%3 = load i32, i32* %1
%4 = load i32, i32* %2
%5 = load i32, i32* %1
%6 = load i32, i32* %2
%7 = sub nsw i32 %5, %6
%8 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4, i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"%d\E5\87\8F\E5\8E\BB%d\E7\9A\84\E7\BB\93\E6\9E\9C\E6\98\AF%d.\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 15, i32 37, i32 -22)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ clock();
int /*<<< orphan*/ getpid();
scalar_t__ mix(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ srand(unsigned long);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void init_random(long long *seed) {
  unsigned long s = (unsigned long)(*seed);
  if (*seed < 0)
    s = (unsigned long)mix(clock(), time(NULL), getpid());
  srand(s);
  *seed = s;
}


x86 assembly (clang, -O0):
<init_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jge    11a3 <init_random+0x53>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %eax,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    %eax,%edx
call   1050 <mix@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <srand@plt>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_random>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
mov    (%rdi),%rbx
test   %rbx,%rbx
jns    1186 <init_random+0x36>
xor    %eax,%eax
call   1040 <clock@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %eax,%edx
call   1050 <mix@plt>
mov    %rax,%rbx
mov    %rbx,%rdi
call   1060 <srand@plt>
mov    %rbx,(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @init_random(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
store i64* %0, i64** %2
%4 = load i64*, i64** %2
%5 = load i64, i64* %4
store i64 %5, i64* %3
%6 = load i64*, i64** %2
%7 = load i64, i64* %6
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = call i32 (...) @clock()
%11 = call i32 @time(i32* null)
%12 = call i32 (...) @getpid()
%13 = call i64 @mix(i32 %10, i32 %11, i32 %12)
store i64 %13, i64* %3
br label %14
14: ; preds = %9, %1
%15 = load i64, i64* %3
%16 = call i32 @srand(i64 %15)
%17 = load i64, i64* %3
%18 = load i64*, i64** %2
store i64 %17, i64* %18
ret void
}

LLVM IR (-O2):
define void @init_random(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = tail call i32 (...) @clock()
%6 = tail call i32 @time(i32* null)
%7 = tail call i32 (...) @getpid()
%8 = tail call i64 @mix(i32 %5, i32 %6, i32 %7)
br label %9
9: ; preds = %4, %1
%10 = phi i64 [ %8, %4 ], [ %2, %1 ]
%11 = tail call i32 @srand(i64 %10)
store i64 %10, i64* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ BrushlessMotorSetPwm(int, int);
void set_pwm(int side, int pwm) {
  if (side == 1) {
    pwm = -pwm;
  }
  pwm = (int)(pwm / 2.0) + 127;
  if (pwm > 255)
    pwm = 255;
  else if (pwm < 0)
    pwm = 0;
  BrushlessMotorSetPwm(side, pwm);
}


x86 assembly (clang, -O0):
<set_pwm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1130 <set_pwm+0x20>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xec3(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
add    $0x7f,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0xff,-0x8(%rbp)
jle    1164 <set_pwm+0x54>
movl   $0xff,-0x8(%rbp)
jmp    117a <set_pwm+0x6a>
cmpl   $0x0,-0x8(%rbp)
jge    1175 <set_pwm+0x65>
movl   $0x0,-0x8(%rbp)
jmp    117a <set_pwm+0x6a>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <BrushlessMotorSetPwm@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_pwm>:
mov    %esi,%eax
neg    %eax
cmp    $0x1,%edi
cmovne %esi,%eax
cvtsi2sd %eax,%xmm0
mulsd  0xeda(%rip),%xmm0
cvttsd2si %xmm0,%eax
cmp    $0xffffff82,%eax
mov    $0xffffff81,%ecx
cmovge %eax,%ecx
add    $0x7f,%ecx
cmp    $0x81,%eax
mov    $0xff,%esi
cmovl  %ecx,%esi
jmp    1030 <BrushlessMotorSetPwm@plt>

LLVM IR (-O0):
define void @set_pwm(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 = icmp eq i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %4
%9 = sub nsw i32 0, %8
store i32 %9, i32* %4
br label %10
10: ; preds = %7, %2
%11 = load i32, i32* %4
%12 = sitofp i32 %11 to double
%13 = fdiv double %12, 2.000000e+00
%14 = fptosi double %13 to i32
%15 = add nsw i32 %14, 127
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = icmp sgt i32 %16, 255
br i1 %17, label %18, label %19
18: ; preds = %10
store i32 255, i32* %4
br label %24
19: ; preds = %10
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 0, i32* %4
br label %23
23: ; preds = %22, %19
br label %24
24: ; preds = %23, %18
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = call i32 @BrushlessMotorSetPwm(i32 %25, i32 %26)
ret void
}

LLVM IR (-O2):
define void @set_pwm(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1
%4 = sub nsw i32 0, %1
%5 = select i1 %3, i32 %4, i32 %1
%6 = sitofp i32 %5 to double
%7 = fmul double %6, 5.000000e-01
%8 = fptosi double %7 to i32
%9 = icmp sgt i32 %8, 128
%10 = icmp sgt i32 %8, -127
%11 = select i1 %10, i32 %8, i32 -127
%12 = add nsw i32 %11, 127
%13 = select i1 %9, i32 255, i32 %12
%14 = tail call i32 @BrushlessMotorSetPwm(i32 %0, i32 %13)
ret void
}
unsigned int HashSymbol(const char *sym) {
  unsigned int hash = 0;
  while (*sym)
    hash = 101 * hash + *sym++;
  return hash ^ (hash >> 16);
}


x86 assembly (clang, -O0):
<HashSymbol>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     113c <HashSymbol+0x3c>
imul   $0x65,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <HashSymbol+0xf>
mov    -0xc(%rbp),%eax
mov    -0xc(%rbp),%ecx
shr    $0x10,%ecx
xor    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<HashSymbol>:
mov    (%rdi),%al
test   %al,%al
je     1125 <HashSymbol+0x25>
add    $0x1,%rdi
xor    %ecx,%ecx
nopl   0x0(%rax)
imul   $0x65,%ecx,%edx
movsbl %al,%ecx
add    %edx,%ecx
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <HashSymbol+0x10>
jmp    1127 <HashSymbol+0x27>
xor    %ecx,%ecx
mov    %ecx,%eax
shr    $0x10,%eax
xor    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @HashSymbol(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 i32 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = mul i32 %6, 101
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = sext i8 %5 to i32
%11 = add i32 %8, %10
%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 [ 0, %1 ], [ %11, %4 ]
%16 = lshr i32 %15, 16
%17 = xor i32 %16, %15
ret i32 %17
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long background_pixel;
};
typedef TYPE_1__ XSetWindowAttributes;

/* Variables and functions */
void set_XSetWindowAttributes_background_pixel(void *_p, unsigned long _v) {
  ((XSetWindowAttributes *)_p)->background_pixel = (unsigned long)_v;
}


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

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

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

LLVM IR (-O2):
define void @set_XSetWindowAttributes_background_pixel(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ F_DUPFD;
int errno;
int fcntl(int, int /*<<< orphan*/, int /*<<< orphan*/);
int dup(int oldfd) {
  int ret = fcntl(oldfd, F_DUPFD, 0);
  if (ret < 0) {
    errno = -ret;
    return -1;
  }
  return ret;
}


x86 assembly (clang, -O0):
<dup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1155 <dup+0x45>
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
mov    0x2e91(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    115b <dup+0x4b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dup>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
test   %eax,%eax
js     1127 <dup+0x17>
pop    %rcx
ret
neg    %eax
mov    0x2ea8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@F_DUPFD = global i32 0
@errno = global i32 0
define i32 @dup(i32 %0) {
%2 = load i32, i32* @F_DUPFD
%3 = tail call i32 @fcntl(i32 %0, i32 %2, i32 0)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = sub nsw i32 0, %3
store i32 %6, i32* @errno
br label %7
7: ; preds = %1, %5
%8 = phi i32 [ -1, %5 ], [ %3, %1 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ AT_FDCWD;
int faccessat(int /*<<< orphan*/, char const *, int, int /*<<< orphan*/);
int access(const char *pathname, int mode) {
  return faccessat(AT_FDCWD, pathname, mode, 0);
}


x86 assembly (clang, -O0):
<access>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
xor    %ecx,%ecx
call   1030 <faccessat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<access>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ebc(%rip),%rax
mov    (%rax),%edi
xor    %ecx,%ecx
jmp    1030 <faccessat@plt>

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

LLVM IR (-O2):
@AT_FDCWD = global i32 0
define i32 @access(i8* %0, i32 %1) {
%3 = load i32, i32* @AT_FDCWD
%4 = tail call i32 @faccessat(i32 %3, i8* %0, i32 %1, i32 0)
ret i32 %4
}
int calculate_char() {
  char i = 0;
  while (i >= 0) {
    ++i;
  }
  --i;
  return i;
}


x86 assembly (clang, -O0):
<calculate_char>:
push   %rbp
mov    %rsp,%rbp
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x0,%eax
jl     1122 <calculate_char+0x22>
mov    -0x1(%rbp),%al
add    $0x1,%al
mov    %al,-0x1(%rbp)
jmp    1108 <calculate_char+0x8>
mov    -0x1(%rbp),%al
add    $0xff,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @calculate_char() {
ret i32 127
}
/* Variables and functions */
double dkth_smallest(double *, int, int);
double dmedian(double a[], int n) { return (dkth_smallest(a, n, n / 2)); }


x86 assembly (clang, -O0):
<dmedian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
call   1030 <dkth_smallest@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmedian>:
mov    %esi,%edx
shr    $0x1f,%edx
add    %esi,%edx
sar    %edx
jmp    1030 <dkth_smallest@plt>

LLVM IR (-O0):
define double @dmedian(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%5 = load double*, double** %3
%6 = load i32, i32* %4
%7 = load i32, i32* %4
%8 = sdiv i32 %7, 2
%9 = call double @dkth_smallest(double* %5, i32 %6, i32 %8)
ret double %9
}

LLVM IR (-O2):
define double @dmedian(double* %0, i32 %1) {
%3 = sdiv i32 %1, 2
%4 = tail call double @dkth_smallest(double* %0, i32 %1, i32 %3)
ret double %4
}
/* Variables and functions */
size_t c_vector_max_size(void) { return (-1); }


x86 assembly (clang, -O0):
<c_vector_max_size>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffffffffffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_vector_max_size>:
mov    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
define i64 @c_vector_max_size() {
ret i64 -1
}

LLVM IR (-O2):
define i64 @c_vector_max_size() {
ret i64 -1
}
/* Type definitions */
struct eembed_allocator {
  int dummy;
};

/* Variables and functions */
void *calloc(size_t, size_t);
void *eembed_system_calloc(struct eembed_allocator *ea, size_t nmemb,
                           size_t size) {
  (void)ea;
  return size ? calloc(nmemb, size) : NULL;
}


x86 assembly (clang, -O0):
<eembed_system_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1145 <eembed_system_calloc+0x35>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x20(%rbp)
jmp    1150 <eembed_system_calloc+0x40>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    1150 <eembed_system_calloc+0x40>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eembed_system_calloc>:
test   %rdx,%rdx
je     1120 <eembed_system_calloc+0x10>
mov    %rsi,%rdi
mov    %rdx,%rsi
jmp    1030 <calloc@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.eembed_allocator = type { i32 }
define i8* @eembed_system_calloc(%struct.eembed_allocator* %0, i64 %1, i64 %2) {
%4 = alloca %struct.eembed_allocator*
%5 = alloca i64
%6 = alloca i64
store %struct.eembed_allocator* %0, %struct.eembed_allocator** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load %struct.eembed_allocator*, %struct.eembed_allocator** %4
%8 = load i64, i64* %6
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i64, i64* %5
%12 = load i64, i64* %6
%13 = call i8* @calloc(i64 %11, i64 %12)
br label %15
14: ; preds = %3
br label %15
15: ; preds = %14, %10
%16 = phi i8* [ %13, %10 ], [ null, %14 ]
ret i8* %16
}

LLVM IR (-O2):
%struct.eembed_allocator = type { i32 }
define noalias i8* @eembed_system_calloc(%struct.eembed_allocator* nocapture readnone %0, i64 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i8* @calloc(i64 %1, i64 %2)
br label %7
7: ; preds = %3, %5
%8 = phi i8* [ %6, %5 ], [ null, %3 ]
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void enum_pot2(int k) {
  if (k == 0)
    printf("2^%d=2\n", k);
}


x86 assembly (clang, -O0):
<enum_pot2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1134 <enum_pot2+0x24>
mov    -0x4(%rbp),%esi
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enum_pot2>:
test   %edi,%edi
je     1115 <enum_pot2+0x5>
ret
lea    0xee4(%rip),%rdi
xor    %esi,%esi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"2^%d=2\0A\00"
define void @enum_pot2(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void adapt_vt_ext_vt_trace_off(uint32_t ignored0, uint8_t ignored1,
                               uint8_t ignored2) {}


x86 assembly (clang, -O0):
<adapt_vt_ext_vt_trace_off>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @adapt_vt_ext_vt_trace_off(i32 %0, i32 %1, i32 %2) {
ret void
}
/* Variables and functions */
double RAND_MAX;
int /*<<< orphan*/ assert(int);
int rand();
int random_range(int floor, int ceil) {
  assert(ceil > 0);
  return floor + (int)((ceil + 0.5 - floor) * rand() / (RAND_MAX + 1.0));
}


x86 assembly (clang, -O0):
<random_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xeb6(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
movsd  -0x18(%rbp),%xmm0
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cvtsi2sd %ecx,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe7b(%rip),%xmm1
mov    0x2e5c(%rip),%rcx
addsd  (%rcx),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
add    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_range>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
test   %esi,%esi
setg   %dil
call   1030 <assert@plt>
cvtsi2sd %ebp,%xmm1
addsd  0xec0(%rip),%xmm1
cvtsi2sd %ebx,%xmm0
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
xor    %eax,%eax
call   1040 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%rsp),%xmm0
mov    0x2e81(%rip),%rax
movsd  (%rax),%xmm1
addsd  0xe95(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define i32 @random_range(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp sgt i32 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = sitofp i32 %10 to double
%12 = fadd double %11, 5.000000e-01
%13 = load i32, i32* %3
%14 = sitofp i32 %13 to double
%15 = fsub double %12, %14
%16 = call i32 (...) @rand()
%17 = sitofp i32 %16 to double
%18 = fmul double %15, %17
%19 = load double, double* @RAND_MAX
%20 = fadd double %19, 1.000000e+00
%21 = fdiv double %18, %20
%22 = fptosi double %21 to i32
%23 = add nsw i32 %9, %22
ret i32 %23
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define i32 @random_range(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = sitofp i32 %1 to double
%7 = fadd double %6, 5.000000e-01
%8 = sitofp i32 %0 to double
%9 = fsub double %7, %8
%10 = tail call i32 (...) @rand()
%11 = sitofp i32 %10 to double
%12 = fmul double %9, %11
%13 = load double, double* @RAND_MAX
%14 = fadd double %13, 1.000000e+00
%15 = fdiv double %12, %14
%16 = fptosi double %15 to i32
%17 = add nsw i32 %16, %0
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ scan_buffer(char *, char);
void main() { scan_buffer("fubar", 'x'); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x78,%esi
call   1030 <scan_buffer@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
lea    0xee9(%rip),%rdi
mov    $0x78,%esi
jmp    1030 <scan_buffer@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"fubar\00"
define void @main() {
%1 = call i32 @scan_buffer(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext 120)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"fubar\00"
define void @main() {
%1 = tail call i32 @scan_buffer(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext 120)
ret void
}