xunge/DecIR huggingface dataset:
unsigned int rjhash(unsigned int a) {
  a = (a + 0x7ed55d16) + (a << 12);
  a = (a ^ 0xc761c23c) ^ (a >> 19);
  a = (a + 0x165667b1) + (a << 5);
  a = (a + 0xd3a2646c) ^ (a << 9);
  a = (a + 0xfd7046c5) + (a << 3);
  a = (a ^ 0xb55a4f09) ^ (a >> 16);
  return a;
}


x86 assembly (clang, -O0):
<rjhash>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x7ed55d16,%eax
mov    -0x4(%rbp),%ecx
shl    $0xc,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xc761c23c,%eax
mov    -0x4(%rbp),%ecx
shr    $0x13,%ecx
xor    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x165667b1,%eax
mov    -0x4(%rbp),%ecx
shl    $0x5,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xd3a2646c,%eax
mov    -0x4(%rbp),%ecx
shl    $0x9,%ecx
xor    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xfd7046c5,%eax
mov    -0x4(%rbp),%ecx
shl    $0x3,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xb55a4f09,%eax
mov    -0x4(%rbp),%ecx
shr    $0x10,%ecx
xor    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rjhash>:
mov    %edi,%eax
shl    $0xc,%eax
add    %edi,%eax
add    $0x7ed55d16,%eax
mov    %eax,%ecx
shr    $0x13,%ecx
xor    %eax,%ecx
xor    $0xc761c23c,%ecx
mov    %ecx,%eax
shl    $0x5,%eax
lea    (%rcx,%rax,1),%edx
shl    $0x9,%edx
add    %ecx,%eax
add    $0xe9f8cc1d,%eax
add    $0xaccf6200,%edx
xor    %eax,%edx
lea    (%rdx,%rdx,8),%ecx
add    $0xfd7046c5,%ecx
mov    %ecx,%eax
shr    $0x10,%eax
xor    %ecx,%eax
xor    $0xb55a4f09,%eax
ret

LLVM IR (-O0):
define i32 @rjhash(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 %3, 2127912214
%5 = load i32, i32* %2
%6 = shl i32 %5, 12
%7 = add i32 %4, %6
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = xor i32 %8, -949894596
%10 = load i32, i32* %2
%11 = lshr i32 %10, 19
%12 = xor i32 %9, %11
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = add i32 %13, 374761393
%15 = load i32, i32* %2
%16 = shl i32 %15, 5
%17 = add i32 %14, %16
store i32 %17, i32* %2
%18 = load i32, i32* %2
%19 = add i32 %18, -744332180
%20 = load i32, i32* %2
%21 = shl i32 %20, 9
%22 = xor i32 %19, %21
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = add i32 %23, -42973499
%25 = load i32, i32* %2
%26 = shl i32 %25, 3
%27 = add i32 %24, %26
store i32 %27, i32* %2
%28 = load i32, i32* %2
%29 = xor i32 %28, -1252372727
%30 = load i32, i32* %2
%31 = lshr i32 %30, 16
%32 = xor i32 %29, %31
store i32 %32, i32* %2
%33 = load i32, i32* %2
ret i32 %33
}

LLVM IR (-O2):
define i32 @rjhash(i32 %0) {
%2 = add i32 %0, 2127912214
%3 = shl i32 %0, 12
%4 = add i32 %2, %3
%5 = lshr i32 %4, 19
%6 = xor i32 %4, %5
%7 = xor i32 %6, -949894596
%8 = add i32 %7, 374761393
%9 = shl i32 %7, 5
%10 = add i32 %8, %9
%11 = add i32 %10, -744332180
%12 = shl i32 %10, 9
%13 = xor i32 %11, %12
%14 = add i32 %13, -42973499
%15 = shl i32 %13, 3
%16 = add i32 %14, %15
%17 = lshr i32 %16, 16
%18 = xor i32 %16, %17
%19 = xor i32 %18, -1252372727
ret i32 %19
}
void updateMotors() {}


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

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

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

