xunge/DecIR huggingface dataset:
/* Variables and functions */
int CHAR_BIT;
unsigned int rotate(unsigned int value, unsigned int shift) {
  unsigned int r =
      (value << shift) | (value >> (CHAR_BIT * sizeof(unsigned int) - shift));
  return (r >> shift) | (r << (CHAR_BIT * sizeof(unsigned int) - shift));
}


x86 assembly (clang, -O0):
<rotate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    %cl,%eax
mov    -0x4(%rbp),%edx
mov    0x2ec4(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x2,%rcx
mov    -0x8(%rbp),%esi
sub    %rsi,%rcx
shr    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
mov    -0xc(%rbp),%edx
mov    0x2e9c(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x2,%rcx
mov    -0x8(%rbp),%esi
sub    %rsi,%rcx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotate>:
mov    %edi,%eax
mov    %esi,%ecx
shl    %cl,%eax
mov    0x2ed3(%rip),%rcx
mov    (%rcx),%edx
shl    $0x2,%edx
sub    %esi,%edx
mov    %edx,%ecx
shr    %cl,%edi
or     %edi,%eax
mov    %eax,%edi
mov    %esi,%ecx
shr    %cl,%edi
mov    %edx,%ecx
shl    %cl,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
@CHAR_BIT = global i32 0
define i32 @rotate(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 = load i32, i32* %4
%8 = shl i32 %6, %7
%9 = load i32, i32* %3
%10 = load i32, i32* @CHAR_BIT
%11 = sext i32 %10 to i64
%12 = mul i64 %11, 4
%13 = load i32, i32* %4
%14 = zext i32 %13 to i64
%15 = sub i64 %12, %14
%16 = trunc i64 %15 to i32
%17 = lshr i32 %9, %16
%18 = or i32 %8, %17
store i32 %18, i32* %5
%19 = load i32, i32* %5
%20 = load i32, i32* %4
%21 = lshr i32 %19, %20
%22 = load i32, i32* %5
%23 = load i32, i32* @CHAR_BIT
%24 = sext i32 %23 to i64
%25 = mul i64 %24, 4
%26 = load i32, i32* %4
%27 = zext i32 %26 to i64
%28 = sub i64 %25, %27
%29 = trunc i64 %28 to i32
%30 = shl i32 %22, %29
%31 = or i32 %21, %30
ret i32 %31
}

LLVM IR (-O2):
@CHAR_BIT = global i32 0
define i32 @rotate(i32 %0, i32 %1) {
%3 = shl i32 %0, %1
%4 = load i32, i32* @CHAR_BIT
%5 = shl i32 %4, 2
%6 = sub i32 %5, %1
%7 = lshr i32 %0, %6
%8 = or i32 %7, %3
%9 = lshr i32 %8, %1
%10 = shl i32 %8, %6
%11 = or i32 %9, %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ DisplayNumber(unsigned long);
int ReadNumber();
int main(void) {
  unsigned long tmp;
  tmp = (ReadNumber() & 0x00ff0000L) >> 16;
  DisplayNumber(tmp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <ReadNumber@plt>
cltq
and    $0xff0000,%rax
sar    $0x10,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <DisplayNumber@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <ReadNumber@plt>
shr    $0x10,%eax
movzbl %al,%edi
call   1030 <DisplayNumber@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
%3 = call i32 (...) @ReadNumber()
%4 = sext i32 %3 to i64
%5 = and i64 %4, 16711680
%6 = ashr i64 %5, 16
store i64 %6, i64* %2
%7 = load i64, i64* %2
%8 = call i32 @DisplayNumber(i64 %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @ReadNumber()
%2 = lshr i32 %1, 16
%3 = and i32 %2, 255
%4 = zext i32 %3 to i64
%5 = tail call i32 @DisplayNumber(i64 %4)
ret i32 0
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int ipfix_enterprise_flag_set(uint16_t id) {
  return ((id & (1 << 15)) == (1 << 15));
}


x86 assembly (clang, -O0):
<ipfix_enterprise_flag_set>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x8000,%eax
cmp    $0x8000,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipfix_enterprise_flag_set>:
mov    %edi,%eax
shr    $0xf,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @ipfix_enterprise_flag_set(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 32768
%5 = icmp eq i32 %4, 32768
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @ipfix_enterprise_flag_set(i32 %0) {
%2 = lshr i32 %0, 15
%3 = and i32 %2, 1
ret i32 %3
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;
typedef int offset;

/* Variables and functions */
int /*<<< orphan*/ outportl(int, int);
void pci_config_write(uint8_t bus, uint8_t slot, uint8_t func, uint8_t offset,
                      uint32_t v) {
  outportl(0x0CF8, (0x80000000 | ((bus) << 16) | ((slot) << 11) |
                    ((func) << 8) | ((offset)&0xfc)));
  outportl(0x0CFC, v);
}


x86 assembly (clang, -O0):
<pci_config_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x4(%rbp),%esi
shl    $0x10,%esi
or     $0x80000000,%esi
mov    -0x8(%rbp),%eax
shl    $0xb,%eax
or     %eax,%esi
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
or     %eax,%esi
mov    -0x10(%rbp),%eax
and    $0xfc,%eax
or     %eax,%esi
mov    $0xcf8,%edi
call   1030 <outportl@plt>
mov    -0x14(%rbp),%esi
mov    $0xcfc,%edi
call   1030 <outportl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pci_config_write>:
push   %rbx
mov    %r8d,%ebx
shl    $0x10,%edi
shl    $0xb,%esi
or     %edi,%esi
shl    $0x8,%edx
or     %edx,%esi
and    $0xfc,%ecx
or     %ecx,%esi
or     $0x80000000,%esi
mov    $0xcf8,%edi
call   1030 <outportl@plt>
mov    $0xcfc,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <outportl@plt>

LLVM IR (-O0):
define void @pci_config_write(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %6
%12 = shl i32 %11, 16
%13 = or i32 -2147483648, %12
%14 = load i32, i32* %7
%15 = shl i32 %14, 11
%16 = or i32 %13, %15
%17 = load i32, i32* %8
%18 = shl i32 %17, 8
%19 = or i32 %16, %18
%20 = load i32, i32* %9
%21 = and i32 %20, 252
%22 = or i32 %19, %21
%23 = call i32 @outportl(i32 3320, i32 %22)
%24 = load i32, i32* %10
%25 = call i32 @outportl(i32 3324, i32 %24)
ret void
}

LLVM IR (-O2):
define void @pci_config_write(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = shl i32 %0, 16
%7 = shl i32 %1, 11
%8 = shl i32 %2, 8
%9 = and i32 %3, 252
%10 = or i32 %6, %7
%11 = or i32 %10, %8
%12 = or i32 %11, %9
%13 = or i32 %12, -2147483648
%14 = tail call i32 @outportl(i32 3320, i32 %13)
%15 = tail call i32 @outportl(i32 3324, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ execve(char *, char **, int /*<<< orphan*/);
int main() {
  char *a[] = {"/bin/sh", 0};
  execve(*a, a, 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2cf1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2cee(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1030 <execve@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0x2cf5(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xeda(%rip),%rdi
mov    %rsp,%rsi
xor    %edx,%edx
call   1030 <execve@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"/bin/sh\00"
@__const.main.a = [2 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* null]
define i32 @main() {
%1 = alloca [2 x i8*]
%2 = bitcast [2 x i8*]* %1 to i8*
%3 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 0
%4 = load i8*, i8** %3
%5 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 0
%6 = call i32 @execve(i8* %4, i8** %5, i32 0)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"/bin/sh\00"
@__const.main.a = [2 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* null]
define i32 @main() {
%1 = alloca [2 x i8*]
%2 = bitcast [2 x i8*]* %1 to i8*
%3 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 0
%4 = call i32 @execve(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %3, i32 0)
ret i32 0
}
/* Variables and functions */
long dump_file(char *, char *, long);
long load_file(char *, char **);
int copy_file(char *src, char *dest) {
  long l;
  char *p;
  l = load_file(src, &p);
  if (l < 0)
    return 1;
  if (dump_file(dest, p, l) != l)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<copy_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <load_file@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jge    1158 <copy_file+0x38>
movl   $0x1,-0x4(%rbp)
jmp    1186 <copy_file+0x66>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <dump_file@plt>
cmp    -0x20(%rbp),%rax
je     117f <copy_file+0x5f>
movl   $0x1,-0x4(%rbp)
jmp    1186 <copy_file+0x66>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_file>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rsp,%rsi
call   1040 <load_file@plt>
test   %rax,%rax
js     1153 <copy_file+0x33>
mov    %rax,%rbx
mov    (%rsp),%rsi
mov    %r14,%rdi
mov    %rax,%rdx
call   1030 <dump_file@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rbx,%rcx
setne  %al
jmp    1158 <copy_file+0x38>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @copy_file(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i64 @load_file(i8* %0, i8** %3)
%6 = icmp slt i64 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i64 @dump_file(i8* %1, i8* %8, i64 %5)
%10 = icmp ne i64 %9, %5
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %7, %2
%13 = phi i32 [ 1, %2 ], [ %11, %7 ]
ret i32 %13
}
int hash(char *name) {
  register int hashval;
  for (hashval = 0; *name;)
    hashval += *name++;
  return (hashval % 500);
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1139 <hash+0x39>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    110f <hash+0xf>
mov    -0xc(%rbp),%eax
mov    $0x1f4,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%al
test   %al,%al
je     1140 <hash+0x40>
add    $0x1,%rdi
xor    %ecx,%ecx
nopl   0x0(%rax)
movsbl %al,%eax
add    %eax,%ecx
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <hash+0x10>
movslq %ecx,%rax
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x1f4,%ecx,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @hash(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 %15
8: ; preds = %4
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
%11 = load i8, i8* %9
%12 = sext i8 %11 to i32
%13 = load i32, i32* %3
%14 = add nsw i32 %13, %12
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = load i32, i32* %3
%17 = srem i32 %16, 500
ret i32 %17
}

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %11, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %8, %4 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = sext i8 %5 to i32
%10 = add nsw i32 %6, %9
%11 = load i8, i8* %8
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4
%14 = srem i32 %10, 500
br label %15
15: ; preds = %13, %1
%16 = phi i32 [ 0, %1 ], [ %14, %13 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ mbus_sleep_all();
void operation_sleep(void) {
  mbus_sleep_all();
  while (1)
    ;
}


x86 assembly (clang, -O0):
<operation_sleep>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <mbus_sleep_all@plt>
jmp    111b <operation_sleep+0xb>

x86 assembly (clang, -O2):
<operation_sleep>:
push   %rax
xor    %eax,%eax
call   1030 <mbus_sleep_all@plt>
nopl   0x0(%rax,%rax,1)
jmp    1120 <operation_sleep+0x10>

LLVM IR (-O0):
define void @operation_sleep() {
%1 = call i32 (...) @mbus_sleep_all()
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
define void @operation_sleep() {
%1 = tail call i32 (...) @mbus_sleep_all()
br label %2
2: ; preds = %0, %2
br label %2
}
char xtob(c)
register int c;
{ return (c - (((c >= '0') && (c <= '9')) ? '0' : '7')); }


x86 assembly (clang, -O0):
<xtob>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x30,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1126 <xtob+0x26>
cmpl   $0x39,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x5(%rbp),%sil
mov    $0x37,%ecx
mov    $0x30,%edx
test   $0x1,%sil
cmovne %edx,%ecx
sub    %ecx,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xtob>:
lea    -0x30(%rdi),%ecx
lea    0xc9(%rdi),%edx
lea    0xd0(%rdi),%eax
cmp    $0xa,%ecx
cmovae %edx,%eax
ret

LLVM IR (-O0):
define signext i8 @xtob(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp sle i32 %7, 57
br label %9
9: ; preds = %6, %1
%10 = phi i1 [ false, %1 ], [ %8, %6 ]
%11 = zext i1 %10 to i64
%12 = select i1 %10, i32 48, i32 55
%13 = sub nsw i32 %3, %12
%14 = trunc i32 %13 to i8
ret i8 %14
}

LLVM IR (-O2):
define signext i8 @xtob(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = select i1 %3, i32 208, i32 201
%5 = add i32 %4, %0
%6 = trunc i32 %5 to i8
ret i8 %6
}
int cdrom_stop() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @cdrom_stop() {
ret i32 0
}
void FileSpecLeave() { ; }


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

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

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

LLVM IR (-O2):
define void @FileSpecLeave() {
ret void
}
/* Variables and functions */
__attribute__((weak)) void _prevent_memset_lto(void *const s, int c,
                                               const size_t n) {
  (void)s;
  (void)c;
  (void)n;
}


x86 assembly (clang, -O0):
<_prevent_memset_lto>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define weak void @_prevent_memset_lto(i8* %0, i32 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i64, i64* %6
ret void
}

LLVM IR (-O2):
define weak void @_prevent_memset_lto(i8* %0, i32 %1, i64 %2) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;
typedef int /*<<< orphan*/ pthread_cond_t;

/* Variables and functions */
int /*<<< orphan*/ do_error(char *);
int pthread_cond_wait(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int tw_pthread_cond_wait(pthread_cond_t *c, pthread_mutex_t *m) {
  int return_value;
  if ((return_value = pthread_cond_wait(c, m)) == -1)
    do_error("pthread_cond_wait");
  return (return_value);
}


x86 assembly (clang, -O0):
<tw_pthread_cond_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <pthread_cond_wait@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    1155 <tw_pthread_cond_wait+0x35>
lea    0xeb0(%rip),%rdi
call   1040 <do_error@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tw_pthread_cond_wait>:
push   %rbx
call   1030 <pthread_cond_wait@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1139 <tw_pthread_cond_wait+0x19>
lea    0xecc(%rip),%rdi
call   1040 <do_error@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"pthread_cond_wait\00"
define i32 @tw_pthread_cond_wait(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 = load i32*, i32** %4
%8 = call i32 @pthread_cond_wait(i32* %6, i32* %7)
store i32 %8, i32* %5
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @do_error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
%13 = load i32, i32* %5
ret i32 %13
}

LLVM IR (-O2):
@.str = [18 x i8] c"pthread_cond_wait\00"
define i32 @tw_pthread_cond_wait(i32* %0, i32* %1) {
%3 = tail call i32 @pthread_cond_wait(i32* %0, i32* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @do_error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i32 %3
}
void select_ship(void) {
  (*((volatile unsigned long *)0x70200004)) &= ~(1 << 1);
}


x86 assembly (clang, -O0):
<select_ship>:
push   %rbp
mov    %rsp,%rbp
mov    $0x70200004,%eax
mov    (%rax),%rcx
and    $0xfffffffffffffffd,%rcx
mov    $0x70200004,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<select_ship>:
andq   $0xfffffffffffffffd,0x70200004
70 fd
ret

LLVM IR (-O0):
define void @select_ship() {
%1 = load volatile i64, i64* inttoptr (i64 1881145348 to i64*)
%2 = and i64 %1, -3
store volatile i64 %2, i64* inttoptr (i64 1881145348 to i64*)
ret void
}

LLVM IR (-O2):
define void @select_ship() {
%1 = load volatile i64, i64* inttoptr (i64 1881145348 to i64*)
%2 = and i64 %1, -3
store volatile i64 %2, i64* inttoptr (i64 1881145348 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clear_cmd_results();
char const *wpa_cmd_results();
int /*<<< orphan*/ wpa_get_status();
const char *get_status_desc(void) {
  if (!wpa_get_status())
    clear_cmd_results();
  return wpa_cmd_results();
}


x86 assembly (clang, -O0):
<get_status_desc>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <wpa_get_status@plt>
cmp    $0x0,%eax
jne    114b <get_status_desc+0x1b>
mov    $0x0,%al
call   1030 <clear_cmd_results@plt>
mov    $0x0,%al
call   1040 <wpa_cmd_results@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_status_desc>:
push   %rax
xor    %eax,%eax
call   1050 <wpa_get_status@plt>
test   %eax,%eax
jne    1143 <get_status_desc+0x13>
xor    %eax,%eax
call   1030 <clear_cmd_results@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <wpa_cmd_results@plt>

LLVM IR (-O0):
define i8* @get_status_desc() {
%1 = call i32 (...) @wpa_get_status()
%2 = icmp ne i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = call i32 (...) @clear_cmd_results()
br label %5
5: ; preds = %3, %0
%6 = call i8* (...) @wpa_cmd_results()
ret i8* %6
}

LLVM IR (-O2):
define i8* @get_status_desc() {
%1 = tail call i32 (...) @wpa_get_status()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @clear_cmd_results()
br label %5
5: ; preds = %3, %0
%6 = tail call i8* (...) @wpa_cmd_results()
ret i8* %6
}
void audiohw_pause() {}


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

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

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

LLVM IR (-O2):
define void @audiohw_pause() {
ret void
}
void hard_i2c_init(unsigned speed) {
  unsigned delay = 117;
  (*(volatile unsigned long *)0xc1108520) =
      ((*(volatile unsigned long *)0xc1108520) & ~(0x3FF << 12)) |
      (delay << 12);
}


x86 assembly (clang, -O0):
<hard_i2c_init>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x75,-0x8(%rbp)
mov    $0xc1108520,%eax
mov    (%rax),%rcx
and    $0xffffffffffc00fff,%rcx
mov    -0x8(%rbp),%eax
shl    $0xc,%eax
mov    %eax,%eax
or     %rax,%rcx
mov    $0xc1108520,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<hard_i2c_init>:
mov    $0xc1108520,%eax
mov    $0xffffffffffc00fff,%rcx
and    (%rax),%rcx
or     $0x75000,%rcx
mov    %rcx,(%rax)
ret

LLVM IR (-O0):
define void @hard_i2c_init(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 117, i32* %3
%4 = load volatile i64, i64* inttoptr (i64 3239085344 to i64*)
%5 = and i64 %4, -4190209
%6 = load i32, i32* %3
%7 = shl i32 %6, 12
%8 = zext i32 %7 to i64
%9 = or i64 %5, %8
store volatile i64 %9, i64* inttoptr (i64 3239085344 to i64*)
ret void
}

LLVM IR (-O2):
define void @hard_i2c_init(i32 %0) {
%2 = load volatile i64, i64* inttoptr (i64 3239085344 to i64*)
%3 = and i64 %2, -4190209
%4 = or i64 %3, 479232
store volatile i64 %4, i64* inttoptr (i64 3239085344 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dispatch(int, char **);
int main(int argc, char *argv[]) {
  dispatch(argc, argv);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @dispatch(i32 %0, i8** %1)
ret i32 0
}
void report(void) {}


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

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

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

LLVM IR (-O2):
define void @report() {
ret void
}
void touch_simple(char *addr) {
  if (*addr != 0xf) {
    *addr = 0xf;
  } else {
    *addr = 0x00;
  }
}


x86 assembly (clang, -O0):
<touch_simple>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xf,%eax
je     1124 <touch_simple+0x24>
mov    -0x8(%rbp),%rax
movb   $0xf,(%rax)
jmp    112b <touch_simple+0x2b>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<touch_simple>:
xor    %eax,%eax
cmpb   $0xf,(%rdi)
mov    $0xf,%ecx
cmove  %eax,%ecx
mov    %cl,(%rdi)
ret

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

LLVM IR (-O2):
define void @touch_simple(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 15
%4 = select i1 %3, i8 0, i8 15
store i8 %4, i8* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t *id_p(uint32_t *p) { return p; }


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

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

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

LLVM IR (-O2):
define i32* @id_p(i32* readnone returned %0) {
ret i32* %0
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int);
char *itoa(int i) {
  static char buffer[4096];
  snprintf(buffer, 4096, "%d", i);
  return buffer;
}


x86 assembly (clang, -O0):
<itoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
lea    0x2f1b(%rip),%rdi
mov    $0x1000,%esi
lea    0xecf(%rip),%rdx
call   1030 <snprintf@plt>
lea    0x2f03(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<itoa>:
push   %rbx
mov    %edi,%ecx
lea    0x2f26(%rip),%rbx
lea    0xedf(%rip),%rdx
mov    %rbx,%rdi
mov    $0x1000,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@itoa.buffer = internal global [4096 x i8] zeroinitializer
@.str = [3 x i8] c"%d\00"
define i8* @itoa(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @snprintf(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @itoa.buffer, i64 0, i64 0), i32 4096, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @itoa.buffer, i64 0, i64 0)
}

LLVM IR (-O2):
@itoa.buffer = internal global [4096 x i8] zeroinitializer
@.str = [3 x i8] c"%d\00"
define i8* @itoa(i32 %0) {
%2 = tail call i32 @snprintf(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @itoa.buffer, i64 0, i64 0), i32 4096, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @itoa.buffer, i64 0, i64 0)
}
int compare(const void *a, const void *b) {
  const double term1 = *(*(double **)a);
  const double term2 = *(*(double **)b);
  if (term1 < term2)
    return -1;
  if (term1 > term2)
    return +1;
  return 0;
}


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    114c <compare+0x4c>
movl   $0xffffffff,-0x4(%rbp)
jmp    116f <compare+0x6f>
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1168 <compare+0x68>
movl   $0x1,-0x4(%rbp)
jmp    116f <compare+0x6f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare>:
mov    (%rdi),%rax
movsd  (%rax),%xmm0
mov    (%rsi),%rax
movsd  (%rax),%xmm1
xor    %ecx,%ecx
ucomisd %xmm1,%xmm0
seta   %cl
ucomisd %xmm0,%xmm1
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double**
%4 = load double*, double** %3
%5 = load double, double* %4
%6 = bitcast i8* %1 to double**
%7 = load double*, double** %6
%8 = load double, double* %7
%9 = fcmp olt double %5, %8
%10 = fcmp ogt double %5, %8
%11 = zext i1 %10 to i32
%12 = select i1 %9, i32 -1, i32 %11
ret i32 %12
}
char *strcat(char *dest, const char *src) {
  char *ptr = dest;
  while (*dest++)
    ;
  for (*dest--; *dest++ = *src++;)
    ;
  return ptr;
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     1131 <strcat+0x31>
jmp    1114 <strcat+0x14>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     116c <strcat+0x6c>
jmp    113d <strcat+0x3d>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat>:
mov    %rdi,%rax
mov    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x0,(%rcx)
lea    0x1(%rcx),%rcx
jne    1110 <strcat+0x10>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movzbl (%rsi,%rdx,1),%edi
mov    %dil,-0x1(%rcx,%rdx,1)
add    $0x1,%rdx
test   %dil,%dil
jne    1120 <strcat+0x20>
ret

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

LLVM IR (-O2):
define i8* @strcat(i8* returned %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %5, %3 ]
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %4
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %3
8: ; preds = %3, %8
%9 = phi i8* [ %11, %8 ], [ %1, %3 ]
%10 = phi i8* [ %13, %8 ], [ %4, %3 ]
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = load i8, i8* %9
%13 = getelementptr inbounds i8, i8* %10, i64 1
store i8 %12, i8* %10
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %8
15: ; preds = %8
ret i8* %0
}
/* Type definitions */
typedef scalar_t__ clock_t;

/* Variables and functions */
scalar_t__ clock();
clock_t single_call_time() {
  clock_t t1 = clock();
  clock_t t2 = clock();
  return (t2 - t1);
}


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

x86 assembly (clang, -O2):
<single_call_time>:
push   %rbx
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <clock@plt>
sub    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @single_call_time() {
%1 = alloca i64
%2 = alloca i64
%3 = call i64 (...) @clock()
store i64 %3, i64* %1
%4 = call i64 (...) @clock()
store i64 %4, i64* %2
%5 = load i64, i64* %2
%6 = load i64, i64* %1
%7 = sub nsw i64 %5, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @single_call_time() {
%1 = tail call i64 (...) @clock()
%2 = tail call i64 (...) @clock()
%3 = sub nsw i64 %2, %1
ret i64 %3
}
void sh_bios_gdb_detach(void) {}


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

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

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

LLVM IR (-O2):
define void @sh_bios_gdb_detach() {
ret void
}
/* Type definitions */
typedef int uint8_t;
struct pcg_state_setseq_16 {
  int dummy;
};

/* Variables and functions */
int pcg_setseq_16_xsh_rs_8_random_r(struct pcg_state_setseq_16 *);
uint8_t pcg_setseq_16_xsh_rs_8_boundedrand_r(struct pcg_state_setseq_16 *rng,
                                             uint8_t bound) {
  uint8_t threshold = ((uint8_t)(-bound)) % bound;
  for (;;) {
    uint8_t r = pcg_setseq_16_xsh_rs_8_random_r(rng);
    if (r >= threshold)
      return r % bound;
  }
}


x86 assembly (clang, -O0):
<pcg_setseq_16_xsh_rs_8_boundedrand_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
sub    -0xc(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <pcg_setseq_16_xsh_rs_8_random_r@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     1152 <pcg_setseq_16_xsh_rs_8_boundedrand_r+0x42>
mov    -0x14(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%eax
add    $0x20,%rsp
pop    %rbp
ret
jmp    112b <pcg_setseq_16_xsh_rs_8_boundedrand_r+0x1b>

x86 assembly (clang, -O2):
<pcg_setseq_16_xsh_rs_8_boundedrand_r>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <pcg_setseq_16_xsh_rs_8_random_r@plt>
test   %eax,%eax
js     1120 <pcg_setseq_16_xsh_rs_8_boundedrand_r+0x10>
cltd
idiv   %ebp
mov    %edx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.pcg_state_setseq_16 = type { i32 }
define i32 @pcg_setseq_16_xsh_rs_8_boundedrand_r(%struct.pcg_state_setseq_16* %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32 @pcg_setseq_16_xsh_rs_8_random_r(%struct.pcg_state_setseq_16* %0)
%5 = icmp sgt i32 %4, -1
br i1 %5, label %6, label %3
6: ; preds = %3
%7 = srem i32 %4, %1
ret i32 %7
}
/* Variables and functions */
unsigned int __builtin_inl(int);
int /*<<< orphan*/ __builtin_outl(unsigned int, int);
void main(void) {
  unsigned int dch, dcl;
  unsigned async_lat;
  int dimms;
  dimms = 1;
  async_lat = 0;
  dch = 0x1234;
  dcl = __builtin_inl(0x5678);
  if (!(dcl & (1 << 8))) {
    if (dimms == 4) {
      async_lat = 9;
    } else {
      async_lat = 8;
    }
  } else {
    async_lat = 6;
  }
  dch |= async_lat;
  __builtin_outl(dch, 0x9abc);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1234,-0x4(%rbp)
mov    $0x5678,%edi
call   1030 <__builtin_inl@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x100,%eax
cmp    $0x0,%eax
jne    117d <main+0x5d>
cmpl   $0x4,-0x10(%rbp)
jne    1171 <main+0x51>
movl   $0x9,-0xc(%rbp)
jmp    1178 <main+0x58>
movl   $0x8,-0xc(%rbp)
jmp    1184 <main+0x64>
movl   $0x6,-0xc(%rbp)
mov    -0xc(%rbp),%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x9abc,%esi
call   1040 <__builtin_outl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5678,%edi
call   1030 <__builtin_inl@plt>
test   $0x100,%eax
mov    $0x123c,%eax
mov    $0x1236,%edi
cmove  %eax,%edi
mov    $0x9abc,%esi
pop    %rax
jmp    1040 <__builtin_outl@plt>

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 1, i32* %4
store i32 0, i32* %3
store i32 4660, i32* %1
%5 = call i32 @__builtin_inl(i32 22136)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = and i32 %6, 256
%8 = icmp ne i32 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %0
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 4
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 9, i32* %3
br label %14
13: ; preds = %9
store i32 8, i32* %3
br label %14
14: ; preds = %13, %12
br label %16
15: ; preds = %0
store i32 6, i32* %3
br label %16
16: ; preds = %15, %14
%17 = load i32, i32* %3
%18 = load i32, i32* %1
%19 = or i32 %18, %17
store i32 %19, i32* %1
%20 = load i32, i32* %1
%21 = call i32 @__builtin_outl(i32 %20, i32 39612)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @__builtin_inl(i32 22136)
%2 = and i32 %1, 256
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 4668, i32 4662
%5 = tail call i32 @__builtin_outl(i32 %4, i32 39612)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void messageFromSharedLib() { printf("This is a message from shared lib\n"); }


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

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

LLVM IR (-O0):
@.str = [35 x i8] c"This is a message from shared lib\0A\00"
define void @messageFromSharedLib() {
%1 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [34 x i8] c"This is a message from shared lib\00"
define void @messageFromSharedLib() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mtx_t;

/* Variables and functions */
scalar_t__ EAGAIN;
scalar_t__ errno;
scalar_t__ mutex_trylock(int /*<<< orphan*/ *);
int thrd_busy;
int thrd_error;
int thrd_success;
int mtx_trylock(mtx_t *mtx) {
  if (mutex_trylock(mtx)) {
    if (errno == EAGAIN)
      return thrd_busy;
    return thrd_error;
  }
  return thrd_success;
}


x86 assembly (clang, -O0):
<mtx_trylock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <mutex_trylock@plt>
cmp    $0x0,%rax
je     116b <mtx_trylock+0x5b>
mov    0x2ea2(%rip),%rax
mov    (%rax),%rax
mov    0x2e78(%rip),%rcx
cmp    (%rcx),%rax
jne    115a <mtx_trylock+0x4a>
mov    0x2e78(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1177 <mtx_trylock+0x67>
mov    0x2e6f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1177 <mtx_trylock+0x67>
mov    0x2e76(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mtx_trylock>:
push   %rax
call   1030 <mutex_trylock@plt>
mov    0x2ebb(%rip),%rcx
mov    (%rcx),%rcx
mov    0x2e91(%rip),%rdx
cmp    (%rdx),%rcx
jne    113a <mtx_trylock+0x2a>
mov    0x2e95(%rip),%rcx
test   %rax,%rax
je     1146 <mtx_trylock+0x36>
jmp    114d <mtx_trylock+0x3d>
mov    0x2e8f(%rip),%rcx
test   %rax,%rax
jne    114d <mtx_trylock+0x3d>
mov    0x2e9b(%rip),%rcx
mov    (%rcx),%eax
pop    %rcx
ret

LLVM IR (-O0):
@errno = global i64 0
@EAGAIN = global i64 0
@thrd_busy = global i32 0
@thrd_error = global i32 0
@thrd_success = global i32 0
define i32 @mtx_trylock(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = call i64 @mutex_trylock(i32* %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i64, i64* @errno
%9 = load i64, i64* @EAGAIN
%10 = icmp eq i64 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = load i32, i32* @thrd_busy
store i32 %12, i32* %2
br label %17
13: ; preds = %7
%14 = load i32, i32* @thrd_error
store i32 %14, i32* %2
br label %17
15: ; preds = %1
%16 = load i32, i32* @thrd_success
store i32 %16, i32* %2
br label %17
17: ; preds = %15, %13, %11
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@errno = global i64 0
@EAGAIN = global i64 0
@thrd_busy = global i32 0
@thrd_error = global i32 0
@thrd_success = global i32 0
define i32 @mtx_trylock(i32* %0) {
%2 = tail call i64 @mutex_trylock(i32* %0)
%3 = icmp eq i64 %2, 0
%4 = load i64, i64* @errno
%5 = load i64, i64* @EAGAIN
%6 = icmp eq i64 %4, %5
%7 = load i32, i32* @thrd_success
%8 = load i32, i32* @thrd_busy
%9 = load i32, i32* @thrd_error
%10 = select i1 %6, i32 %8, i32 %9
%11 = select i1 %3, i32 %7, i32 %10
ret i32 %11
}
/* Variables and functions */
bool Console_PowerDetected(void) { return true; }


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

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

LLVM IR (-O0):
define i32 @Console_PowerDetected() {
ret i32 1
}

LLVM IR (-O2):
define i32 @Console_PowerDetected() {
ret i32 1
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
uint32_t SHA2IntStatusRaw(void) {
  return ((*((volatile unsigned long *)(0x40024000 + 0x00000790))));
}


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

x86 assembly (clang, -O2):
<SHA2IntStatusRaw>:
mov    0x40024790,%rax
40
ret

LLVM IR (-O0):
define i64 @SHA2IntStatusRaw() {
%1 = load volatile i64, i64* inttoptr (i64 1073891216 to i64*)
ret i64 %1
}

LLVM IR (-O2):
define i64 @SHA2IntStatusRaw() {
%1 = load volatile i64, i64* inttoptr (i64 1073891216 to i64*)
ret i64 %1
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMRDD_get(void) { return U_WMRCORENONE_get("U_WMRDD"); }


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMRDD\00"
define i32 @U_WMRDD_get() {
%1 = tail call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
unsigned hash(char *s) {
  unsigned hashval;
  for (hashval = 0; *s != '\0'; s++)
    hashval = *s + 31 * hashval;
  return hashval % 10000;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1140 <hash+0x40>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
imul   $0x1f,-0xc(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <hash+0xf>
mov    -0xc(%rbp),%eax
mov    $0x2710,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1141 <hash+0x41>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
mov    %eax,%edx
shl    $0x5,%edx
sub    %eax,%edx
mov    %edx,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
mov    %eax,%ecx
mov    $0xd1b71759,%edx
imul   %rcx,%rdx
shr    $0x2d,%rdx
imul   $0x2710,%edx,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = mul i32 %6, 31
%10 = add i32 %9, %8
%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 %4
14: ; preds = %4
%15 = urem i32 %10, 10000
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
/* Type definitions */
typedef scalar_t__ pthread_t;
typedef int pid_t;

/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, char const *, int, int, int);
scalar_t__ pthread_self();
void printids(const char *pszStr) {
  pthread_t tid;
  pid_t pid;
  pid = getpid();
  tid = pthread_self();
  printf("%s pid = %08d tid = %08d tid(hex) = %08x\n", pszStr, pid, (int)tid,
         (int)tid);
  return;
}


x86 assembly (clang, -O0):
<printids>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <pthread_self@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %eax,%r8d
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printids>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1050 <pthread_self@plt>
lea    0xeb3(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
mov    %eax,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"%s pid = %08d tid = %08d tid(hex) = %08x\0A\00"
define void @printids(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i32 (...) @getpid()
store i32 %5, i32* %4
%6 = call i64 (...) @pthread_self()
store i64 %6, i64* %3
%7 = load i8*, i8** %2
%8 = load i32, i32* %4
%9 = load i64, i64* %3
%10 = trunc i64 %9 to i32
%11 = load i64, i64* %3
%12 = trunc i64 %11 to i32
%13 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %8, i32 %10, i32 %12)
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"%s pid = %08d tid = %08d tid(hex) = %08x\0A\00"
define void @printids(i8* %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i64 (...) @pthread_self()
%4 = trunc i64 %3 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %2, i32 %4, i32 %4)
ret void
}