xunge/DecIR huggingface dataset:
void replace(char string[]) {
  for (int i = 0; string[i]; ++i) {
    if (string[i] == '_')
      string[i] = '-';
  }
}


x86 assembly (clang, -O0):
<replace>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1155 <replace+0x55>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5f,%eax
jne    1142 <replace+0x42>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x2d,(%rax,%rcx,1)
jmp    1147 <replace+0x47>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <replace+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<replace>:
jmp    1117 <replace+0x17>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x2d,(%rdi)
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x5f,%al
je     1110 <replace+0x10>
test   %al,%al
jne    1113 <replace+0x13>
ret

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

LLVM IR (-O2):
define void @replace(i8* nocapture %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i64 [ %9, %8 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
switch i8 %5, label %8 [
i8 0, label %6
i8 95, label %7
]
6: ; preds = %2
ret void
7: ; preds = %2
store i8 45, i8* %4
br label %8
8: ; preds = %2, %7
%9 = add nuw i64 %3, 1
br label %2
}
float maxf(float a, float b) { return a > b ? a : b; }


x86 assembly (clang, -O0):
<maxf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    112c <maxf+0x2c>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1136 <maxf+0x36>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxf>:
maxss  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @maxf(float %0, float %1) {
%3 = fcmp ogt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
int main(void) {
  extern void link_error(void);
  if (__builtin_bswap32(0xaabbccdd) != 0xddccbbaa)
    link_error();
  if (__builtin_bswap64(0x1122334455667788ULL) != 0x8877665544332211ULL)
    link_error();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
signed int PutString(char *pStr, const char *pSource) {
  signed int num = 0;
  while (*pSource != 0) {
    *pStr++ = *pSource++;
    num++;
  }
  return num;
}


x86 assembly (clang, -O0):
<PutString>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1153 <PutString+0x53>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <PutString+0x13>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<PutString>:
mov    (%rsi),%cl
xor    %eax,%eax
test   %cl,%cl
je     1120 <PutString+0x20>
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rdi,%rax,1)
movzbl 0x1(%rsi,%rax,1),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <PutString+0x10>
ret

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

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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int wait(int *);
void sig_chld(int signum) {
  pid_t pid;
  int stat;
  pid = wait(&stat);
  printf("child %d terminated, status: %d\n", pid, stat);
}


x86 assembly (clang, -O0):
<sig_chld>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0xc(%rbp),%rdi
call   1040 <wait@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_chld>:
push   %rax
lea    0x4(%rsp),%rdi
call   1040 <wait@plt>
mov    0x4(%rsp),%edx
lea    0xeca(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [33 x i8] c"child %d terminated, status: %d\0A\00"
define void @sig_chld(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 @wait(i32* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"child %d terminated, status: %d\0A\00"
define void @sig_chld(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @wait(i32* %2)
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5)
ret void
}
void pthread_attr_getdetachstate() {}


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

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

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

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

/* Variables and functions */
int rand();
unsigned int time(int /*<<< orphan*/ *);
uint64_t generateTrackID(unsigned int trackNumber) {
  uint64_t t = time(NULL) * trackNumber;
  uint64_t r = rand();
  r = r << 32;
  r += rand();
  return t ^ r;
}


x86 assembly (clang, -O0):
<generateTrackID>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
imul   -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x20,%ecx
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
xor    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generateTrackID>:
push   %rax
xor    %edi,%edi
call   1030 <time@plt>
xor    %eax,%eax
call   1040 <rand@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <rand@plt>

LLVM IR (-O0):
define i32 @generateTrackID(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 @time(i32* null)
%6 = load i32, i32* %2
%7 = mul i32 %5, %6
store i32 %7, i32* %3
%8 = call i32 (...) @rand()
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = shl i32 %9, 32
store i32 %10, i32* %4
%11 = call i32 (...) @rand()
%12 = load i32, i32* %4
%13 = add nsw i32 %12, %11
store i32 %13, i32* %4
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = xor i32 %14, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @generateTrackID(i32 %0) {
%2 = tail call i32 @time(i32* null)
%3 = tail call i32 (...) @rand()
%4 = tail call i32 (...) @rand()
ret i32 poison
}
void waitBusy(void) {}


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

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

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

LLVM IR (-O2):
define void @waitBusy() {
ret void
}
int call_introspect_creator(int id) {}


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

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

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

LLVM IR (-O2):
define i32 @call_introspect_creator(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ __builtin_arc_swi();
void test_swi(void) { __builtin_arc_swi(); }


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

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

LLVM IR (-O0):
define void @test_swi() {
%1 = call i32 (...) @__builtin_arc_swi()
ret void
}

LLVM IR (-O2):
define void @test_swi() {
%1 = tail call i32 (...) @__builtin_arc_swi()
ret void
}
int test_imm_F3uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0xF3 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_F3uint64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x10,%rdx
and    $0xf3,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_F3uint64_midword_mem>:
testb  $0xf3,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_F3uint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 243
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_F3uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 15925248
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int isdigit(int c) {
  if (c >= '0' && c <= '9')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x30,-0x8(%rbp)
jl     1127 <isdigit+0x27>
cmpl   $0x39,-0x8(%rbp)
jg     1127 <isdigit+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <isdigit+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isdigit>:
add    $0xffffffd0,%edi
xor    %eax,%eax
cmp    $0xa,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @isdigit(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
unsigned int _my_get_key(int, unsigned long);
unsigned _linux_getkey(int eat, unsigned long wait) {
  unsigned k = _my_get_key(eat, wait);
  return k;
}


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

x86 assembly (clang, -O2):
<_linux_getkey>:
jmp    1030 <_my_get_key@plt>

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

LLVM IR (-O2):
define i32 @_linux_getkey(i32 %0, i64 %1) {
%3 = tail call i32 @_my_get_key(i32 %0, i64 %1)
ret i32 %3
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int /*<<< orphan*/);
int /*<<< orphan*/ _UARTBaseValid(int);
void UART9BitAddrSet(uint32_t ui32Base, uint8_t ui8Addr, uint8_t ui8Mask) {
  ASSERT(_UARTBaseValid(ui32Base));
  (*((volatile uint32_t *)(ui32Base + 0x000000A4))) = ui8Addr << 0;
  (*((volatile uint32_t *)(ui32Base + 0x000000A8))) = ui8Mask << 0;
}


x86 assembly (clang, -O0):
<UART9BitAddrSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <_UARTBaseValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
mov    -0x8(%rbp),%ecx
shl    $0x0,%ecx
mov    -0x4(%rbp),%eax
add    $0xa4,%eax
cltq
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
shl    $0x0,%ecx
mov    -0x4(%rbp),%eax
add    $0xa8,%eax
cltq
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UART9BitAddrSet>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
call   1030 <_UARTBaseValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
movslq %ebx,%rax
mov    %ebp,0xa4(%rax)
mov    %r14d,0xa8(%rax)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @UART9BitAddrSet(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = call i32 @_UARTBaseValid(i32 %7)
%9 = call i32 @ASSERT(i32 %8)
%10 = load i32, i32* %5
%11 = shl i32 %10, 0
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 164
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
store volatile i32 %11, i32* %15
%16 = load i32, i32* %6
%17 = shl i32 %16, 0
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 168
%20 = sext i32 %19 to i64
%21 = inttoptr i64 %20 to i32*
store volatile i32 %17, i32* %21
ret void
}

LLVM IR (-O2):
define void @UART9BitAddrSet(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @_UARTBaseValid(i32 %0)
%5 = tail call i32 @ASSERT(i32 %4)
%6 = add nsw i32 %0, 164
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
store volatile i32 %1, i32* %8
%9 = add nsw i32 %0, 168
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
store volatile i32 %2, i32* %11
ret void
}
/* Variables and functions */
scalar_t__ RAND_MAX;
scalar_t__ rand();
double random_double_uniform() { return ((double)rand()) / ((double)RAND_MAX); }


x86 assembly (clang, -O0):
<random_double_uniform>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec1(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_double_uniform>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec4(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define double @random_double_uniform() {
%1 = call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define double @random_double_uniform() {
%1 = tail call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ create_friend_list();
int /*<<< orphan*/ create_list();
int /*<<< orphan*/ create_on_list();
int /*<<< orphan*/ init_queues();
int /*<<< orphan*/ text_print_list(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[], char *env[]) {
  time_t the_time;
  time(&the_time);
  init_queues();
  create_friend_list();
  create_on_list();
  create_list();
  text_print_list(the_time);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x1c(%rbp),%rdi
call   1060 <time@plt>
mov    $0x0,%al
call   1080 <init_queues@plt>
mov    $0x0,%al
call   1070 <create_friend_list@plt>
mov    $0x0,%al
call   1050 <create_on_list@plt>
mov    $0x0,%al
call   1040 <create_list@plt>
mov    -0x1c(%rbp),%edi
call   1030 <text_print_list@plt>
mov    0x2e32(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
call   1060 <time@plt>
xor    %eax,%eax
call   1080 <init_queues@plt>
xor    %eax,%eax
call   1070 <create_friend_list@plt>
xor    %eax,%eax
call   1050 <create_on_list@plt>
xor    %eax,%eax
call   1040 <create_list@plt>
mov    0x4(%rsp),%edi
call   1030 <text_print_list@plt>
mov    0x2e49(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%9 = call i32 @time(i32* %8)
%10 = call i32 (...) @init_queues()
%11 = call i32 (...) @create_friend_list()
%12 = call i32 (...) @create_on_list()
%13 = call i32 (...) @create_list()
%14 = load i32, i32* %8
%15 = call i32 @text_print_list(i32 %14)
%16 = load i32, i32* @EXIT_SUCCESS
ret i32 %16
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = call i32 @time(i32* %4)
%7 = call i32 (...) @init_queues()
%8 = call i32 (...) @create_friend_list()
%9 = call i32 (...) @create_on_list()
%10 = call i32 (...) @create_list()
%11 = load i32, i32* %4
%12 = call i32 @text_print_list(i32 %11)
%13 = load i32, i32* @EXIT_SUCCESS
ret i32 %13
}
void test_one(int x) {
#pragma omp target teams distribute simd
  for (int i = 0; i < x; i++)
    ;
}


x86 assembly (clang, -O0):
<test_one>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    112d <test_one+0x2d>
jmp    111f <test_one+0x1f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <test_one+0xe>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @test_one(i32 %0) {
ret void
}
void def_version(int major, int minor) {
  do {
  } while (0);
}


x86 assembly (clang, -O0):
<def_version>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
jmp    110f <def_version+0xf>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @def_version(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 = %2
br label %6
6: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @def_version(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int x = 0x87654321;
  printf("%x\n", x & 0xFF);
  printf("%x\n", x ^ (~0xFF));
  printf("%x\n", x | 0xFF);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x87654321,-0x8(%rbp)
mov    -0x8(%rbp),%esi
and    $0xff,%esi
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
xor    $0xffffff00,%esi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
or     $0xff,%esi
lea    0xea0(%rip),%rdi
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
mov    $0x21,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x789abc21,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x876543ff,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 -2023406815, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %2
%7 = xor i32 %6, -256
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %2
%10 = or i32 %9, 255
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%x\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 33)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 2023406625)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 -2023406593)
ret i32 0
}
/* Variables and functions */
int querycns(int, int, int, int /*<<< orphan*/, int /*<<< orphan*/ *);
int getcns(int oid) {
  return querycns(((1 << 0) | (1 << 1)), oid, 0x01, 0, NULL);
}


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

x86 assembly (clang, -O2):
<getcns>:
mov    %edi,%esi
mov    $0x3,%edi
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
jmp    1030 <querycns@plt>

LLVM IR (-O0):
define i32 @getcns(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @querycns(i32 3, i32 %3, i32 1, i32 0, i32* null)
ret i32 %4
}

LLVM IR (-O2):
define i32 @getcns(i32 %0) {
%2 = tail call i32 @querycns(i32 3, i32 %0, i32 1, i32 0, i32* null)
ret i32 %2
}
void motion_test10(int *data) {
  int j;
  int p = data[1];
  int i = data[0];
  do {
    if (p)
      j = 1;
    else
      j = 2;
    i = i + j;
    data[data[2]] = 2;
  } while (i < data[3]);
}


x86 assembly (clang, -O0):
<motion_test10>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1131 <motion_test10+0x31>
movl   $0x1,-0xc(%rbp)
jmp    1138 <motion_test10+0x38>
movl   $0x2,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq 0x8(%rcx),%rcx
movl   $0x2,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    0xc(%rcx),%eax
jl     111b <motion_test10+0x1b>
pop    %rbp
ret

x86 assembly (clang, -O2):
<motion_test10>:
cmpl   $0x1,0x4(%rdi)
mov    (%rdi),%eax
mov    $0x1,%ecx
adc    $0x0,%ecx
xchg   %ax,%ax
add    %ecx,%eax
movslq 0x8(%rdi),%rdx
movl   $0x2,(%rdi,%rdx,4)
cmp    0xc(%rdi),%eax
jl     1110 <motion_test10+0x10>
ret

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

LLVM IR (-O2):
define void @motion_test10(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
%4 = load i32, i32* %0
%5 = icmp eq i32 %3, 0
%6 = select i1 %5, i32 2, i32 1
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = getelementptr inbounds i32, i32* %0, i64 3
br label %9
9: ; preds = %9, %1
%10 = phi i32 [ %4, %1 ], [ %11, %9 ]
%11 = add nsw i32 %10, %6
%12 = load i32, i32* %7
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %0, i64 %13
store i32 2, i32* %14
%15 = load i32, i32* %8
%16 = icmp slt i32 %11, %15
br i1 %16, label %9, label %17
17: ; preds = %9
ret void
}
void *XSharpPCFCreateImage(unsigned char *data, unsigned long length) {
  return 0;
}


x86 assembly (clang, -O0):
<XSharpPCFCreateImage>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @XSharpPCFCreateImage(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @XSharpPCFCreateImage(i8* nocapture readnone %0, i64 %1) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void newline(void) {
  printf("\n");
  return;
}


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

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

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @newline() {
%1 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @newline() {
%1 = tail call i32 @putchar(i32 10)
ret void
}
__attribute__((visibility("default"))) short int echo_short(short int arg,
                                                            ...) {
  return arg;
}


x86 assembly (clang, -O0):
<echo_short>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%ax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i16 @echo_short(i16 signext %0, ...) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
ret i16 %3
}

LLVM IR (-O2):
define signext i16 @echo_short(i16 returned signext %0, ...) {
ret i16 %0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ SYS_gettid;
int /*<<< orphan*/ syscall(int /*<<< orphan*/);
uint32_t gettid() { return syscall(SYS_gettid); }


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

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

LLVM IR (-O0):
@SYS_gettid = global i32 0
define i32 @gettid() {
%1 = load i32, i32* @SYS_gettid
%2 = call i32 @syscall(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@SYS_gettid = global i32 0
define i32 @gettid() {
%1 = load i32, i32* @SYS_gettid
%2 = tail call i32 @syscall(i32 %1)
ret i32 %2
}
/* Variables and functions */
unsigned int Predictor(unsigned int const, unsigned int const *);
int main(void) {
  const unsigned top[2] = {0xff7a7a7a, 0xff7a7a7a};
  const unsigned left = 0xff7b7b7b;
  const unsigned pred = Predictor(left, top);
  if (pred == left)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0xc(%rbp)
movl   $0xff7b7b7b,-0x10(%rbp)
lea    -0xc(%rbp),%rsi
mov    $0xff7b7b7b,%edi
call   1030 <Predictor@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xff7b7b7b,-0x14(%rbp)
jne    115b <main+0x4b>
movl   $0x0,-0x4(%rbp)
jmp    1162 <main+0x52>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movabs $0xff7a7a7aff7a7a7a,%rax
7a 7a ff
mov    %rax,(%rsp)
mov    %rsp,%rsi
mov    $0xff7b7b7b,%edi
call   1030 <Predictor@plt>
xor    %ecx,%ecx
cmp    $0xff7b7b7b,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.top = [2 x i32] [i32 -8750470, i32 -8750470]
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [2 x i32]* %2 to i8*
store i32 -8684677, i32* %3
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%7 = call i32 @Predictor(i32 -8684677, i32* %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, -8684677
br i1 %9, label %10, label %11
10: ; preds = %0
store i32 0, i32* %1
br label %12
11: ; preds = %0
store i32 1, i32* %1
br label %12
12: ; preds = %11, %10
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 -37582978188412294, i64* %1
%3 = bitcast i64* %1 to i32*
%4 = call i32 @Predictor(i32 -8684677, i32* %3)
%5 = icmp ne i32 %4, -8684677
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef unsigned char ulong;
typedef unsigned char u2;
typedef unsigned char u1;

/* Variables and functions */
ulong endian2(unsigned char u1, unsigned char u2, int endian) {
  if (endian)
    return ((u1 << 8) & 0xFF00) | ((u2)&0xFF);
  else
    return ((u2 << 8) & 0xFF00) | ((u1)&0xFF);
}


x86 assembly (clang, -O0):
<endian2>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    %edx,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     113d <endian2+0x3d>
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
and    $0xff00,%eax
movzbl -0x3(%rbp),%ecx
and    $0xff,%ecx
or     %ecx,%eax
mov    %al,-0x1(%rbp)
jmp    1158 <endian2+0x58>
movzbl -0x3(%rbp),%eax
shl    $0x8,%eax
and    $0xff00,%eax
movzbl -0x2(%rbp),%ecx
and    $0xff,%ecx
or     %ecx,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<endian2>:
mov    %edi,%eax
test   %edx,%edx
cmovne %esi,%eax
ret

LLVM IR (-O0):
define zeroext i8 @endian2(i8 zeroext %0, i8 zeroext %1, i32 %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i32
store i8 %0, i8* %5
store i8 %1, i8* %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %3
%11 = load i8, i8* %5
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = and i32 %13, 65280
%15 = load i8, i8* %6
%16 = zext i8 %15 to i32
%17 = and i32 %16, 255
%18 = or i32 %14, %17
%19 = trunc i32 %18 to i8
store i8 %19, i8* %4
br label %30
20: ; preds = %3
%21 = load i8, i8* %6
%22 = zext i8 %21 to i32
%23 = shl i32 %22, 8
%24 = and i32 %23, 65280
%25 = load i8, i8* %5
%26 = zext i8 %25 to i32
%27 = and i32 %26, 255
%28 = or i32 %24, %27
%29 = trunc i32 %28 to i8
store i8 %29, i8* %4
br label %30
30: ; preds = %20, %10
%31 = load i8, i8* %4
ret i8 %31
}

LLVM IR (-O2):
define zeroext i8 @endian2(i8 zeroext %0, i8 zeroext %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = select i1 %4, i8 %0, i8 %1
ret i8 %5
}
void megalog_boot_init(flags) int flags;
{}


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

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

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

LLVM IR (-O2):
define void @megalog_boot_init(i32 %0) {
ret void
}
void ignore_render(const char *to_render, void *data) {
  (void)data;
  (void)to_render;
}


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

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

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

LLVM IR (-O2):
define void @ignore_render(i8* nocapture %0, i8* nocapture %1) {
ret void
}
unsigned int combine_unbalanced_int(unsigned int a, unsigned int b) {
  return (a & 0xffffff00ll) | (b & 0x000000ffll);
}


x86 assembly (clang, -O0):
<combine_unbalanced_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
movabs $0xffffff00,%rcx
and    %rcx,%rax
mov    -0x8(%rbp),%ecx
and    $0xff,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<combine_unbalanced_int>:
and    $0xffffff00,%edi
movzbl %sil,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @combine_unbalanced_int(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = zext i32 %5 to i64
%7 = and i64 %6, 4294967040
%8 = load i32, i32* %4
%9 = zext i32 %8 to i64
%10 = and i64 %9, 255
%11 = or i64 %7, %10
%12 = trunc i64 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @combine_unbalanced_int(i32 %0, i32 %1) {
%3 = and i32 %0, -256
%4 = and i32 %1, 255
%5 = or i32 %4, %3
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void print_string(char *str) { printf("%s", str); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @print_string(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ stderr;
scalar_t__ umount(char *);
int umount_loopfs(char *target) {
  if (umount(target) != 0) {
    fprintf(stderr, "Cannot umount %s (error code %d)\n", target, errno);
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<umount_loopfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <umount@plt>
cmp    $0x0,%rax
je     116d <umount_loopfs+0x4d>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    0x2e85(%rip),%rax
mov    (%rax),%ecx
lea    0xea4(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1174 <umount_loopfs+0x54>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<umount_loopfs>:
push   %rbx
mov    %rdi,%rbx
call   1030 <umount@plt>
test   %rax,%rax
je     1156 <umount_loopfs+0x36>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
mov    0x2e9a(%rip),%rax
mov    (%rax),%ecx
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"Cannot umount %s (error code %d)\0A\00"
@errno = global i32 0
define i32 @umount_loopfs(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @umount(i8* %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %3
%10 = load i32, i32* @errno
%11 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %9, i32 %10)
store i32 -1, i32* %2
br label %13
12: ; preds = %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %7
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"Cannot umount %s (error code %d)\0A\00"
@errno = global i32 0
define i32 @umount_loopfs(i8* %0) {
%2 = tail call i64 @umount(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = load i32, i32* @errno
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %6)
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ -1, %4 ], [ 0, %1 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ write_mail_box(int, int, int);
void write_rmb(int index) {
  int right_index = (index + (5 - 1)) % 5;
  write_mail_box(true, right_index, true);
}


x86 assembly (clang, -O0):
<write_rmb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    $0x1,%edx
mov    %edx,%edi
call   1030 <write_mail_box@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_rmb>:
add    $0x4,%edi
movslq %edi,%rsi
imul   $0x66666667,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
mov    $0x1,%edi
mov    $0x1,%edx
jmp    1030 <write_mail_box@plt>

LLVM IR (-O0):
define void @write_rmb(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 4
%6 = srem i32 %5, 5
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @write_mail_box(i32 1, i32 %7, i32 1)
ret void
}

LLVM IR (-O2):
define void @write_rmb(i32 %0) {
%2 = add nsw i32 %0, 4
%3 = srem i32 %2, 5
%4 = tail call i32 @write_mail_box(i32 1, i32 %3, i32 1)
ret void
}
int isspace(int c) { return (c > 8 && c < 14) || c == ' '; }


x86 assembly (clang, -O0):
<isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x8,-0x4(%rbp)
jle    1120 <isspace+0x20>
mov    $0x1,%al
cmpl   $0xe,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     112a <isspace+0x2a>
cmpl   $0x20,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isspace>:
lea    -0x9(%rdi),%eax
cmp    $0x5,%eax
setb   %al
cmp    $0x20,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @isspace(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 8
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 14
br i1 %7, label %11, label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 32
br label %11
11: ; preds = %8, %5
%12 = phi i1 [ true, %5 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @isspace(i32 %0) {
%2 = add i32 %0, -9
%3 = icmp ult i32 %2, 5
%4 = icmp eq i32 %0, 32
%5 = or i1 %4, %3
%6 = zext i1 %5 to i32
ret i32 %6
}
char *strcpy(char *dest, const char *src) {
  char *p = dest;
  while (*src) {
    *p++ = *src++;
  }
  *p = '\0';
  return dest;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1148 <strcpy+0x48>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    1114 <strcpy+0x14>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
mov    %rdi,%rdx
test   %cl,%cl
je     1131 <strcpy+0x31>
add    $0x1,%rsi
mov    %rax,%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %cl,(%rdx)
add    $0x1,%rdx
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1120 <strcpy+0x20>
movb   $0x0,(%rdx)
ret

LLVM IR (-O0):
define i8* @strcpy(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 = %11, %2
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %4
%14 = load i8, i8* %12
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %5
store i8 %14, i8* %15
br label %7
17: ; preds = %7
%18 = load i8*, i8** %5
store i8 0, i8* %18
%19 = load i8*, i8** %3
ret i8* %19
}

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %10, %5 ], [ %0, %2 ]
%8 = phi i8* [ %9, %5 ], [ %1, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %6, i8* %7
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %0, %2 ], [ %10, %5 ]
store i8 0, i8* %14
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void gmp_default_free(void *p, size_t size __attribute__((unused))) { free(p); }


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

x86 assembly (clang, -O2):
<gmp_default_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @gmp_default_free(i8* nocapture %0, i64 %1) {
%3 = tail call i32 @free(i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char const *, char const *);
FILE *fopen64(const char *filename, const char *mode) {
  return fopen(filename, mode);
}


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

x86 assembly (clang, -O2):
<fopen64>:
jmp    1030 <fopen@plt>

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

LLVM IR (-O2):
define noalias i32* @fopen64(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* %1)
ret i32* %3
}
void lib_init() {}


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

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

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

LLVM IR (-O2):
define void @lib_init() {
ret void
}
void cswap(char *value1, char *value2) {
  char interim1;
  interim1 = *value1;
  *value1 = *value2;
  *value2 = interim1;
}


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

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

LLVM IR (-O0):
define void @cswap(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
%7 = load i8, i8* %6
store i8 %7, i8* %5
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = load i8*, i8** %3
store i8 %9, i8* %10
%11 = load i8, i8* %5
%12 = load i8*, i8** %4
store i8 %11, i8* %12
ret void
}

LLVM IR (-O2):
define void @cswap(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
store i8 %4, i8* %0
store i8 %3, i8* %1
ret void
}
int inrange(int x, int low, int high) {
  int inrange = 0;
  if (x >= low && x <= high) {
    inrange = 1;
  }
  return inrange;
}


x86 assembly (clang, -O0):
<inrange>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1133 <inrange+0x33>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1133 <inrange+0x33>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inrange>:
cmp    %esi,%edi
setge  %al
cmp    %edx,%edi
setle  %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @inrange(i32 %0, i32 %1, i32 %2) {
%4 = icmp sge i32 %0, %1
%5 = icmp sle i32 %0, %2
%6 = and i1 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
void *thread2(void *arg) { return NULL; }


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

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

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

LLVM IR (-O2):
define noalias i8* @thread2(i8* nocapture readnone %0) {
ret i8* null
}