LLVM IR (-O2):
define void @updateMotors() {
ret void
}
void turn_on_buzzer(void) {
  (*(volatile unsigned int *)(0x7F0080A4)) |= (1 << 15);
  return;
}


x86 assembly (clang, -O0):
<turn_on_buzzer>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7f0080a4,%eax
mov    (%rax),%ecx
or     $0x8000,%ecx
mov    $0x7f0080a4,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<turn_on_buzzer>:
orl    $0x8000,0x7f0080a4
ret

LLVM IR (-O0):
define void @turn_on_buzzer() {
%1 = load volatile i32, i32* inttoptr (i64 2130739364 to i32*)
%2 = or i32 %1, 32768
store volatile i32 %2, i32* inttoptr (i64 2130739364 to i32*)
ret void
}

LLVM IR (-O2):
define void @turn_on_buzzer() {
%1 = load volatile i32, i32* inttoptr (i64 2130739364 to i32*)
%2 = or i32 %1, 32768
store volatile i32 %2, i32* inttoptr (i64 2130739364 to i32*)
ret void
}
/* Variables and functions */
char *calloc(int, int);
int rand();
int /*<<< orphan*/ strcpy(char *, char *);
char *fn104() {
  char *result;
  result = calloc(5 + rand() % 5, 4);
  strcpy((char *)result, "fn104");
  return result;
}


