xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ autonext_aes();
double next_uniform_value() { return (double)autonext_aes() / 4294967295; }


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

x86 assembly (clang, -O2):
<next_uniform_value>:
push   %rax
xor    %eax,%eax
call   1030 <autonext_aes@plt>
cvtsi2sd %rax,%xmm0
divsd  0xedb(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @next_uniform_value() {
%1 = call i64 (...) @autonext_aes()
%2 = sitofp i64 %1 to double
%3 = fdiv double %2, 0x41EFFFFFFFE00000
ret double %3
}

LLVM IR (-O2):
define double @next_uniform_value() {
%1 = tail call i64 (...) @autonext_aes()
%2 = sitofp i64 %1 to double
%3 = fdiv double %2, 0x41EFFFFFFFE00000
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ cpuEOR();
int /*<<< orphan*/ cpuLSRt();
void cpuSRE() {
  cpuLSRt();
  cpuEOR();
}


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

x86 assembly (clang, -O2):
<cpuSRE>:
push   %rax
xor    %eax,%eax
call   1040 <cpuLSRt@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <cpuEOR@plt>

LLVM IR (-O0):
define void @cpuSRE() {
%1 = call i32 (...) @cpuLSRt()
%2 = call i32 (...) @cpuEOR()
ret void
}

LLVM IR (-O2):
define void @cpuSRE() {
%1 = tail call i32 (...) @cpuLSRt()
%2 = tail call i32 (...) @cpuEOR()
ret void
}
void timer_irq(void) {
  if (0 == 1) {
    *(volatile unsigned *)0x0A80000C = 0;
  } else {
    *(volatile unsigned *)0x03ff4004 = 1 << 10;
    *(volatile unsigned *)0x03ff6004 = 0x001ffff0;
    *(volatile int *)(volatile unsigned *)0x03ff4008 &=
        ~((1 << 21) | (1 << 10) | (1 << 0));
  }
}


x86 assembly (clang, -O0):
<timer_irq>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3ff4004,%eax
movl   $0x400,(%rax)
mov    $0x3ff6004,%eax
movl   $0x1ffff0,(%rax)
mov    $0x3ff4008,%eax
mov    (%rax),%ecx
and    $0xffdffbfe,%ecx
mov    $0x3ff4008,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_irq>:
movl   $0x400,0x3ff4004
movl   $0x1ffff0,0x3ff6004
andl   $0xffdffbfe,0x3ff4008
fe fb df ff
ret

LLVM IR (-O0):
define void @timer_irq() {
store volatile i32 1024, i32* inttoptr (i64 67059716 to i32*)
store volatile i32 2097136, i32* inttoptr (i64 67067908 to i32*)
%1 = load volatile i32, i32* inttoptr (i64 67059720 to i32*)
%2 = and i32 %1, -2098178
store volatile i32 %2, i32* inttoptr (i64 67059720 to i32*)
ret void
}

LLVM IR (-O2):
define void @timer_irq() {
store volatile i32 1024, i32* inttoptr (i64 67059716 to i32*)
store volatile i32 2097136, i32* inttoptr (i64 67067908 to i32*)
%1 = load volatile i32, i32* inttoptr (i64 67059720 to i32*)
%2 = and i32 %1, -2098178
store volatile i32 %2, i32* inttoptr (i64 67059720 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bubbleSort(int *, int);
int /*<<< orphan*/ printArray(int *, int);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  int arr[10] = {5, 9, 4, 8, 1, 2, 6, 7, 3, 10};
  bubbleSort(arr, 10);
  printf("C - Sorted array:\n");
  printArray(arr, 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
call   1040 <bubbleSort@plt>
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
call   1060 <printArray@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xee4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <bubbleSort@plt>
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <printArray@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.arr = [10 x i32] [i32 5, i32 9, i32 4, i32 8, i32 1, i32 2, i32 6, i32 7, i32 3, i32 10]
@.str = [19 x i8] c"C - Sorted array:\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [10 x i32]* %6 to i8*
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%9 = call i32 @bubbleSort(i32* %8, i32 10)
%10 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%12 = call i32 @printArray(i32* %11, i32 10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [10 x i32] [i32 5, i32 9, i32 4, i32 8, i32 1, i32 2, i32 6, i32 7, i32 3, i32 10]
@str = [18 x i8] c"C - Sorted array:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = bitcast [10 x i32]* %3 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%6 = call i32 @bubbleSort(i32* %5, i32 10)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%8 = call i32 @printArray(i32* %5, i32 10)
ret i32 0
}
float float_sub(float a, double b) { return a - b; }


x86 assembly (clang, -O0):
<float_sub>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movsd  %xmm1,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  -0x10(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<float_sub>:
cvtss2sd %xmm0,%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @float_sub(float %0, double %1) {
%3 = alloca float
%4 = alloca double
store float %0, float* %3
store double %1, double* %4
%5 = load float, float* %3
%6 = fpext float %5 to double
%7 = load double, double* %4
%8 = fsub double %6, %7
%9 = fptrunc double %8 to float
ret float %9
}

LLVM IR (-O2):
define float @float_sub(float %0, double %1) {
%3 = fpext float %0 to double
%4 = fsub double %3, %1
%5 = fptrunc double %4 to float
ret float %5
}
/* Variables and functions */
char *strdup(char *);
char *strtok(char *, char *);
char *getTextToLF(char *start) {
  char *dupStart = strdup(start);
  char *text = strtok(dupStart, "\n");
  return text;
}


x86 assembly (clang, -O0):
<getTextToLF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xebc(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTextToLF>:
push   %rax
call   1040 <strdup@plt>
lea    0xed3(%rip),%rsi
mov    %rax,%rdi
pop    %rax
jmp    1030 <strtok@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define i8* @getTextToLF(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = tail call i8* @strtok(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i8* %3
}
int ld(int a) {
  int i;
  int exp;
  if (a == 0) {
    return 0;
  }
  i = 1;
  exp = 0;
  while (a > i) {
    exp++;
    i *= 2;
  }
  return exp;
}


x86 assembly (clang, -O0):
<ld>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <ld+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1154 <ld+0x54>
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    114e <ld+0x4e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112b <ld+0x2b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ld>:
xor    %eax,%eax
cmp    $0x2,%edi
jl     1119 <ld+0x19>
mov    $0x1,%ecx
xor    %eax,%eax
xchg   %ax,%ax
add    $0x1,%eax
add    %ecx,%ecx
cmp    %edi,%ecx
jl     1110 <ld+0x10>
ret

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

LLVM IR (-O2):
define i32 @ld(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = phi i32 [ %7, %3 ], [ 1, %1 ]
%6 = add nuw nsw i32 %4, 1
%7 = shl nsw i32 %5, 1
%8 = icmp slt i32 %7, %0
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %10
}
int read(int des, char *dest, int len) { return -1; }


x86 assembly (clang, -O0):
<read>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @read(i32 %0, i8* nocapture readnone %1, i32 %2) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ poe_isendbrace(char);
int poe_isnotendbrace(char c) { return !poe_isendbrace(c); }


x86 assembly (clang, -O0):
<poe_isnotendbrace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <poe_isendbrace@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):
<poe_isnotendbrace>:
push   %rax
call   1030 <poe_isendbrace@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @poe_isnotendbrace(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @poe_isendbrace(i8 signext %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 @poe_isnotendbrace(i8 signext %0) {
%2 = tail call i32 @poe_isendbrace(i8 signext %0)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
void system_open_url(const char *url) {}


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

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

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

LLVM IR (-O2):
define void @system_open_url(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int a(int);
int sample_function1(int n) { return a(n); }


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

x86 assembly (clang, -O2):
<sample_function1>:
jmp    1030 <a@plt>

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

LLVM IR (-O2):
define i32 @sample_function1(i32 %0) {
%2 = tail call i32 @a(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char **argv) {
  fprintf(stderr, "bgrep version: %s\n", "0.2");
  fprintf(stderr,
          "usage: %s [-B bytes] [-A bytes] [-C bytes] <hex> [<path> [...]]\n",
          *argv);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
lea    0xec4(%rip),%rsi
lea    0xed0(%rip),%rdx
call   1030 <fprintf@plt>
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
lea    0xeb8(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eb2(%rip),%r14
mov    (%r14),%edi
lea    0xec8(%rip),%rsi
lea    0xed4(%rip),%rdx
call   1030 <fprintf@plt>
mov    (%r14),%edi
mov    (%rbx),%rdx
lea    0xec6(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"bgrep version: %s\0A\00"
@.str.1 = [4 x i8] c"0.2\00"
@.str.2 = [65 x i8] c"usage: %s [-B bytes] [-A bytes] [-C bytes] <hex> [<path> [...]]\0A\00"
define void @usage(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = load i8**, i8*** %2
%7 = load i8*, i8** %6
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%9 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"bgrep version: %s\0A\00"
@.str.1 = [4 x i8] c"0.2\00"
@.str.2 = [65 x i8] c"usage: %s [-B bytes] [-A bytes] [-C bytes] <hex> [<path> [...]]\0A\00"
define void @usage(i8** nocapture %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = load i32, i32* @stderr
%5 = load i8*, i8** %0
%6 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%7 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
void *func1(void) { return (NULL); }


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

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

LLVM IR (-O0):
define i8* @func1() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @func1() {
ret i8* null
}
join(s, t) register char *s, *t;
{
  for (; *s; s++)
    if (any(*s, t))
      return (1);
  return (0);
}


x86 assembly (clang, -O0):
<join>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     116a <join+0x5a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1030 <any@plt>
cmp    $0x0,%eax
je     1154 <join+0x44>
movl   $0x1,-0x4(%rbp)
jmp    1171 <join+0x61>
jmp    1159 <join+0x49>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <join+0x10>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<join>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     114c <join+0x3c>
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <any@plt>
test   %eax,%eax
jne    1150 <join+0x40>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <join+0x20>
xor    %eax,%eax
jmp    1155 <join+0x45>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @join(i8* nocapture %0, i8* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %8
5: ; preds = %8
%6 = load i8, i8* %14
%7 = icmp eq i8 %6, 0
br i1 %7, label %15, label %8
8: ; preds = %2, %5
%9 = phi i8 [ %6, %5 ], [ %3, %2 ]
%10 = phi i8* [ %14, %5 ], [ %0, %2 ]
%11 = sext i8 %9 to i32
%12 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @any to i32 (i32, i8*, ...)*)(i32 %11, i8* %1)
%13 = icmp eq i32 %12, 0
%14 = getelementptr inbounds i8, i8* %10, i64 1
br i1 %13, label %5, label %15
15: ; preds = %8, %5, %2
%16 = phi i32 [ 0, %2 ], [ 0, %5 ], [ 1, %8 ]
ret i32 %16
}
/* Variables and functions */
int strlen(char const *);
int /*<<< orphan*/ write(int /*<<< orphan*/, char const *, int);
void __puts(const char *buffer) {
  int len = strlen(buffer);
  write(0, buffer, len);
}


x86 assembly (clang, -O0):
<__puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
xor    %edi,%edi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__puts>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
xor    %edi,%edi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1030 <write@plt>

LLVM IR (-O0):
define void @__puts(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
store i32 %5, i32* %3
%6 = load i8*, i8** %2
%7 = load i32, i32* %3
%8 = call i32 @write(i32 0, i8* %6, i32 %7)
ret void
}

LLVM IR (-O2):
define void @__puts(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @write(i32 0, i8* %0, i32 %2)
ret void
}
int max3(int a, int b, int c) {
  if (a > b)
    b = a;
  if (b > c)
    c = b;
  return c;
}


x86 assembly (clang, -O0):
<max3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    111f <max3+0x1f>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1131 <max3+0x31>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @max3(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, %1
%5 = select i1 %4, i32 %0, i32 %1
%6 = icmp sgt i32 %5, %2
%7 = select i1 %6, i32 %5, i32 %2
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ Buffer_with_interleave(int);
int EOF;
int /*<<< orphan*/ PrintInterleavedBuf();
int getchar();
int main(void) {
  int c;
  while ((c = getchar()) != EOF) {
    Buffer_with_interleave(c);
  }
  PrintInterleavedBuf();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e98(%rip),%rcx
cmp    (%rcx),%eax
je     1165 <main+0x35>
mov    -0x8(%rbp),%edi
call   1040 <Buffer_with_interleave@plt>
jmp    113f <main+0xf>
mov    $0x0,%al
call   1030 <PrintInterleavedBuf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2ea9(%rip),%rbx
cmp    (%rbx),%eax
je     1162 <main+0x32>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%edi
call   1040 <Buffer_with_interleave@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
jne    1150 <main+0x20>
xor    %eax,%eax
call   1030 <PrintInterleavedBuf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %7, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %4, %5
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load i32, i32* %2
%9 = call i32 @Buffer_with_interleave(i32 %8)
br label %3
10: ; preds = %3
%11 = call i32 (...) @PrintInterleavedBuf()
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %10, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %7, %4 ], [ %1, %0 ]
%6 = tail call i32 @Buffer_with_interleave(i32 %5)
%7 = tail call i32 (...) @getchar()
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %4
10: ; preds = %4, %0
%11 = tail call i32 (...) @PrintInterleavedBuf()
ret i32 0
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int wait(int *);
void myHandler(int signo) {
  int status;
  pid_t pid = wait(&status);
  printf("Child %d terminated.\n", pid);
  exit(0);
}


x86 assembly (clang, -O0):
<myHandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1050 <wait@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<myHandler>:
push   %rax
lea    0x4(%rsp),%rdi
call   1050 <wait@plt>
lea    0xebe(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@.str = [22 x i8] c"Child %d terminated.\0A\00"
define void @myHandler(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @wait(i32* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @exit(i32 0)
unreachable
}
float ft_map(float x, float length, float min, float max) {
  return ((x / length) * (max - min) + min);
}


x86 assembly (clang, -O0):
<ft_map>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
subss  -0xc(%rbp),%xmm2
movss  -0xc(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_map>:
divss  %xmm1,%xmm0
subss  %xmm2,%xmm3
mulss  %xmm3,%xmm0
addss  %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @ft_map(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %5
%10 = load float, float* %6
%11 = fdiv float %9, %10
%12 = load float, float* %8
%13 = load float, float* %7
%14 = fsub float %12, %13
%15 = load float, float* %7
%16 = call float @llvm.fmuladd.f32(float %11, float %14, float %15)
ret float %16
}

LLVM IR (-O2):
define float @ft_map(float %0, float %1, float %2, float %3) {
%5 = fdiv float %0, %1
%6 = fsub float %3, %2
%7 = tail call float @llvm.fmuladd.f32(float %5, float %6, float %2)
ret float %7
}
void utime_internal(path, arg) const char *path;
void *arg;
{
  struct utimbuf *utp = arg;
  if (utime(path, utp) < 0)
    rb_sys_fail(path);
}


x86 assembly (clang, -O0):
<utime_internal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1030 <utime@plt>
cmp    $0x0,%eax
jge    115b <utime_internal+0x3b>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <rb_sys_fail@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utime_internal>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <utime@plt>
test   %eax,%eax
js     1131 <utime_internal+0x11>
pop    %rbx
ret
mov    %rbx,%rdi
xor    %eax,%eax
pop    %rbx
jmp    1040 <rb_sys_fail@plt>

LLVM IR (-O0):
%struct.utimbuf = type opaque
define void @utime_internal(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca %struct.utimbuf*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to %struct.utimbuf*
store %struct.utimbuf* %7, %struct.utimbuf** %5
%8 = load i8*, i8** %3
%9 = load %struct.utimbuf*, %struct.utimbuf** %5
%10 = call i32 (i8*, %struct.utimbuf*, ...) bitcast (i32 (...)* @utime to i32 (i8*, %struct.utimbuf*, ...)*)(i8* %8, %struct.utimbuf* %9)
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = call i32 (i8*, ...) bitcast (i32 (...)* @rb_sys_fail to i32 (i8*, ...)*)(i8* %13)
br label %15
15: ; preds = %12, %2
ret void
}

LLVM IR (-O2):
%struct.utimbuf = type opaque
define void @utime_internal(i8* %0, i8* %1) {
%3 = bitcast i8* %1 to %struct.utimbuf*
%4 = tail call i32 (i8*, %struct.utimbuf*, ...) bitcast (i32 (...)* @utime to i32 (i8*, %struct.utimbuf*, ...)*)(i8* %0, %struct.utimbuf* %3)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @rb_sys_fail to i32 (i8*, ...)*)(i8* %0)
br label %8
8: ; preds = %6, %2
ret void
}
/* Type definitions */
typedef int gid_t;

/* Variables and functions */
gid_t octave_getgid_wrapper(void) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @octave_getgid_wrapper() {
ret i32 -1
}
void FilePrintBinary(file, code, bits) void *file;
unsigned int code;
int bits;
{}


x86 assembly (clang, -O0):
<FilePrintBinary>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @FilePrintBinary(i8* nocapture %0, i32 %1, i32 %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ create_bsp(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    printf("Usage: ./%s <filename>\n", argv[0]);
    return 1;
  }
  create_bsp(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)
cmpl   $0x2,-0x8(%rbp)
jge    115f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1173 <main+0x53>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <create_bsp@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
jg     113c <main+0x1c>
mov    (%rsi),%rsi
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret
mov    0x8(%rsi),%rdi
call   1040 <create_bsp@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Usage: ./%s <filename>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %11)
store i32 1, i32* %3
br label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @create_bsp(i8* %16)
store i32 0, i32* %3
br label %18
18: ; preds = %13, %8
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@.str = [24 x i8] c"Usage: ./%s <filename>\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %11
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @create_bsp(i8* %9)
br label %11
11: ; preds = %7, %4
%12 = phi i32 [ 1, %4 ], [ 0, %7 ]
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct timeval {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ z_ms(struct timeval *);
time_t z_now_ms() {
  struct timeval t;
  gettimeofday(&t, NULL);
  return z_ms(&t);
}


x86 assembly (clang, -O0):
<z_now_ms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
lea    -0x8(%rbp),%rdi
call   1030 <z_ms@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<z_now_ms>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
mov    %rbx,%rdi
call   1030 <z_ms@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
define i32 @z_now_ms() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = call i32 @z_ms(%struct.timeval* %1)
ret i32 %3
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i32 @z_now_ms() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = call i32 @z_ms(%struct.timeval* %1)
ret i32 %4
}
char *symbol(int c) {
  static char str[3];
  if (c < ' ' || c == 127) {
    str[0] = '^';
    str[1] = (c & 037) + '@';
    str[2] = 0;
  } else {
    str[0] = c;
    str[1] = 0;
  }
  return (str);
}


x86 assembly (clang, -O0):
<symbol>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x20,-0x4(%rbp)
jl     111b <symbol+0x1b>
cmpl   $0x7f,-0x4(%rbp)
jne    113d <symbol+0x3d>
movb   $0x5e,0x2eff(%rip)
mov    -0x4(%rbp),%eax
and    $0x1f,%eax
add    $0x40,%eax
mov    %al,0x2ef1(%rip)
movb   $0x0,0x2eeb(%rip)
jmp    114d <symbol+0x4d>
mov    -0x4(%rbp),%eax
mov    %al,0x2edb(%rip)
movb   $0x0,0x2ed5(%rip)
lea    0x2ecd(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<symbol>:
cmp    $0x20,%edi
jl     111a <symbol+0x1a>
cmp    $0x7f,%edi
je     111a <symbol+0x1a>
mov    %dil,0x2f10(%rip)
lea    0x2f0a(%rip),%rax
jmp    1137 <symbol+0x37>
movb   $0x5e,0x2f00(%rip)
and    $0x1f,%dil
or     $0x40,%dil
mov    %dil,0x2ef2(%rip)
lea    0x2eec(%rip),%rax
movb   $0x0,(%rax)
lea    0x2ee0(%rip),%rax
ret

LLVM IR (-O0):
@symbol.str = internal global [3 x i8] zeroinitializer
define i8* @symbol(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 32
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 127
br i1 %7, label %8, label %13
8: ; preds = %5, %1
store i8 94, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @symbol.str, i64 0, i64 0)
%9 = load i32, i32* %2
%10 = and i32 %9, 31
%11 = add nsw i32 %10, 64
%12 = trunc i32 %11 to i8
store i8 %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @symbol.str, i64 0, i64 1)
store i8 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @symbol.str, i64 0, i64 2)
br label %16
13: ; preds = %5
%14 = load i32, i32* %2
%15 = trunc i32 %14 to i8
store i8 %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @symbol.str, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @symbol.str, i64 0, i64 1)
br label %16
16: ; preds = %13, %8
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @symbol.str, i64 0, i64 0)
}

LLVM IR (-O2):
@symbol.str = internal global [3 x i8] zeroinitializer
define i8* @symbol(i32 %0) {
%2 = icmp slt i32 %0, 32
%3 = icmp eq i32 %0, 127
%4 = or i1 %2, %3
br i1 %4, label %5, label %9
5: ; preds = %1
store i8 94, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @symbol.str, i64 0, i64 0)
%6 = trunc i32 %0 to i8
%7 = and i8 %6, 31
%8 = or i8 %7, 64
store i8 %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @symbol.str, i64 0, i64 1)
br label %11
9: ; preds = %1
%10 = trunc i32 %0 to i8
store i8 %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @symbol.str, i64 0, i64 0)
br label %11
11: ; preds = %9, %5
%12 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @symbol.str, i64 0, i64 1), %9 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @symbol.str, i64 0, i64 2), %5 ]
store i8 0, i8* %12
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @symbol.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ orcerror(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ strerror(int);
void orcerrno(int err) { orcerror("%s (%d)\n", strerror(err), err); }


x86 assembly (clang, -O0):
<orcerrno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <strerror@plt>
mov    %eax,%esi
mov    -0x4(%rbp),%edx
lea    0xec1(%rip),%rdi
call   1030 <orcerror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<orcerrno>:
push   %rbx
mov    %edi,%ebx
call   1040 <strerror@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%edx
pop    %rbx
jmp    1030 <orcerror@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"%s (%d)\0A\00"
define void @orcerrno(i32 %0) {
%2 = tail call i32 @strerror(i32 %0)
%3 = tail call i32 @orcerror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
void writeByteToFile(FILE *file, char byte) { fputc(byte, file); }


x86 assembly (clang, -O0):
<writeByteToFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1030 <fputc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeByteToFile>:
mov    %rdi,%rax
mov    %esi,%edi
mov    %rax,%rsi
jmp    1030 <fputc@plt>

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

LLVM IR (-O2):
define void @writeByteToFile(i32* nocapture %0, i8 signext %1) {
%3 = tail call i32 @fputc(i8 signext %1, i32* %0)
ret void
}
int test_imm_0Fint32_mem(int *val) {
  return ((*val) & (0x0F << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_0Fint32_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
and    $0xf,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_0Fint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 15
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void fn00001390() { return; }


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

x86 assembly (clang, -O2):
ret

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

LLVM IR (-O2):
define void @fn00001390() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ DATA_synapse();
int /*<<< orphan*/ FUNC_synapse();
int /*<<< orphan*/ LibraryHeader(char *, char *, char *);
LIBRARY_synapse() {
  LibraryHeader("Synapse", "2-89", "M.Wilson Caltech");
  DATA_synapse();
  FUNC_synapse();
}


x86 assembly (clang, -O0):
<LIBRARY_synapse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xec2(%rip),%rsi
lea    0xec0(%rip),%rdx
call   1050 <LibraryHeader@plt>
mov    $0x0,%al
call   1040 <DATA_synapse@plt>
mov    $0x0,%al
call   1030 <FUNC_synapse@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LIBRARY_synapse>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xec9(%rip),%rsi
lea    0xec7(%rip),%rdx
call   1050 <LibraryHeader@plt>
xor    %eax,%eax
call   1040 <DATA_synapse@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <FUNC_synapse@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Synapse\00"
@.str.1 = [5 x i8] c"2-89\00"
@.str.2 = [17 x i8] c"M.Wilson Caltech\00"
define i32 @LIBRARY_synapse() {
%1 = alloca i32
%2 = call i32 @LibraryHeader(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%3 = call i32 (...) @DATA_synapse()
%4 = call i32 (...) @FUNC_synapse()
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
@.str = [8 x i8] c"Synapse\00"
@.str.1 = [5 x i8] c"2-89\00"
@.str.2 = [17 x i8] c"M.Wilson Caltech\00"
define i32 @LIBRARY_synapse() {
%1 = tail call i32 @LibraryHeader(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%2 = tail call i32 (...) @DATA_synapse()
%3 = tail call i32 (...) @FUNC_synapse()
ret i32 undef
}
float uclamp(float k) {
  if (k < 0.f)
    return 0.f;
  else if (k > 1.f)
    return 1.f;
  else
    return k;
}


x86 assembly (clang, -O0):
<uclamp>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1123 <uclamp+0x23>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1155 <uclamp+0x55>
movss  -0x8(%rbp),%xmm0
movss  0xed0(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    114b <uclamp+0x4b>
movss  0xebf(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1155 <uclamp+0x55>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<uclamp>:
movss  0xef8(%rip),%xmm1
minss  %xmm0,%xmm1
xorps  %xmm2,%xmm2
cmpltss %xmm2,%xmm0
andnps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @uclamp(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fcmp olt float %4, 0.000000e+00
br i1 %5, label %6, label %7
6: ; preds = %1
store float 0.000000e+00, float* %2
br label %13
7: ; preds = %1
%8 = load float, float* %3
%9 = fcmp ogt float %8, 1.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %7
store float 1.000000e+00, float* %2
br label %13
11: ; preds = %7
%12 = load float, float* %3
store float %12, float* %2
br label %13
13: ; preds = %11, %10, %6
%14 = load float, float* %2
ret float %14
}

LLVM IR (-O2):
define float @uclamp(float %0) {
%2 = fcmp olt float %0, 0.000000e+00
%3 = fcmp ogt float %0, 1.000000e+00
%4 = select i1 %3, float 1.000000e+00, float %0
%5 = select i1 %2, float 0.000000e+00, float %4
ret float %5
}
int isnan(double d) {
  union {
    unsigned long long l;
    double d;
  } u;
  u.d = d;
  return (u.l == 0x7FF8000000000000ll || u.l == 0x7FF0000000000000ll ||
          u.l == 0xFFF8000000000000ll);
}


x86 assembly (clang, -O0):
<isnan>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    $0x1,%al
movabs $0x7ff8000000000000,%rcx
cmp    %rcx,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     1159 <isnan+0x59>
mov    $0x1,%al
movabs $0x7ff0000000000000,%rcx
cmp    %rcx,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     1159 <isnan+0x59>
movabs $0xfff8000000000000,%rax
cmp    %rax,-0x10(%rbp)
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isnan>:
movq   %xmm0,%rax
movabs $0xfff7ffffffffffff,%rcx
ff f7 ff
mov    %rax,%rdx
and    %rcx,%rdx
movabs $0x7ff0000000000000,%rsi
cmp    %rsi,%rdx
sete   %dl
add    $0x1,%rcx
cmp    %rcx,%rax
sete   %al
or     %dl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
%union.anon = type { i64 }
define i32 @isnan(double %0) {
%2 = alloca double
%3 = alloca %union.anon
store double %0, double* %2
%4 = load double, double* %2
%5 = bitcast %union.anon* %3 to double*
store double %4, double* %5
%6 = bitcast %union.anon* %3 to i64*
%7 = load i64, i64* %6
%8 = icmp eq i64 %7, 9221120237041090560
br i1 %8, label %17, label %9
9: ; preds = %1
%10 = bitcast %union.anon* %3 to i64*
%11 = load i64, i64* %10
%12 = icmp eq i64 %11, 9218868437227405312
br i1 %12, label %17, label %13
13: ; preds = %9
%14 = bitcast %union.anon* %3 to i64*
%15 = load i64, i64* %14
%16 = icmp eq i64 %15, -2251799813685248
br label %17
17: ; preds = %13, %9, %1
%18 = phi i1 [ true, %9 ], [ true, %1 ], [ %16, %13 ]
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @isnan(double %0) {
%2 = bitcast double %0 to i64
%3 = and i64 %2, -2251799813685249
%4 = icmp eq i64 %3, 9218868437227405312
%5 = icmp eq i64 %2, -2251799813685248
%6 = or i1 %5, %4
%7 = zext i1 %6 to i32
ret i32 %7
}
char *strcpy(char *dest, char *src) {
  while (*src) {
    *dest++ = *src++;
  }
  *dest = '\0';
}


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

x86 assembly (clang, -O2):
<strcpy>:
mov    (%rsi),%al
test   %al,%al
je     1121 <strcpy+0x21>
add    $0x1,%rsi
nopw   0x0(%rax,%rax,1)
mov    %al,(%rdi)
add    $0x1,%rdi
movzbl (%rsi),%eax
add    $0x1,%rsi
test   %al,%al
jne    1110 <strcpy+0x10>
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define noalias i8* @strcpy(i8* nocapture 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* [ %9, %5 ], [ %1, %2 ]
%8 = phi i8* [ %10, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %6, i8* %8
%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* undef
}
/* Variables and functions */
int /*<<< orphan*/ k_clear_screen();
int /*<<< orphan*/ k_printf(char *, int /*<<< orphan*/);
k_main() {
  k_clear_screen();
  k_printf("Welcome,\nthis is my kernel!", 0);
}


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

x86 assembly (clang, -O2):
<k_main>:
push   %rax
xor    %eax,%eax
call   1040 <k_clear_screen@plt>
lea    0xed1(%rip),%rdi
xor    %esi,%esi
pop    %rax
jmp    1030 <k_printf@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Welcome,\0Athis is my kernel!\00"
define i32 @k_main() {
%1 = alloca i32
%2 = call i32 (...) @k_clear_screen()
%3 = call i32 @k_printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@.str = [28 x i8] c"Welcome,\0Athis is my kernel!\00"
define i32 @k_main() {
%1 = tail call i32 (...) @k_clear_screen()
%2 = tail call i32 @k_printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 0)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
extern void shmem_getmem(void *dest, const void *src, size_t len, int pe) {
  printf("\nOpenSHMEM Analyzer\n");
}


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"\0AOpenSHMEM Analyzer\0A\00"
define void @shmem_getmem(i8* %0, i8* %1, i64 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i32 %3, i32* %8
%9 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [20 x i8] c"\0AOpenSHMEM Analyzer\00"
define void @shmem_getmem(i8* nocapture readnone %0, i8* nocapture readnone %1, i64 %2, i32 %3) {
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret void
}