xunge/DecIR huggingface dataset:
void px_put_short_be(char *cp, short int sval) {
  *cp++ = (sval >> 8) & 0xff;
  *cp++ = sval & 0xff;
}


x86 assembly (clang, -O0):
<px_put_short_be>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
movswl -0xa(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
movswl -0xa(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<px_put_short_be>:
rol    $0x8,%si
mov    %si,(%rdi)
ret

LLVM IR (-O0):
define void @px_put_short_be(i8* %0, i16 signext %1) {
%3 = alloca i8*
%4 = alloca i16
store i8* %0, i8** %3
store i16 %1, i16* %4
%5 = load i16, i16* %4
%6 = sext i16 %5 to i32
%7 = ashr i32 %6, 8
%8 = and i32 %7, 255
%9 = trunc i32 %8 to i8
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %3
store i8 %9, i8* %10
%12 = load i16, i16* %4
%13 = sext i16 %12 to i32
%14 = and i32 %13, 255
%15 = trunc i32 %14 to i8
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %3
store i8 %15, i8* %16
ret void
}

LLVM IR (-O2):
define void @px_put_short_be(i8* nocapture writeonly %0, i16 signext %1) {
%3 = lshr i16 %1, 8
%4 = trunc i16 %3 to i8
%5 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %4, i8* %0
%6 = trunc i16 %1 to i8
store i8 %6, i8* %5
ret void
}
void reverseUnsigned(unsigned *a, int length) {
  int halfLen = (length >> 1);
  unsigned *end = a + length;
  unsigned c;
  while (--halfLen >= 0) {
    c = *a;
    *a++ = *--end;
    *end = c;
  }
}


x86 assembly (clang, -O0):
<reverseUnsigned>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jl     1173 <reverseUnsigned+0x73>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x8(%rbp)
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1127 <reverseUnsigned+0x27>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverseUnsigned>:
cmp    $0x2,%esi
jl     1138 <reverseUnsigned+0x38>
mov    %esi,%eax
shr    %esi
lea    (%rdi,%rax,4),%rax
add    $0xfffffffffffffffc,%rax
add    $0x1,%esi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rdi),%ecx
mov    (%rax),%edx
mov    %edx,(%rdi)
add    $0x4,%rdi
mov    %ecx,(%rax)
add    $0xfffffffffffffffc,%rax
add    $0xffffffff,%esi
cmp    $0x1,%esi
ja     1120 <reverseUnsigned+0x20>
ret

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

LLVM IR (-O2):
define void @reverseUnsigned(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %18
4: ; preds = %2
%5 = zext i32 %1 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = lshr i32 %1, 1
br label %8
8: ; preds = %4, %8
%9 = phi i32* [ %16, %8 ], [ %0, %4 ]
%10 = phi i32* [ %14, %8 ], [ %6, %4 ]
%11 = phi i32 [ %12, %8 ], [ %7, %4 ]
%12 = add nsw i32 %11, -1
%13 = load i32, i32* %9
%14 = getelementptr inbounds i32, i32* %10, i64 -1
%15 = load i32, i32* %14
%16 = getelementptr inbounds i32, i32* %9, i64 1
store i32 %15, i32* %9
store i32 %13, i32* %14
%17 = icmp ugt i32 %11, 1
br i1 %17, label %8, label %18
18: ; preds = %8, %2
ret void
}
/* Variables and functions */
int PDCRead(int);
int /*<<< orphan*/ PDCWrite(int, int /*<<< orphan*/);
void PDCLCDWrite(const char *pcStr, unsigned long ulCount) {
  while (ulCount--) {
    while ((PDCRead(0x6) & 0x80)) {
    }
    PDCWrite(0x7, *pcStr++);
  }
}


x86 assembly (clang, -O0):
<PDCLCDWrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
je     118c <PDCLCDWrite+0x6c>
jmp    114e <PDCLCDWrite+0x2e>
mov    $0x6,%edi
call   1030 <PDCRead@plt>
and    $0x80,%eax
cmp    $0x0,%eax
je     116b <PDCLCDWrite+0x4b>
jmp    114e <PDCLCDWrite+0x2e>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%esi
mov    $0x7,%edi
call   1040 <PDCWrite@plt>
jmp    1130 <PDCLCDWrite+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PDCLCDWrite>:
push   %r14
push   %rbx
push   %rax
test   %rsi,%rsi
je     1155 <PDCLCDWrite+0x35>
mov    %rsi,%r14
mov    %rdi,%rbx
nop
mov    $0x6,%edi
call   1030 <PDCRead@plt>
test   $0x80,%al
jne    1130 <PDCLCDWrite+0x10>
movsbl (%rbx),%esi
add    $0x1,%rbx
mov    $0x7,%edi
call   1040 <PDCWrite@plt>
add    $0xffffffffffffffff,%r14
jne    1130 <PDCLCDWrite+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @PDCLCDWrite(i8* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %18, label %4
4: ; preds = %2, %11
%5 = phi i64 [ %12, %11 ], [ %1, %2 ]
%6 = phi i8* [ %13, %11 ], [ %0, %2 ]
br label %7
7: ; preds = %4, %7
%8 = tail call i32 @PDCRead(i32 6)
%9 = and i32 %8, 128
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %7
11: ; preds = %7
%12 = add i64 %5, -1
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = load i8, i8* %6
%15 = sext i8 %14 to i32
%16 = tail call i32 @PDCWrite(i32 7, i32 %15)
%17 = icmp eq i64 %12, 0
br i1 %17, label %18, label %4
18: ; preds = %11, %2
ret void
}
short horiz_mode_code_white(runlen)
short runlen;
{ return (runlen < 64 ? runlen + 2 : (runlen / 64) + 65); }


x86 assembly (clang, -O0):
<horiz_mode_code_white>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
cmp    $0x40,%eax
jge    1127 <horiz_mode_code_white+0x27>
movswl -0x2(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <horiz_mode_code_white+0x39>
movswl -0x2(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
add    $0x41,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<horiz_mode_code_white>:
mov    %edi,%eax
shl    $0x10,%eax
cmp    $0x3fffff,%eax
jg     1113 <horiz_mode_code_white+0x13>
sar    $0x10,%eax
add    $0x2,%eax
ret
lea    0x3f(%rdi),%eax
test   %di,%di
cmovns %edi,%eax
cwtl
sar    $0x6,%eax
add    $0x41,%eax
movzwl %ax,%eax
ret

LLVM IR (-O0):
define signext i16 @horiz_mode_code_white(i32 %0) {
%2 = alloca i16
%3 = trunc i32 %0 to i16
store i16 %3, i16* %2
%4 = load i16, i16* %2
%5 = sext i16 %4 to i32
%6 = icmp slt i32 %5, 64
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i16, i16* %2
%9 = sext i16 %8 to i32
%10 = add nsw i32 %9, 2
br label %16
11: ; preds = %1
%12 = load i16, i16* %2
%13 = sext i16 %12 to i32
%14 = sdiv i32 %13, 64
%15 = add nsw i32 %14, 65
br label %16
16: ; preds = %11, %7
%17 = phi i32 [ %10, %7 ], [ %15, %11 ]
%18 = trunc i32 %17 to i16
ret i16 %18
}

LLVM IR (-O2):
define signext i16 @horiz_mode_code_white(i32 %0) {
%2 = shl i32 %0, 16
%3 = icmp slt i32 %2, 4194304
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = ashr exact i32 %2, 16
%6 = add nsw i32 %5, 2
br label %12
7: ; preds = %1
%8 = trunc i32 %0 to i16
%9 = sdiv i16 %8, 64
%10 = add nsw i16 %9, 65
%11 = zext i16 %10 to i32
br label %12
12: ; preds = %7, %4
%13 = phi i32 [ %6, %4 ], [ %11, %7 ]
%14 = trunc i32 %13 to i16
ret i16 %14
}
/* Variables and functions */
char *ultoa(unsigned int, char *, int);
char *utoa(unsigned int __val, char *__s, int __radix) {
  return ultoa(__val, __s, __radix);
}


x86 assembly (clang, -O0):
<utoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <ultoa@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utoa>:
jmp    1030 <ultoa@plt>

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

LLVM IR (-O2):
define i8* @utoa(i32 %0, i8* %1, i32 %2) {
%4 = tail call i8* @ultoa(i32 %0, i8* %1, i32 %2)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ gpio_a_input(int);
int /*<<< orphan*/ gpio_a_output(int);
int /*<<< orphan*/ gpio_a_set(int, int /*<<< orphan*/);
void usb_disconnect(void) {
  volatile unsigned int delay = 512;
  gpio_a_output(12);
  gpio_a_set(12, 0);
  while (delay--)
    ;
  gpio_a_input(12);
}


x86 assembly (clang, -O0):
<usb_disconnect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x200,-0x4(%rbp)
mov    $0xc,%edi
call   1040 <gpio_a_output@plt>
mov    $0xc,%edi
xor    %esi,%esi
call   1030 <gpio_a_set@plt>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     116e <usb_disconnect+0x3e>
jmp    1155 <usb_disconnect+0x25>
mov    $0xc,%edi
call   1050 <gpio_a_input@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usb_disconnect>:
push   %rax
movl   $0x200,0x4(%rsp)
mov    $0xc,%edi
call   1040 <gpio_a_output@plt>
mov    $0xc,%edi
xor    %esi,%esi
call   1030 <gpio_a_set@plt>
nop
subl   $0x1,0x4(%rsp)
jae    1150 <usb_disconnect+0x20>
mov    $0xc,%edi
pop    %rax
jmp    1050 <gpio_a_input@plt>

LLVM IR (-O0):
define void @usb_disconnect() {
%1 = alloca i32
store volatile i32 512, i32* %1
%2 = call i32 @gpio_a_output(i32 12)
%3 = call i32 @gpio_a_set(i32 12, i32 0)
br label %4
4: ; preds = %8, %0
%5 = load volatile i32, i32* %1
%6 = add i32 %5, -1
store volatile i32 %6, i32* %1
%7 = icmp ne i32 %5, 0
br i1 %7, label %8, label %9
8: ; preds = %4
br label %4
9: ; preds = %4
%10 = call i32 @gpio_a_input(i32 12)
ret void
}

LLVM IR (-O2):
define void @usb_disconnect() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store volatile i32 512, i32* %1
%3 = tail call i32 @gpio_a_output(i32 12)
%4 = tail call i32 @gpio_a_set(i32 12, i32 0)
br label %5
5: ; preds = %5, %0
%6 = load volatile i32, i32* %1
%7 = add i32 %6, -1
store volatile i32 %7, i32* %1
%8 = icmp eq i32 %6, 0
br i1 %8, label %9, label %5
9: ; preds = %5
%10 = tail call i32 @gpio_a_input(i32 12)
ret void
}
int xcalloc(nelem, size)
int nelem, size;
{
  register int result = calloc(nelem, size);
  if (!result)
    fatal(15);
  return result;
}


x86 assembly (clang, -O0):
<xcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movslq -0x4(%rbp),%rdi
movslq -0x8(%rbp),%rsi
call   1030 <calloc@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1154 <xcalloc+0x34>
mov    $0xf,%edi
mov    $0x0,%al
call   1040 <fatal@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcalloc>:
push   %rbx
movslq %edi,%rdi
movslq %esi,%rsi
call   1030 <calloc@plt>
mov    %rax,%rbx
test   %ebx,%ebx
jne    113f <xcalloc+0x1f>
mov    $0xf,%edi
xor    %eax,%eax
call   1040 <fatal@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @xcalloc(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = call i8* @calloc(i64 %7, i64 %9)
%11 = ptrtoint i8* %10 to i32
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %2
%15 = call i32 (i32, ...) bitcast (i32 (...)* @fatal to i32 (i32, ...)*)(i32 15)
br label %16
16: ; preds = %14, %2
%17 = load i32, i32* %5
ret i32 %17
}

LLVM IR (-O2):
define i32 @xcalloc(i32 %0, i32 %1) {
%3 = sext i32 %0 to i64
%4 = sext i32 %1 to i64
%5 = tail call i8* @calloc(i64 %3, i64 %4)
%6 = ptrtoint i8* %5 to i64
%7 = trunc i64 %6 to i32
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 (i32, ...) bitcast (i32 (...)* @fatal to i32 (i32, ...)*)(i32 15)
br label %11
11: ; preds = %9, %2
ret i32 %7
}
int ap9540_c2c_deep_debug_exit(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @ap9540_c2c_deep_debug_exit() {
ret i32 0
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t hash64(uint64_t x) {
  x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9L;
  x = (x ^ (x >> 27)) * 0x94d049bb133111ebL;
  x = x ^ (x >> 31);
  return x;
}


x86 assembly (clang, -O0):
<hash64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x1e,%ecx
xor    %ecx,%eax
cltq
movabs $0xbf58476d1ce4e5b9,%rcx
47 58 bf
imul   %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x1b,%ecx
xor    %ecx,%eax
cltq
movabs $0x94d049bb133111eb,%rcx
49 d0 94
imul   %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x1f,%ecx
xor    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash64>:
mov    %edi,%eax
sar    $0x1e,%eax
xor    %edi,%eax
imul   $0x1ce4e5b9,%eax,%eax
mov    %eax,%ecx
sar    $0x1b,%ecx
xor    %eax,%ecx
imul   $0x133111eb,%ecx,%ecx
mov    %ecx,%eax
sar    $0x1f,%eax
xor    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @hash64(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 30
%6 = xor i32 %3, %5
%7 = sext i32 %6 to i64
%8 = mul i64 %7, -4658895280553007687
%9 = trunc i64 %8 to i32
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = load i32, i32* %2
%12 = ashr i32 %11, 27
%13 = xor i32 %10, %12
%14 = sext i32 %13 to i64
%15 = mul i64 %14, -7723592293110705685
%16 = trunc i64 %15 to i32
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = load i32, i32* %2
%19 = ashr i32 %18, 31
%20 = xor i32 %17, %19
store i32 %20, i32* %2
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @hash64(i32 %0) {
%2 = ashr i32 %0, 30
%3 = xor i32 %2, %0
%4 = mul i32 %3, 484763065
%5 = ashr i32 %4, 27
%6 = xor i32 %5, %4
%7 = mul i32 %6, 321982955
%8 = ashr i32 %7, 31
%9 = xor i32 %8, %7
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void replace(int count, int TabSize) {
  while (count >= 0) {
    if (count >= TabSize) {
      putchar('\t');
      count -= TabSize;
    } else {
      putchar(' ');
      --count;
    }
  }
}


x86 assembly (clang, -O0):
<replace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1166 <replace+0x56>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     114e <replace+0x3e>
mov    $0x9,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1161 <replace+0x51>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    111e <replace+0xe>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<replace>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
js     1158 <replace+0x48>
mov    %esi,%r14d
mov    %edi,%ebx
mov    %edi,%ebp
jmp    1143 <replace+0x33>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
mov    %ebx,%ebp
test   %ebp,%ebp
js     1158 <replace+0x48>
sub    %r14d,%ebp
jl     1130 <replace+0x20>
mov    $0x9,%edi
call   1030 <putchar@plt>
mov    %ebp,%ebx
test   %ebp,%ebp
jns    1143 <replace+0x33>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @replace(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, -1
br i1 %3, label %4, label %16
4: ; preds = %2, %13
%5 = phi i32 [ %14, %13 ], [ %0, %2 ]
%6 = icmp slt i32 %5, %1
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = tail call i32 @putchar(i8 signext 9)
%9 = sub nsw i32 %5, %1
br label %13
10: ; preds = %4
%11 = tail call i32 @putchar(i8 signext 32)
%12 = add nsw i32 %5, -1
br label %13
13: ; preds = %10, %7
%14 = phi i32 [ %9, %7 ], [ %12, %10 ]
%15 = icmp sgt i32 %14, -1
br i1 %15, label %4, label %16
16: ; preds = %13, %2
ret void
}
int roundup(int offset, int size) {
  if (offset % size == 0)
    return offset;
  return offset - (offset % size) + size;
}


x86 assembly (clang, -O0):
<roundup>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1125 <roundup+0x25>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113d <roundup+0x3d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    -0x10(%rbp),%eax
sub    %edx,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<roundup>:
mov    %edi,%eax
cltd
idiv   %esi
lea    (%rsi,%rdi,1),%eax
sub    %edx,%eax
test   %edx,%edx
cmove  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @roundup(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = icmp eq i32 %3, 0
%5 = add i32 %1, %0
%6 = sub i32 %5, %3
%7 = select i1 %4, i32 %0, i32 %6
ret i32 %7
}
void MUSIC_Pause(void) {}


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

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

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

LLVM IR (-O2):
define void @MUSIC_Pause() {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t PWMClockGet(uint32_t ui32Base) {
  ;
  if (!((*((volatile uint32_t *)(ui32Base + 0x00000FC8))) & 0x00000100)) {
    return (0x00000000);
  } else {
    return ((*((volatile uint32_t *)(ui32Base + 0x00000FC8))) &
            (0x00000100 | 0x00000007));
  }
}


x86 assembly (clang, -O0):
<PWMClockGet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xfc8,%eax
cltq
mov    (%rax),%eax
and    $0x100,%eax
cmp    $0x0,%eax
jne    112d <PWMClockGet+0x2d>
movl   $0x0,-0x4(%rbp)
jmp    1141 <PWMClockGet+0x41>
mov    -0x8(%rbp),%eax
add    $0xfc8,%eax
cltq
mov    (%rax),%eax
and    $0x107,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMClockGet>:
movslq %edi,%rcx
xor    %eax,%eax
testl  $0x100,0xfc8(%rcx)
je     111c <PWMClockGet+0x1c>
mov    $0x107,%eax
and    0xfc8(%rcx),%eax
ret

LLVM IR (-O0):
define i32 @PWMClockGet(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 4040
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = and i32 %8, 256
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %1
store i32 0, i32* %2
br label %19
12: ; preds = %1
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 4040
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
%17 = load volatile i32, i32* %16
%18 = and i32 %17, 263
store i32 %18, i32* %2
br label %19
19: ; preds = %12, %11
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @PWMClockGet(i32 %0) {
%2 = add nsw i32 %0, 4040
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = and i32 %5, 256
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = load volatile i32, i32* %4
%10 = and i32 %9, 263
br label %11
11: ; preds = %1, %8
%12 = phi i32 [ %10, %8 ], [ 0, %1 ]
ret i32 %12
}
float degreeToRad(float degree) { return (degree * 3.14) / 180.0; }


x86 assembly (clang, -O0):
<degreeToRad>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeee(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeda(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<degreeToRad>:
cvtss2sd %xmm0,%xmm0
mulsd  0xef4(%rip),%xmm0
divsd  0xef4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @degreeToRad(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fmul double %4, 3.140000e+00
%6 = fdiv double %5, 1.800000e+02
%7 = fptrunc double %6 to float
ret float %7
}

LLVM IR (-O2):
define float @degreeToRad(float %0) {
%2 = fpext float %0 to double
%3 = fmul double %2, 3.140000e+00
%4 = fdiv double %3, 1.800000e+02
%5 = fptrunc double %4 to float
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void function3(int c) {
  printf("You entered %d so function3 was called.\n\n", c);
}


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

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

LLVM IR (-O0):
@.str = [42 x i8] c"You entered %d so function3 was called.\0A\0A\00"
define void @function3(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"You entered %d so function3 was called.\0A\0A\00"
define void @function3(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int openFile(char *pfileName, char *pstrLine) {
  FILE *file;
  file = fopen(pfileName, "a+");
  if (file == NULL) {
    return -1;
  } else {
    fputs(pstrLine, file);
  }
  fclose(file);
  return 0;
}


x86 assembly (clang, -O0):
<openFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    116b <openFile+0x3b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1188 <openFile+0x58>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <fputs@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openFile>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
lea    0xec2(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1162 <openFile+0x32>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <fputs@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
jmp    1167 <openFile+0x37>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"a+\00"
define i32 @openFile(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %8, i32** %6
%9 = load i32*, i32** %6
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %19
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = load i32*, i32** %6
%15 = call i32 @fputs(i8* %13, i32* %14)
br label %16
16: ; preds = %12
%17 = load i32*, i32** %6
%18 = call i32 @fclose(i32* %17)
store i32 0, i32* %3
br label %19
19: ; preds = %16, %11
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@.str = [3 x i8] c"a+\00"
define i32 @openFile(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @fputs(i8* %1, i32* %3)
%7 = tail call i32 @fclose(i32* %3)
br label %8
8: ; preds = %2, %5
%9 = phi i32 [ 0, %5 ], [ -1, %2 ]
ret i32 %9
}
void interrupt_bus_fault(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<interrupt_bus_fault>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <interrupt_bus_fault+0x9>
jmp    1109 <interrupt_bus_fault+0x9>

x86 assembly (clang, -O2):
<interrupt_bus_fault>:
jmp    1100 <interrupt_bus_fault>

LLVM IR (-O0):
define void @interrupt_bus_fault() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @interrupt_bus_fault() {
br label %1
1: ; preds = %0, %1
br label %1
}
void __attribute__((destructor)) deinit() {
  printf("module.so %s\n", __func__);
}


x86 assembly (clang, -O0):
<deinit>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xeec(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<deinit>:
lea    0xee9(%rip),%rdi
lea    0xef0(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"module.so %s\0A\00"
@__func__.deinit = [7 x i8] c"deinit\00"
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @deinit, i8* null }]
define void @deinit() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__func__.deinit, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"module.so %s\0A\00"
@__func__.deinit = [7 x i8] c"deinit\00"
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @deinit, i8* null }]
define void @deinit() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__func__.deinit, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int llseek(unsigned int fd, unsigned long offset_high, unsigned long offset_low,
           long long *result, unsigned int whence) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<llseek>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    0x2eca(%rip),%rax
mov    (%rax),%ecx
mov    0x2eb1(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<llseek>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @llseek(i32 %0, i64 %1, i64 %2, i64* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64*
%10 = alloca i32
store i32 %0, i32* %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64* %3, i64** %9
store i32 %4, i32* %10
%11 = load i32, i32* @ENOSYS
store i32 %11, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @llseek(i32 %0, i64 %1, i64 %2, i64* nocapture readnone %3, i32 %4) {
%6 = load i32, i32* @ENOSYS
store i32 %6, i32* @errno
ret i32 -1
}
/* Variables and functions */
int rand();
int c_rand() { return rand(); }


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

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

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

LLVM IR (-O2):
define i32 @c_rand() {
%1 = tail call i32 (...) @rand()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", 0);
  printf("%d\n", 100);
  printf("%d\n", 200);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
mov    $0x64,%esi
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
mov    $0xc8,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 100)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 200)
ret i32 0
}
int main(int argc, char *argv[]) {
  int a = 4;
  char c = 'c';
  return &c;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
movb   $0x63,-0x15(%rbp)
lea    -0x15(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
lea    -0x1(%rsp),%rax
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 4, i32* %6
store i8 99, i8* %7
%8 = ptrtoint i8* %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8
%4 = ptrtoint i8* %3 to i64
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void print_FF() { putchar('\014'); }


x86 assembly (clang, -O0):
<print_FF>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc,%edi
call   1030 <putchar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_FF>:
mov    $0xc,%edi
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @print_FF() {
%1 = call i32 @putchar(i8 signext 12)
ret void
}

LLVM IR (-O2):
define void @print_FF() {
%1 = tail call i32 @putchar(i8 signext 12)
ret void
}
/* Variables and functions */
char const *dngettext(char *, char const *, char const *, unsigned long);
const char *_(const char *msgid1, const char *msgid2, unsigned long int n) {
  return dngettext("gtk", msgid1, msgid2, n);
}


x86 assembly (clang, -O0):
<_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xec9(%rip),%rdi
call   1030 <dngettext@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee0(%rip),%rdi
jmp    1030 <dngettext@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"gtk\00"
define i8* @_(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i8* @dngettext(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8, i64 %9)
ret i8* %10
}

LLVM IR (-O2):
@.str = [4 x i8] c"gtk\00"
define i8* @_(i8* %0, i8* %1, i64 %2) {
%4 = tail call i8* @dngettext(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i64 %2)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ write_break();
int /*<<< orphan*/ write_line(char *);
int /*<<< orphan*/ write_nl();
void html_description(void) {
  write_break();
  write_line("<DL COMPACT>");
  write_nl();
}


x86 assembly (clang, -O0):
<html_description>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <write_break@plt>
lea    0xebe(%rip),%rdi
call   1050 <write_line@plt>
mov    $0x0,%al
call   1030 <write_nl@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<html_description>:
push   %rax
xor    %eax,%eax
call   1040 <write_break@plt>
lea    0xec1(%rip),%rdi
call   1050 <write_line@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <write_nl@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"<DL COMPACT>\00"
define void @html_description() {
%1 = call i32 (...) @write_break()
%2 = call i32 @write_line(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @write_nl()
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"<DL COMPACT>\00"
define void @html_description() {
%1 = tail call i32 (...) @write_break()
%2 = tail call i32 @write_line(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @write_nl()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ msg;

/* Variables and functions */
int SIGALRM;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ write(int, char const *, int);
void handler(int signo) {
  static const char msg[] = "\n*** Timer expired, you lose ***\n";
  assert(signo == SIGALRM);
  write(2, msg, sizeof(msg) - 1);
  exit(1);
}


x86 assembly (clang, -O0):
<handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ea3(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x2,%edi
lea    0xea0(%rip),%rsi
mov    $0x21,%edx
call   1030 <write@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<handler>:
push   %rax
mov    0x2eb0(%rip),%rcx
xor    %eax,%eax
cmp    %edi,(%rcx)
sete   %al
mov    %eax,%edi
call   1040 <assert@plt>
lea    0xeb3(%rip),%rsi
mov    $0x2,%edi
mov    $0x21,%edx
call   1030 <write@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@handler.msg = internal constant [34 x i8] c"\0A*** Timer expired, you lose ***\0A\00"
@SIGALRM = global i32 0
define void @handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGALRM
%5 = icmp eq i32 %3, %4
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = call i32 @write(i32 2, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @handler.msg, i64 0, i64 0), i32 33)
%9 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@handler.msg = internal constant [34 x i8] c"\0A*** Timer expired, you lose ***\0A\00"
@SIGALRM = global i32 0
define void @handler(i32 %0) {
%2 = load i32, i32* @SIGALRM
%3 = icmp eq i32 %2, %0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @write(i32 2, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @handler.msg, i64 0, i64 0), i32 33)
%7 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int max3(int, int, int);
char mss(int d, int l, int u) {
  int max;
  char mss;
  max = max3(d, l, u);
  if (max == d)
    mss = '\\';
  if (max == l)
    mss = '|';
  if (max == u)
    mss = '_';
  return mss;
}


x86 assembly (clang, -O0):
<mss>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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
call   1030 <max3@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    1142 <mss+0x32>
movb   $0x5c,-0x11(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1152 <mss+0x42>
movb   $0x7c,-0x11(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1162 <mss+0x52>
movb   $0x5f,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mss>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%ebp
call   1030 <max3@plt>
cmp    %ebp,%eax
sete   %cl
shl    $0x5,%cl
or     $0x5c,%cl
cmp    %ebx,%eax
movzbl %cl,%ecx
mov    $0x5f,%eax
cmovne %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define signext i8 @mss(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = call i32 @max3(i32 %9, i32 %10, i32 %11)
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = load i32, i32* %4
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %17
16: ; preds = %3
store i8 92, i8* %8
br label %17
17: ; preds = %16, %3
%18 = load i32, i32* %7
%19 = load i32, i32* %5
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %22
21: ; preds = %17
store i8 124, i8* %8
br label %22
22: ; preds = %21, %17
%23 = load i32, i32* %7
%24 = load i32, i32* %6
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %27
26: ; preds = %22
store i8 95, i8* %8
br label %27
27: ; preds = %26, %22
%28 = load i8, i8* %8
ret i8 %28
}

LLVM IR (-O2):
define signext i8 @mss(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @max3(i32 %0, i32 %1, i32 %2)
%5 = icmp eq i32 %4, %1
%6 = select i1 %5, i8 124, i8 92
%7 = icmp eq i32 %4, %2
%8 = select i1 %7, i8 95, i8 %6
ret i8 %8
}
int get16(unsigned char *p) { return p[0] << 8 | p[1]; }


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

x86 assembly (clang, -O2):
<get16>:
movzwl (%rdi),%eax
shl    $0x10,%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @get16(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 = shl i32 %6, 8
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @get16(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = or i32 %4, %7
ret i32 %8
}
void hug_mutex_lock() {}


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

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

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

LLVM IR (-O2):
define void @hug_mutex_lock() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ say(char *, int);
void hit(void) { say("Ohh soft.", 1); }


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"Ohh soft.\00"
define void @hit() {
%1 = call i32 @say(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"Ohh soft.\00"
define void @hit() {
%1 = tail call i32 @say(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
int dgtpicom_set_and_run(char lr, char lh, char lm, char ls, char rr, char rh,
                         char rm, char rs) {
  return 0;
}


x86 assembly (clang, -O0):
<dgtpicom_set_and_run>:
push   %rbp
mov    %rsp,%rbp
mov    %r8d,-0x18(%rbp)
mov    %ecx,%eax
mov    -0x18(%rbp),%ecx
mov    %eax,-0x14(%rbp)
mov    %edx,%eax
mov    -0x14(%rbp),%edx
mov    %eax,-0x10(%rbp)
mov    %esi,%eax
mov    -0x10(%rbp),%esi
mov    %eax,-0xc(%rbp)
mov    %edi,%r8d
mov    -0xc(%rbp),%edi
mov    %r9b,%al
mov    0x18(%rbp),%r9b
mov    0x10(%rbp),%r9b
mov    %r8b,-0x1(%rbp)
mov    %dil,-0x2(%rbp)
mov    %sil,-0x3(%rbp)
mov    %dl,-0x4(%rbp)
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @dgtpicom_set_and_run(i8 signext %0, i8 signext %1, i8 signext %2, i8 signext %3, i8 signext %4, i8 signext %5, i8 signext %6, i8 signext %7) {
%9 = alloca i8
%10 = alloca i8
%11 = alloca i8
%12 = alloca i8
%13 = alloca i8
%14 = alloca i8
%15 = alloca i8
%16 = alloca i8
store i8 %0, i8* %9
store i8 %1, i8* %10
store i8 %2, i8* %11
store i8 %3, i8* %12
store i8 %4, i8* %13
store i8 %5, i8* %14
store i8 %6, i8* %15
store i8 %7, i8* %16
ret i32 0
}

LLVM IR (-O2):
define i32 @dgtpicom_set_and_run(i8 signext %0, i8 signext %1, i8 signext %2, i8 signext %3, i8 signext %4, i8 signext %5, i8 signext %6, i8 signext %7) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, void *, void *);
void print_key_value_cb(void *key, void *value, void *user_data) {
  printf("key = %p, value = %p\n", key, value);
}


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

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

LLVM IR (-O0):
@.str = [22 x i8] c"key = %p, value = %p\0A\00"
define void @print_key_value_cb(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"key = %p, value = %p\0A\00"
define void @print_key_value_cb(i8* %0, i8* %1, i8* nocapture readnone %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
int ffs(int word) {
  int i;
  if (!word)
    return 0;
  i = 0;
  for (;;) {
    if (((1 << i++) & word) != 0)
      return i;
  }
  return 0;
}


x86 assembly (clang, -O0):
<ffs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <ffs+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1152 <ffs+0x52>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    $0x1,%eax
shl    %cl,%eax
and    -0x8(%rbp),%eax
cmp    $0x0,%eax
je     114d <ffs+0x4d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1152 <ffs+0x52>
jmp    1124 <ffs+0x24>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffs>:
test   %edi,%edi
je     111b <ffs+0x1b>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
lea    0x1(%rcx),%eax
bt     %ecx,%edi
mov    %eax,%ecx
jae    1110 <ffs+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ffs(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %5, %3 ], [ 0, %1 ]
%5 = add nuw nsw i32 %4, 1
%6 = shl nuw i32 1, %4
%7 = and i32 %6, %0
%8 = icmp eq i32 %7, 0
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %5, %3 ]
ret i32 %10
}