x86 assembly (clang, -O0):
<fn104>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x5,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn104>:
push   %rbx
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x5,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
lea    0xe93(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"fn104\00"
define i8* @fn104() {
%1 = alloca i8*
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 5
%4 = add nsw i32 5, %3
%5 = call i8* @calloc(i32 %4, i32 4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %1
ret i8* %8
}

LLVM IR (-O2):
@.str = [6 x i8] c"fn104\00"
define i8* @fn104() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 5
%3 = add nsw i32 %2, 5
%4 = tail call i8* @calloc(i32 %3, i32 4)
%5 = tail call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i8* %4
}
int jac_chain_nm8_free(void *mem) {
  (void)mem;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @jac_chain_nm8_free(i8* nocapture readnone %0) {
ret i32 0
}
int strerror() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @strerror() {
ret i32 0
}
/* Variables and functions */
int readname_loop(char *, int, char **, char *, size_t, int);
int readname(char *packet, int packetlen, char **src, char *dst,
             size_t length) {
  return readname_loop(packet, packetlen, src, dst, length, 10);
}


x86 assembly (clang, -O0):
<readname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    $0xa,%r9d
call   1030 <readname_loop@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readname>:
mov    $0xa,%r9d
jmp    1030 <readname_loop@plt>

LLVM IR (-O0):
define i32 @readname(i8* %0, i32 %1, i8** %2, i8* %3, i64 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i8*
%10 = alloca i64
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8** %2, i8*** %8
store i8* %3, i8** %9
store i64 %4, i64* %10
%11 = load i8*, i8** %6
%12 = load i32, i32* %7
%13 = load i8**, i8*** %8
%14 = load i8*, i8** %9
%15 = load i64, i64* %10
%16 = call i32 @readname_loop(i8* %11, i32 %12, i8** %13, i8* %14, i64 %15, i32 10)
ret i32 %16
}

LLVM IR (-O2):
define i32 @readname(i8* %0, i32 %1, i8** %2, i8* %3, i64 %4) {
%6 = tail call i32 @readname_loop(i8* %0, i32 %1, i8** %2, i8* %3, i64 %4, i32 10)
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ getLine(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ printf(char *);
int main() {
  char buf[1000];
  printf("Hello world\n");
  FILE *fptr = fopen("aa.txt", "r");
  getLine(fptr, buf, sizeof(buf));
  printf(buf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    0xeb8(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x3f8(%rbp)
mov    -0x3f8(%rbp),%rdi
lea    -0x3f0(%rbp),%rsi
mov    $0x3e8,%edx
call   1050 <getLine@plt>
lea    -0x3f0(%rbp),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x3f0,%rsp
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
lea    0xea5(%rip),%rdi
lea    0xea5(%rip),%rsi
call   1050 <fopen@plt>
mov    %rsp,%rbx
mov    %rax,%rdi
mov    %rbx,%rsi
mov    $0x3e8,%edx
call   1060 <getLine@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello world\0A\00"
@.str.1 = [7 x i8] c"aa.txt\00"
@.str.2 = [2 x i8] c"r\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i8]
%3 = alloca i32*
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%5 = call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%8 = call i32 @getLine(i32* %6, i8* %7, i32 1000)
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%10 = call i32 @printf(i8* %9)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"aa.txt\00"
@.str.2 = [2 x i8] c"r\00"
@str = [12 x i8] c"Hello world\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @getLine(i32* %4, i8* %2, i32 1000)
%6 = call i32 @printf(i8* %2)
ret i32 0
}
int ardilla(void) {
  int algo = 3;
  return algo;
}


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

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

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

LLVM IR (-O2):
define i32 @ardilla() {
ret i32 3
}
/* Variables and functions */
float fastersinfull(float);
float fastercosfull(float x) {
  static const float halfpi = 1.5707963267948966f;
  return fastersinfull(x + halfpi);
}


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

x86 assembly (clang, -O2):
<fastercosfull>:
addss  0xee8(%rip),%xmm0
jmp    1030 <fastersinfull@plt>

LLVM IR (-O0):
@fastercosfull.halfpi = internal constant float 0x3FF921FB60000000
define float @fastercosfull(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fadd float %3, 0x3FF921FB60000000
%5 = call float @fastersinfull(float %4)
ret float %5
}

LLVM IR (-O2):
define float @fastercosfull(float %0) {
%2 = fadd float %0, 0x3FF921FB60000000
%3 = tail call float @fastersinfull(float %2)
ret float %3
}
/* Variables and functions */
float cos(float);
float COS(float x) { return cos(x); }


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

x86 assembly (clang, -O2):
<COS>:
jmp    1030 <cos@plt>

LLVM IR (-O0):
define float @COS(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @cos(float %3)
ret float %4
}

LLVM IR (-O2):
define float @COS(float %0) {
%2 = tail call float @cos(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ convert(char *);
int main(int argc, char **argv) {
  convert(argv[1]);
  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    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <convert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1030 <convert@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 i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @convert(i8* %8)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @convert(i8* %4)
ret i32 0
}
int sectors(int nbytes) {
  int nsectors = nbytes / 2048;
  if (nbytes % 2048 > 0)
    nsectors += 1;
  return nsectors;
}


x86 assembly (clang, -O0):
<sectors>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x800,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x800,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jle    1132 <sectors+0x32>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sectors>:
lea    0x7ff(%rdi),%ecx
test   %edi,%edi
cmovns %edi,%ecx
sar    $0xb,%ecx
xor    %eax,%eax
test   $0x800007ff,%edi
setg   %al
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @sectors(i32 %0) {
%2 = sdiv i32 %0, 2048
%3 = and i32 %0, -2147481601
%4 = icmp sgt i32 %3, 0
%5 = zext i1 %4 to i32
%6 = add nsw i32 %2, %5
ret i32 %6
}
void OnVIDBRC_SetFullScreen(int fullscreenparam) {}


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

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

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

LLVM IR (-O2):
define void @OnVIDBRC_SetFullScreen(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ idct_M128ASM_scalar(short *);
void idct(short *block) {
  {
    idct_M128ASM_scalar(block);
    return;
  }
}


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

x86 assembly (clang, -O2):
<idct>:
jmp    1030 <idct_M128ASM_scalar@plt>

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

LLVM IR (-O2):
define void @idct(i16* %0) {
%2 = tail call i32 @idct_M128ASM_scalar(i16* %0)
ret void
}
/* Variables and functions */
unsigned long get_variable(int /*<<< orphan*/);
int /*<<< orphan*/ intern(char *);
unsigned long toi_funcall(unsigned long, int /*<<< orphan*/, int,
                          unsigned long);
unsigned long int kernel_puts(unsigned long int recv, unsigned long int arg) {
  unsigned long int out;
  out = get_variable(intern("stdout"));
  return toi_funcall(out, intern("puts"), 1, arg);
}


x86 assembly (clang, -O0):
<kernel_puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb9(%rip),%rdi
call   1050 <intern@plt>
mov    %eax,%edi
call   1040 <get_variable@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xea1(%rip),%rdi
call   1050 <intern@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
mov    -0x10(%rbp),%rcx
mov    $0x1,%edx
call   1030 <toi_funcall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_puts>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
lea    0xec2(%rip),%rdi
call   1050 <intern@plt>
mov    %eax,%edi
call   1040 <get_variable@plt>
mov    %rax,%rbx
lea    0xeb3(%rip),%rdi
call   1050 <intern@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x1,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <toi_funcall@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"stdout\00"
@.str.1 = [5 x i8] c"puts\00"
define i64 @kernel_puts(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = call i32 @intern(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = call i64 @get_variable(i32 %6)
store i64 %7, i64* %5
%8 = load i64, i64* %5
%9 = call i32 @intern(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%10 = load i64, i64* %4
%11 = call i64 @toi_funcall(i64 %8, i32 %9, i32 1, i64 %10)
ret i64 %11
}

LLVM IR (-O2):
@.str = [7 x i8] c"stdout\00"
@.str.1 = [5 x i8] c"puts\00"
define i64 @kernel_puts(i64 %0, i64 %1) {
%3 = tail call i32 @intern(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = tail call i64 @get_variable(i32 %3)
%5 = tail call i32 @intern(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i64 @toi_funcall(i64 %4, i32 %5, i32 1, i64 %1)
ret i64 %6
}
double _neg(double a) { return -a; }


x86 assembly (clang, -O0):
<_neg>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_neg>:
xorps  0xef9(%rip),%xmm0
ret

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

LLVM IR (-O2):
define double @_neg(double %0) {
%2 = fneg double %0
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ rmdir(char const *);
int slate_DeleteDirectory(const char *dirname) { return !rmdir(dirname); }


x86 assembly (clang, -O0):
<slate_DeleteDirectory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <rmdir@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slate_DeleteDirectory>:
push   %rax
call   1030 <rmdir@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @slate_DeleteDirectory(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @rmdir(i8* %3)
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @slate_DeleteDirectory(i8* nocapture %0) {
%2 = tail call i32 @rmdir(i8* %0)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
int bsr(int i) {
  int r, t;
  asm("bsr %1,%0\n\t" : "=&q"(r), "=&q"(t) : "1"(i) : "cc");
  return r;
}


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

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

LLVM IR (-O0):
define i32 @bsr(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call { i32, i32 } asm "bsr $1,$0\0A\09", "=&q,=&q,1,~{cc},~{dirflag},~{fpsr},~{flags}"(i32 %5)
%7 = extractvalue { i32, i32 } %6, 0
%8 = extractvalue { i32, i32 } %6, 1
store i32 %7, i32* %3
store i32 %8, i32* %4
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @bsr(i32 %0) {
%2 = tail call { i32, i32 } asm "bsr $1,$0\0A\09", "=&q,=&q,1,~{cc},~{dirflag},~{fpsr},~{flags}"(i32 %0)
%3 = extractvalue { i32, i32 } %2, 0
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
void nj_tree(char **tree_description, FILE *tree) {
  void fast_nj_tree(char **tree_description, FILE *tree);
  fast_nj_tree(tree_description, tree);
}


x86 assembly (clang, -O0):
<nj_tree>:
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 <fast_nj_tree@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nj_tree>:
jmp    1030 <fast_nj_tree@plt>

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

LLVM IR (-O2):
define void @nj_tree(i8** %0, i32* %1) {
tail call void @fast_nj_tree(i8** %0, i32* %1)
ret void
}
void test___atomic_nand_fetch_0(char *mem) { __atomic_nand_fetch(mem, -1, 4); }


x86 assembly (clang, -O0):
<test___atomic_nand_fetch_0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movb   $0xff,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    %cl,-0xc(%rbp)
mov    (%rax),%al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%al
mov    -0x18(%rbp),%rcx
mov    -0xc(%rbp),%sil
mov    %al,%dl
and    %sil,%dl
mov    %dl,-0x1a(%rbp)
not    %dl
lock cmpxchg %dl,(%rcx)
sete   %cl
mov    %al,-0x19(%rbp)
test   $0x1,%cl
mov    %al,-0xb(%rbp)
jne    114f <test___atomic_nand_fetch_0+0x4f>
jmp    111f <test___atomic_nand_fetch_0+0x1f>
mov    -0xc(%rbp),%cl
mov    -0x19(%rbp),%al
and    %cl,%al
xor    $0xff,%al
mov    %al,-0xa(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test___atomic_nand_fetch_0>:
mov    (%rdi),%al
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%ecx
not    %cl
lock cmpxchg %cl,(%rdi)
jne    1110 <test___atomic_nand_fetch_0+0x10>
ret

LLVM IR (-O0):
define void @test___atomic_nand_fetch_0(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i8
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8 -1, i8* %3
%6 = load i8, i8* %3
%7 = atomicrmw nand i8* %5, i8 %6 acq_rel
%8 = and i8 %7, %6
%9 = xor i8 %8, -1
store i8 %9, i8* %4
%10 = load i8, i8* %4
ret void
}

LLVM IR (-O2):
define void @test___atomic_nand_fetch_0(i8* nocapture %0) {
%2 = atomicrmw nand i8* %0, i8 -1 acq_rel
ret void
}
/* Variables and functions */
size_t findEmpty(size_t *shared, size_t size) {
  size_t i;
  for (i = 0; i < size; i++) {
    if (shared[i] == 0) {
      return i;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<findEmpty>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1158 <findEmpty+0x58>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    1142 <findEmpty+0x42>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1160 <findEmpty+0x60>
jmp    1147 <findEmpty+0x47>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1114 <findEmpty+0x14>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<findEmpty>:
mov    $0xffffffffffffffff,%rax
test   %rsi,%rsi
je     1120 <findEmpty+0x20>
xor    %ecx,%ecx
xchg   %ax,%ax
cmpq   $0x0,(%rdi,%rcx,8)
je     1121 <findEmpty+0x21>
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1110 <findEmpty+0x10>
ret
mov    %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @findEmpty(i64* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2, %9
%5 = phi i64 [ %10, %9 ], [ 0, %2 ]
%6 = getelementptr inbounds i64, i64* %0, i64 %5
%7 = load i64, i64* %6
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = add nuw i64 %5, 1
%11 = icmp eq i64 %10, %1
br i1 %11, label %12, label %4
12: ; preds = %4, %9, %2
%13 = phi i64 [ -1, %2 ], [ -1, %9 ], [ %5, %4 ]
ret i64 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
time_t utl_time_time(void) { return time(NULL); }


x86 assembly (clang, -O0):
<utl_time_time>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<utl_time_time>:
xor    %edi,%edi
jmp    1030 <time@plt>

LLVM IR (-O0):
define i32 @utl_time_time() {
%1 = call i32 @time(i32* null)
ret i32 %1
}

LLVM IR (-O2):
define i32 @utl_time_time() {
%1 = tail call i32 @time(i32* null)
ret i32 %1
}
int min(int a, int b, int c, int d) {
  int min = a;
  int num[4] = {a, b, c, d};
  for (int i = 0; i < 4; ++i) {
    if (num[i] < min) {
      min = num[i];
    }
  }
  return min;
}


x86 assembly (clang, -O0):
<min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x4,-0x34(%rbp)
jge    116e <min+0x6e>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x14(%rbp),%eax
jge    115b <min+0x5b>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x14(%rbp)
jmp    1160 <min+0x60>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1135 <min+0x35>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min>:
mov    %edi,%eax
cmp    %edi,%esi
cmovl  %esi,%eax
cmp    %edx,%eax
cmovg  %edx,%eax
cmp    %ecx,%eax
cmovg  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @min(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp slt i32 %1, %0
%6 = select i1 %5, i32 %1, i32 %0
%7 = icmp sgt i32 %6, %2
%8 = select i1 %7, i32 %2, i32 %6
%9 = icmp sgt i32 %8, %3
%10 = select i1 %9, i32 %3, i32 %8
ret i32 %10
}
int test_imm_5Duint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x5D << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_5Duint64_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, 93
%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_5Duint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 6094848
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
unsigned char strlen(char *string) {
  unsigned char position = 0;
  while (string[position] != '\0') {
    position++;
  }
  return position;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movzbl -0x9(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     112e <strlen+0x2e>
mov    -0x9(%rbp),%al
add    $0x1,%al
mov    %al,-0x9(%rbp)
jmp    110c <strlen+0xc>
movzbl -0x9(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xff,%al
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%al
movzbl %al,%ecx
cmpb   $0x0,(%rdi,%rcx,1)
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define zeroext i8 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8 [ 0, %1 ], [ %8, %2 ]
%4 = zext i8 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = add i8 %3, 1
br i1 %7, label %9, label %2
9: ; preds = %2
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void clrscreen(void) {
  printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
}


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

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

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

LLVM IR (-O2):
@str = [25 x i8] c"\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\00"
define void @clrscreen() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int __u8;

/* Variables and functions */
int is_multicast_ether_addr(const void *addr) {
  return (0x01 & *(const __u8 *)addr);
}


x86 assembly (clang, -O0):
<is_multicast_ether_addr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @is_multicast_ether_addr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = and i32 1, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @is_multicast_ether_addr(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = and i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int fabs(double);
double sin(double);
double sinc(double x) { return fabs(x) < 1e-8 ? 1.0 : sin(x) / x; }


x86 assembly (clang, -O0):
<sinc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xebd(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    115f <sinc+0x3f>
movsd  0xeb3(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1173 <sinc+0x53>
movsd  -0x8(%rbp),%xmm0
call   1040 <sin@plt>
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinc>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <fabs@plt>
test   %eax,%eax
jle    1140 <sinc+0x20>
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
divsd  (%rsp),%xmm0
pop    %rax
ret
movsd  0xeb8(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @sinc(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @fabs(double %3)
%5 = sitofp i32 %4 to double
%6 = fcmp olt double %5, 1.000000e-08
br i1 %6, label %7, label %8
7: ; preds = %1
br label %13
8: ; preds = %1
%9 = load double, double* %2
%10 = call double @sin(double %9)
%11 = load double, double* %2
%12 = fdiv double %10, %11
br label %13
13: ; preds = %8, %7
%14 = phi double [ 1.000000e+00, %7 ], [ %12, %8 ]
ret double %14
}

LLVM IR (-O2):
define double @sinc(double %0) {
%2 = tail call i32 @fabs(double %0)
%3 = icmp slt i32 %2, 1
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call double @sin(double %0)
%6 = fdiv double %5, %0
br label %7
7: ; preds = %1, %4
%8 = phi double [ %6, %4 ], [ 1.000000e+00, %1 ]
ret double %8
}
/* Variables and functions */
int /*<<< orphan*/ cube_by_reference(int *);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int number = 5;
  printf("The original value of number is %d\n", number);
  cube_by_reference(&number);
  printf("The new value of number is %d\n", number);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x5,0x4(%rsp)
lea    0xed0(%rip),%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
lea    0x4(%rsp),%rdi
call   1040 <cube_by_reference@plt>
mov    0x4(%rsp),%esi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"The original value of number is %d\0A\00"
@.str.1 = [31 x i8] c"The new value of number is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @cube_by_reference(i32* %2)
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"The original value of number is %d\0A\00"
@.str.1 = [31 x i8] c"The new value of number is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 5, i32* %1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 5)
%4 = call i32 @cube_by_reference(i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
unsigned char strlen(char *);
unsigned char rs485checksumByte(unsigned char *str) {
  unsigned char result = 0;
  unsigned char b;
  for (b = 0; b < strlen((char *)str); b++)
    result += str[b];
  return result;
}


x86 assembly (clang, -O0):
<rs485checksumByte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
movb   $0x0,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %al,%cl
mov    -0x10(%rbp),%eax
movzbl %cl,%ecx
cmp    %ecx,%eax
jge    1166 <rs485checksumByte+0x56>
mov    -0x8(%rbp),%rax
movzbl -0xa(%rbp),%ecx
movzbl (%rax,%rcx,1),%ecx
movzbl -0x9(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x9(%rbp)
mov    -0xa(%rbp),%al
add    $0x1,%al
mov    %al,-0xa(%rbp)
jmp    1124 <rs485checksumByte+0x14>
movzbl -0x9(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rs485checksumByte>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %al,%al
je     114a <rs485checksumByte+0x3a>
xor    %ebx,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    (%r14,%rbx,1),%bpl
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
movzbl %al,%eax
cmp    %rax,%rbx
jb     1130 <rs485checksumByte+0x20>
jmp    114c <rs485checksumByte+0x3c>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define zeroext i8 @rs485checksumByte(i8* %0) {
%2 = tail call zeroext i8 @strlen(i8* %0)
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %10, %4 ], [ 0, %1 ]
%6 = phi i8 [ %9, %4 ], [ 0, %1 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %5
%8 = load i8, i8* %7
%9 = add i8 %8, %6
%10 = add nuw nsw i64 %5, 1
%11 = tail call zeroext i8 @strlen(i8* %0)
%12 = zext i8 %11 to i64
%13 = icmp ult i64 %10, %12
br i1 %13, label %4, label %14
14: ; preds = %4, %1
%15 = phi i8 [ 0, %1 ], [ %9, %4 ]
ret i8 %15
}
/* Variables and functions */
int smcGetVariable(int, int /*<<< orphan*/);
int smcGetErrorStatus(int fd) { return smcGetVariable(fd, 0); }


x86 assembly (clang, -O0):
<smcGetErrorStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1030 <smcGetVariable@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smcGetErrorStatus>:
xor    %esi,%esi
jmp    1030 <smcGetVariable@plt>

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

LLVM IR (-O2):
define i32 @smcGetErrorStatus(i32 %0) {
%2 = tail call i32 @smcGetVariable(i32 %0, i32 0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
size_t wcsnlen(int /*<<< orphan*/ const *, size_t);
int /*<<< orphan*/ wmemmove(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                            size_t);
int /*<<< orphan*/ wmemset(int /*<<< orphan*/ *, int /*<<< orphan*/, size_t);
wchar_t *wcsnmove(wchar_t *whither, const wchar_t *whence, size_t maxlen) {
  size_t n = wcsnlen(whence, maxlen);
  wmemmove(whither, whence, n);
  wmemset(whither + n, 0, maxlen - n);
  return whither;
}


x86 assembly (clang, -O0):
<wcsnmove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <wcsnlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <wmemmove@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rdx
sub    -0x20(%rbp),%rdx
xor    %esi,%esi
call   1030 <wmemset@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcsnmove>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1050 <wcsnlen@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1040 <wmemmove@plt>
lea    (%r15,%rbx,4),%rdi
sub    %rbx,%r12
xor    %esi,%esi
mov    %r12,%rdx
call   1030 <wmemset@plt>
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32* @wcsnmove(i32* %0, i32* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i64
store i32* %0, i32** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
%8 = load i32*, i32** %5
%9 = load i64, i64* %6
%10 = call i64 @wcsnlen(i32* %8, i64 %9)
store i64 %10, i64* %7
%11 = load i32*, i32** %4
%12 = load i32*, i32** %5
%13 = load i64, i64* %7
%14 = call i32 @wmemmove(i32* %11, i32* %12, i64 %13)
%15 = load i32*, i32** %4
%16 = load i64, i64* %7
%17 = getelementptr inbounds i32, i32* %15, i64 %16
%18 = load i64, i64* %6
%19 = load i64, i64* %7
%20 = sub i64 %18, %19
%21 = call i32 @wmemset(i32* %17, i32 0, i64 %20)
%22 = load i32*, i32** %4
ret i32* %22
}

LLVM IR (-O2):
define i32* @wcsnmove(i32* returned %0, i32* %1, i64 %2) {
%4 = tail call i64 @wcsnlen(i32* %1, i64 %2)
%5 = tail call i32 @wmemmove(i32* %0, i32* %1, i64 %4)
%6 = getelementptr inbounds i32, i32* %0, i64 %4
%7 = sub i64 %2, %4
%8 = tail call i32 @wmemset(i32* %6, i32 0, i64 %7)
ret i32* %0
}
/* Variables and functions */
int _pack2(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ magnitude_fun_complexOf_short(unsigned int);
unsigned abs_fun_complexOf_short(unsigned a) {
  return _pack2(magnitude_fun_complexOf_short(a), 0);
}


x86 assembly (clang, -O0):
<abs_fun_complexOf_short>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <magnitude_fun_complexOf_short@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1030 <_pack2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs_fun_complexOf_short>:
push   %rax
call   1040 <magnitude_fun_complexOf_short@plt>
mov    %eax,%edi
xor    %esi,%esi
pop    %rax
jmp    1030 <_pack2@plt>

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

LLVM IR (-O2):
define i32 @abs_fun_complexOf_short(i32 %0) {
%2 = tail call i32 @magnitude_fun_complexOf_short(i32 %0)
%3 = tail call i32 @_pack2(i32 %2, i32 0)
ret i32 %3
}
void im_a_minion_03(void) {}


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

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

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

LLVM IR (-O2):
define void @im_a_minion_03() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void *printHello(void *threadid) {
  long tid;
  tid = (long)threadid;
  printf("Hello world! thread #%ld!\n", tid);
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<printHello>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printHello>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Hello world! thread #%ld!\0A\00"
define i8* @printHello(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i64
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 %7)
%9 = call i32 @pthread_exit(i32* null)
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [27 x i8] c"Hello world! thread #%ld!\0A\00"
define noalias i8* @printHello(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
void null_select(int mode) {}


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

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

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

LLVM IR (-O2):
define void @null_select(i32 %0) {
ret void
}
const char *ucdn_get_unicode_version(void) { return "6.2.0"; }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"6.2.0\00"
define i8* @ucdn_get_unicode_version() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"6.2.0\00"
define i8* @ucdn_get_unicode_version() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
void *t1(void *arg) {
  _Bool local_flag;
  local_flag = 0;
  local_flag = 1;
  assert(local_flag);
}


x86 assembly (clang, -O0):
<t1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
movb   $0x1,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t1>:
mov    $0x1,%edi
xor    %eax,%eax
jmp    1030 <assert@plt>

LLVM IR (-O0):
define i8* @t1(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 0, i8* %4
store i8 1, i8* %4
%5 = load i8, i8* %4
%6 = trunc i8 %5 to i1
%7 = zext i1 %6 to i32
%8 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %7)
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
define i8* @t1(i8* nocapture readnone %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
ret i8* undef
}