xunge/DecIR huggingface dataset:
int kstrlen(const char *cs) {
  int ans = 0;
  while (cs[ans++] != '\0') {
  };
  return (ans - 1);
}


x86 assembly (clang, -O0):
<kstrlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1133 <kstrlen+0x33>
jmp    110f <kstrlen+0xf>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kstrlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <kstrlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @kstrlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %4, %2 ], [ 0, %1 ]
%4 = add nuw i64 %3, 1
%5 = getelementptr inbounds i8, i8* %0, i64 %3
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
int kmalloc(int size) { return size; }


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

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

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

LLVM IR (-O2):
define i32 @kmalloc(i32 returned %0) {
ret i32 %0
}
void *int_to_ptr(int item) { return (void *)(long int)item; }


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

x86 assembly (clang, -O2):
<int_to_ptr>:
movslq %edi,%rax
ret

LLVM IR (-O0):
define i8* @int_to_ptr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}

LLVM IR (-O2):
define i8* @int_to_ptr(i32 %0) {
%2 = sext i32 %0 to i64
%3 = inttoptr i64 %2 to i8*
ret i8* %3
}
void func_c() {
  for (;;) {
  }
}


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

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

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

LLVM IR (-O2):
define void @func_c() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ dexit(int);
void idexit(int arg) { dexit(100); }


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

x86 assembly (clang, -O2):
<idexit>:
mov    $0x64,%edi
jmp    1030 <dexit@plt>

LLVM IR (-O0):
define void @idexit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @dexit(i32 100)
ret void
}

LLVM IR (-O2):
define void @idexit(i32 %0) {
%2 = tail call i32 @dexit(i32 100)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mreflect(double *, double **);
int /*<<< orphan*/ mvmul(double *, double **, double *);
void vreflect(double v[3], double axis[3], double vr[3]) {
  double m[3][3];
  mreflect(axis, m);
  mvmul(v, m, vr);
}


x86 assembly (clang, -O0):
<vreflect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1040 <mreflect@plt>
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <mvmul@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vreflect>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rdx,%r14
mov    %rdi,%rbx
mov    %rsp,%r15
mov    %rsi,%rdi
mov    %r15,%rsi
call   1040 <mreflect@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <mvmul@plt>
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @vreflect(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca [3 x [3 x double]]
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%8 = load double*, double** %5
%9 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %7, i64 0, i64 0
%10 = bitcast [3 x double]* %9 to double**
%11 = call i32 @mreflect(double* %8, double** %10)
%12 = load double*, double** %4
%13 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %7, i64 0, i64 0
%14 = bitcast [3 x double]* %13 to double**
%15 = load double*, double** %6
%16 = call i32 @mvmul(double* %12, double** %14, double* %15)
ret void
}

LLVM IR (-O2):
define void @vreflect(double* %0, double* %1, double* %2) {
%4 = alloca [3 x [3 x double]]
%5 = bitcast [3 x [3 x double]]* %4 to i8*
%6 = bitcast [3 x [3 x double]]* %4 to double**
%7 = call i32 @mreflect(double* %1, double** %6)
%8 = call i32 @mvmul(double* %0, double** %6, double* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ link_failure_nearbyintl();
scalar_t__ nearbyintl(long double);
void test_nearbyintl(long double ld) {
  if (nearbyintl(ld) != nearbyintl(ld))
    link_failure_nearbyintl();
}


x86 assembly (clang, -O0):
<test_nearbyintl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <nearbyintl@plt>
mov    %rax,-0x18(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <nearbyintl@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
je     1163 <test_nearbyintl+0x43>
mov    $0x0,%al
call   1030 <link_failure_nearbyintl@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_nearbyintl>:
push   %rbx
sub    $0x20,%rsp
fldt   0x30(%rsp)
fld    %st(0)
fstpt  0x14(%rsp)
fstpt  (%rsp)
call   1040 <nearbyintl@plt>
mov    %rax,%rbx
fldt   0x14(%rsp)
fstpt  (%rsp)
call   1040 <nearbyintl@plt>
cmp    %rax,%rbx
jne    1151 <test_nearbyintl+0x31>
add    $0x20,%rsp
pop    %rbx
ret
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
jmp    1030 <link_failure_nearbyintl@plt>

LLVM IR (-O0):
define void @test_nearbyintl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call i64 @nearbyintl(x86_fp80 %3)
%5 = load x86_fp80, x86_fp80* %2
%6 = call i64 @nearbyintl(x86_fp80 %5)
%7 = icmp ne i64 %4, %6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @link_failure_nearbyintl()
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
define void @test_nearbyintl(x86_fp80 %0) {
%2 = tail call i64 @nearbyintl(x86_fp80 %0)
%3 = tail call i64 @nearbyintl(x86_fp80 %0)
%4 = icmp eq i64 %2, %3
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @link_failure_nearbyintl()
br label %7
7: ; preds = %5, %1
ret void
}
/* Type definitions */
typedef scalar_t__ uint16_t;

/* Variables and functions */
int charToUnsigned16(char c) {
  uint16_t d = (uint16_t)c;
  return (int)d;
}


x86 assembly (clang, -O0):
<charToUnsigned16>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbq -0x1(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @charToUnsigned16(i8 signext %0) {
%2 = alloca i8
%3 = alloca i64
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i64
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @charToUnsigned16(i8 signext %0) {
%2 = sext i8 %0 to i32
ret i32 %2
}
int do_111() { return 111; }


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

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

LLVM IR (-O0):
define i32 @do_111() {
ret i32 111
}

LLVM IR (-O2):
define i32 @do_111() {
ret i32 111
}
/* Variables and functions */
scalar_t__ md_readchar();
int /*<<< orphan*/ quit(int /*<<< orphan*/);
char readchar() {
  char ch;
  ch = (char)md_readchar();
  if (ch == 3) {
    quit(0);
    return (27);
  }
  return (ch);
}


x86 assembly (clang, -O0):
<readchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <md_readchar@plt>
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x3,%eax
jne    114f <readchar+0x2f>
xor    %edi,%edi
call   1030 <quit@plt>
movb   $0x1b,-0x1(%rbp)
jmp    1155 <readchar+0x35>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readchar>:
push   %rax
xor    %eax,%eax
call   1040 <md_readchar@plt>
cmp    $0x3,%al
jne    1135 <readchar+0x15>
xor    %edi,%edi
call   1030 <quit@plt>
mov    $0x1b,%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @readchar() {
%1 = alloca i8
%2 = alloca i8
%3 = call i64 (...) @md_readchar()
%4 = trunc i64 %3 to i8
store i8 %4, i8* %2
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 3
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @quit(i32 0)
store i8 27, i8* %1
br label %12
10: ; preds = %0
%11 = load i8, i8* %2
store i8 %11, i8* %1
br label %12
12: ; preds = %10, %8
%13 = load i8, i8* %1
ret i8 %13
}

LLVM IR (-O2):
define signext i8 @readchar() {
%1 = tail call i64 (...) @md_readchar()
%2 = trunc i64 %1 to i8
%3 = icmp eq i8 %2, 3
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 @quit(i32 0)
br label %6
6: ; preds = %0, %4
%7 = phi i8 [ 27, %4 ], [ %2, %0 ]
ret i8 %7
}
/* Variables and functions */
float const QSqrt(float const);
float Maths_Sqrt(const float number) { return number * QSqrt(number); }


x86 assembly (clang, -O0):
<Maths_Sqrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <QSqrt@plt>
movaps %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
mulss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Maths_Sqrt>:
push   %rax
movss  %xmm0,0x4(%rsp)
call   1030 <QSqrt@plt>
mulss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @Maths_Sqrt(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = load float, float* %2
%5 = call float @QSqrt(float %4)
%6 = fmul float %3, %5
ret float %6
}

LLVM IR (-O2):
define float @Maths_Sqrt(float %0) {
%2 = tail call float @QSqrt(float %0)
%3 = fmul float %2, %0
ret float %3
}
int sudoku_get_index(int x, int y) { return (y - 1) * 9 + (x - 1); }


x86 assembly (clang, -O0):
<sudoku_get_index>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
imul   $0x9,%eax,%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sudoku_get_index>:
lea    (%rsi,%rsi,8),%eax
add    %edi,%eax
add    $0xfffffff6,%eax
ret

LLVM IR (-O0):
define i32 @sudoku_get_index(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = sub nsw i32 %5, 1
%7 = mul nsw i32 %6, 9
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, 1
%10 = add nsw i32 %7, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @sudoku_get_index(i32 %0, i32 %1) {
%3 = mul i32 %1, 9
%4 = add i32 %0, -10
%5 = add i32 %4, %3
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ simulate_thread_done();
int /*<<< orphan*/ test(int /*<<< orphan*/);
__attribute__((no)) void simulate_thread_main() {
  test(0);
  simulate_thread_done();
}


x86 assembly (clang, -O0):
<simulate_thread_main>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1040 <test@plt>
mov    $0x0,%al
call   1030 <simulate_thread_done@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @simulate_thread_main() {
%1 = call i32 @test(i32 0)
%2 = call i32 (...) @simulate_thread_done()
ret void
}

LLVM IR (-O2):
define void @simulate_thread_main() {
%1 = tail call i32 @test(i32 0)
%2 = tail call i32 (...) @simulate_thread_done()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ startSpaceInvaders();
int main(int argc, char **argv) {
  startSpaceInvaders();
  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    $0x0,%al
call   1030 <startSpaceInvaders@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <startSpaceInvaders@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 = call i32 (...) @startSpaceInvaders()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @startSpaceInvaders()
ret i32 0
}
void bochs_magic(void) { asm volatile("xchg %%bx, %%bx" : : : "rbx"); }


x86 assembly (clang, -O0):
<bochs_magic>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
xchg   %bx,%bx
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<bochs_magic>:
push   %rbx
xchg   %bx,%bx
pop    %rbx
ret

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

LLVM IR (-O2):
define void @bochs_magic() {
tail call void asm sideeffect "xchg %bx, %bx", "~{rbx},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int fread(unsigned char **, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
unsigned char readByte(long desc) {
  FILE *fd = (FILE *)desc;
  unsigned char buf[1];
  int n = fread(&buf, 1, 1, fd);
  if (n < 1) {
    fprintf(stderr, "Problem when reading input file.\n");
  }
  return buf[0];
}


x86 assembly (clang, -O0):
<readByte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x11(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jge    116a <readByte+0x4a>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
lea    0xe9b(%rip),%rsi
call   1040 <fprintf@plt>
movzbl -0x11(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readByte>:
push   %rax
mov    %rdi,%rcx
lea    0x7(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
test   %eax,%eax
jg     1151 <readByte+0x31>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
lea    0xeb4(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x7(%rsp),%al
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"Problem when reading input file.\0A\00"
define zeroext i8 @readByte(i64 %0) {
%2 = alloca i64
%3 = alloca i32*
%4 = alloca [1 x i8]
%5 = alloca i32
store i64 %0, i64* %2
%6 = load i64, i64* %2
%7 = inttoptr i64 %6 to i32*
store i32* %7, i32** %3
%8 = bitcast [1 x i8]* %4 to i8**
%9 = load i32*, i32** %3
%10 = call i32 @fread(i8** %8, i32 1, i32 1, i32* %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 1
br i1 %12, label %13, label %16
13: ; preds = %1
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %13, %1
%17 = getelementptr inbounds [1 x i8], [1 x i8]* %4, i64 0, i64 0
%18 = load i8, i8* %17
ret i8 %18
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"Problem when reading input file.\0A\00"
define zeroext i8 @readByte(i64 %0) {
%2 = alloca [1 x i8]
%3 = inttoptr i64 %0 to i32*
%4 = getelementptr inbounds [1 x i8], [1 x i8]* %2, i64 0, i64 0
%5 = bitcast [1 x i8]* %2 to i8**
%6 = call i32 @fread(i8** %5, i32 1, i32 1, i32* %3)
%7 = icmp slt i32 %6, 1
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %8, %1
%12 = load i8, i8* %4
ret i8 %12
}
/* Variables and functions */
int /*<<< orphan*/ beAlive();
int main() { beAlive(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @beAlive()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @beAlive()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(unsigned long);
int /*<<< orphan*/ printf(char *, int, unsigned long);
__attribute__((__noreturn__)) void exitfunc20(int status, void *arg) {
  printf("Executing exitfunc"
         "20"
         " (status=%d, arg=%lu)\n",
         status, (unsigned long)arg);
  exit((unsigned long)arg);
}


x86 assembly (clang, -O0):
<exitfunc20>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<exitfunc20>:
push   %rbx
mov    %rsi,%rbx
mov    %edi,%esi
lea    0xed3(%rip),%rdi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [43 x i8] c"Executing exitfunc20 (status=%d, arg=%lu)\0A\00"
define void @exitfunc20(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = ptrtoint i8* %6 to i64
%8 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %5, i64 %7)
%9 = load i8*, i8** %4
%10 = ptrtoint i8* %9 to i64
%11 = call i32 @exit(i64 %10)
unreachable
}

LLVM IR (-O2):
@.str = [43 x i8] c"Executing exitfunc20 (status=%d, arg=%lu)\0A\00"
define void @exitfunc20(i32 %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = tail call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %0, i64 %3)
%5 = tail call i32 @exit(i64 %3)
unreachable
}
/* Type definitions */
typedef int u_int8_t;

/* Variables and functions */
int /*<<< orphan*/ SIGTTOU;
scalar_t__ SIG_ERR;
int /*<<< orphan*/ SIG_IGN;
scalar_t__ signal(int /*<<< orphan*/, int /*<<< orphan*/);
u_int8_t __ignore_background_tty_writes() {
  if (signal(SIGTTOU, SIG_IGN) == SIG_ERR) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<__ignore_background_tty_writes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
call   1030 <signal@plt>
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%rax
jne    114b <__ignore_background_tty_writes+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1152 <__ignore_background_tty_writes+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ignore_background_tty_writes>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
mov    0x2ebf(%rip),%rax
mov    (%rax),%esi
call   1030 <signal@plt>
mov    0x2ea1(%rip),%rdx
xor    %ecx,%ecx
cmp    (%rdx),%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SIGTTOU = global i32 0
@SIG_IGN = global i32 0
@SIG_ERR = global i64 0
define i32 @__ignore_background_tty_writes() {
%1 = alloca i32
%2 = load i32, i32* @SIGTTOU
%3 = load i32, i32* @SIG_IGN
%4 = call i64 @signal(i32 %2, i32 %3)
%5 = load i64, i64* @SIG_ERR
%6 = icmp eq i64 %4, %5
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 1, i32* %1
br label %9
8: ; preds = %0
store i32 0, i32* %1
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
@SIGTTOU = global i32 0
@SIG_IGN = global i32 0
@SIG_ERR = global i64 0
define i32 @__ignore_background_tty_writes() {
%1 = load i32, i32* @SIGTTOU
%2 = load i32, i32* @SIG_IGN
%3 = tail call i64 @signal(i32 %1, i32 %2)
%4 = load i64, i64* @SIG_ERR
%5 = icmp eq i64 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int square(int /*<<< orphan*/);
int main() { return square(0); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @square(i32 0)
ret i32 %1
}
int test_imm_F8int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0xF8 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_F8int64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 16
%6 = and i64 %5, 248
%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_F8int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 16252928
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
double myPow(double, int);
int /*<<< orphan*/ printf(char *, double, double);
int main() {
  printf("%f\n%f\n", myPow(8.88023, 3), 700.28148);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
mov    $0x3,%edi
call   1040 <myPow@plt>
lea    0xec8(%rip),%rdi
movsd  0xeb0(%rip),%xmm1
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xed7(%rip),%xmm0
mov    $0x3,%edi
call   1040 <myPow@plt>
lea    0xed6(%rip),%rdi
movsd  0xec6(%rip),%xmm1
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%f\0A%f\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call double @myPow(double 8.880230e+00, i32 3)
%3 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %2, double 0x4085E240789613D3)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%f\0A%f\0A\00"
define i32 @main() {
%1 = tail call double @myPow(double 8.880230e+00, i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %1, double 0x4085E240789613D3)
ret i32 0
}
void stripdash(char *p) {
  char *q = p;
  do
    if (*(q = p) != '-')
      q++;
  while (*p++);
}


x86 assembly (clang, -O0):
<stripdash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     1130 <stripdash+0x30>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1135 <stripdash+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
jne    1110 <stripdash+0x10>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @stripdash(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ command;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ stdout;
void textcolor_normal(void) {
  char command[13];
  snprintf(command, sizeof(command), "%c[22m", 0x1B);
  fprintf(stdout, "%s", command);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<textcolor_normal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0xd(%rbp),%rdi
mov    $0xd,%esi
lea    0xeb8(%rip),%rdx
mov    $0x1b,%ecx
call   1030 <snprintf@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
lea    -0xd(%rbp),%rdx
lea    0xea1(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<textcolor_normal>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xec2(%rip),%rdx
lea    0xb(%rsp),%r14
mov    %r14,%rdi
mov    $0xd,%esi
mov    $0x1b,%ecx
call   1030 <snprintf@plt>
mov    0x2e84(%rip),%rbx
mov    (%rbx),%edi
lea    0xea2(%rip),%rsi
mov    %r14,%rdx
call   1040 <fprintf@plt>
mov    (%rbx),%edi
call   1050 <fflush@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%c[22m\00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"%s\00"
define void @textcolor_normal() {
%1 = alloca [13 x i8]
%2 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%3 = call i32 @snprintf(i8* %2, i32 13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 27)
%4 = load i32, i32* @stdout
%5 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%6 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = load i32, i32* @stdout
%8 = call i32 @fflush(i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%c[22m\00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"%s\00"
define void @textcolor_normal() {
%1 = alloca [13 x i8]
%2 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%3 = call i32 @snprintf(i8* %2, i32 13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 27)
%4 = load i32, i32* @stdout
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = load i32, i32* @stdout
%7 = call i32 @fflush(i32 %6)
ret void
}
/* Variables and functions */
double round2(double, int);
void my_constraints(double x[], int n) {
  int i;
  for (i = 0; i < n; i++) {
    x[i] = round2(x[i], 2);
  }
}


x86 assembly (clang, -O0):
<my_constraints>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1164 <my_constraints+0x54>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    $0x2,%edi
call   1030 <round2@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <my_constraints+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_constraints>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    114f <my_constraints+0x3f>
mov    %rdi,%r15
mov    %esi,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%r15,%rbx,8),%xmm0
mov    $0x2,%edi
call   1030 <round2@plt>
movsd  %xmm0,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1130 <my_constraints+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @my_constraints(double* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds double, double* %0, i64 %7
%9 = load double, double* %8
%10 = tail call double @round2(double %9, i32 2)
store double %10, double* %8
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
void spt_debug(const char *fmt, ...) {}


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

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

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

LLVM IR (-O2):
define void @spt_debug(i8* nocapture %0, ...) {
ret void
}
void func1(void) {
Label1_1:;
}


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

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

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

LLVM IR (-O2):
define void @func1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usb_config();
int /*<<< orphan*/ usb_init();
void xbee_init(void) {
  usb_init();
  usb_config();
}


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

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

LLVM IR (-O0):
define void @xbee_init() {
%1 = call i32 (...) @usb_init()
%2 = call i32 (...) @usb_config()
ret void
}

LLVM IR (-O2):
define void @xbee_init() {
%1 = tail call i32 (...) @usb_init()
%2 = tail call i32 (...) @usb_config()
ret void
}
double celsius(double f) { return 5. / 9. * (f - 32); }


x86 assembly (clang, -O0):
<celsius>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  0xef2(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xede(%rip),%xmm0
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<celsius>:
addsd  0xef8(%rip),%xmm0
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @celsius(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fsub double %3, 3.200000e+01
%5 = fmul double 0x3FE1C71C71C71C72, %4
ret double %5
}

LLVM IR (-O2):
define double @celsius(double %0) {
%2 = fadd double %0, -3.200000e+01
%3 = fmul double %2, 0x3FE1C71C71C71C72
ret double %3
}
int bmax_int(int a, int b) { return (a > b ? a : b); }


x86 assembly (clang, -O0):
<bmax_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <bmax_int+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <bmax_int+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @bmax_int(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
void RTTimerChangeInterval(void) {}


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

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

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

LLVM IR (-O2):
define void @RTTimerChangeInterval() {
ret void
}
float sigmoidDeriv(float sigmoidInput) {
  return sigmoidInput * (1 - sigmoidInput);
}


x86 assembly (clang, -O0):
<sigmoidDeriv>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xeea(%rip),%xmm1
subss  -0x4(%rbp),%xmm1
mulss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigmoidDeriv>:
movss  0xef8(%rip),%xmm1
subss  %xmm0,%xmm1
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @sigmoidDeriv(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = load float, float* %2
%5 = fsub float 1.000000e+00, %4
%6 = fmul float %3, %5
ret float %6
}

LLVM IR (-O2):
define float @sigmoidDeriv(float %0) {
%2 = fsub float 1.000000e+00, %0
%3 = fmul float %2, %0
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ getch();
int /*<<< orphan*/ printw(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void m_perror(char *msg) {
  printw("### Client Error: %s: %s.\n", msg, strerror(errno));
  refresh();
  getch();
  endwin();
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<m_perror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
lea    0xe71(%rip),%rdi
call   1030 <printw@plt>
mov    $0x0,%al
call   1040 <refresh@plt>
mov    $0x0,%al
call   1050 <getch@plt>
mov    $0x0,%al
call   1060 <endwin@plt>
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<m_perror>:
push   %rbx
mov    %rdi,%rbx
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
lea    0xe87(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printw@plt>
xor    %eax,%eax
call   1040 <refresh@plt>
xor    %eax,%eax
call   1050 <getch@plt>
xor    %eax,%eax
call   1060 <endwin@plt>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"### Client Error: %s: %s.\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define void @m_perror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @errno
%5 = call i32 @strerror(i32 %4)
%6 = call i32 @printw(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %3, i32 %5)
%7 = call i32 (...) @refresh()
%8 = call i32 (...) @getch()
%9 = call i32 (...) @endwin()
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
}

LLVM IR (-O2):
@.str = [27 x i8] c"### Client Error: %s: %s.\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define void @m_perror(i8* %0) {
%2 = load i32, i32* @errno
%3 = tail call i32 @strerror(i32 %2)
%4 = tail call i32 @printw(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %3)
%5 = tail call i32 (...) @refresh()
%6 = tail call i32 (...) @getch()
%7 = tail call i32 (...) @endwin()
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
}
void f_sizeof_(void *x, void *y, int *size) {
  *size = ((char *)y) - ((char *)x);
}


x86 assembly (clang, -O0):
<f_sizeof_>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_sizeof_>:
sub    %edi,%esi
mov    %esi,(%rdx)
ret

LLVM IR (-O0):
define void @f_sizeof_(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%7 = load i8*, i8** %5
%8 = load i8*, i8** %4
%9 = ptrtoint i8* %7 to i64
%10 = ptrtoint i8* %8 to i64
%11 = sub i64 %9, %10
%12 = trunc i64 %11 to i32
%13 = load i32*, i32** %6
store i32 %12, i32* %13
ret void
}

LLVM IR (-O2):
define void @f_sizeof_(i8* %0, i8* %1, i32* nocapture writeonly %2) {
%4 = ptrtoint i8* %1 to i64
%5 = ptrtoint i8* %0 to i64
%6 = sub i64 %4, %5
%7 = trunc i64 %6 to i32
store i32 %7, i32* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void help_info() {
  printf("Through the address book, you can keep the communication and contact "
         "and acquaintances!\n");
  printf("You can export contact information.\n");
  printf("you can add, delete, modify contact information\n");
}


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

x86 assembly (clang, -O2):
<help_info>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf34(%rip),%rdi
call   1030 <puts@plt>
lea    0xf4c(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [89 x i8] c"Through the address book, you can keep the communication and contact and acquaintances!\0A\00"
@.str.1 = [37 x i8] c"You can export contact information.\0A\00"
@.str.2 = [49 x i8] c"you can add, delete, modify contact information\0A\00"
define void @help_info() {
%1 = call i32 @printf(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [88 x i8] c"Through the address book, you can keep the communication and contact and acquaintances!\00"
@str.3 = [36 x i8] c"You can export contact information.\00"
@str.4 = [48 x i8] c"you can add, delete, modify contact information\00"
define void @help_info() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([88 x i8], [88 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.4, i64 0, i64 0))
ret void
}
int not_newline(int c) { return c != '\n'; }


x86 assembly (clang, -O0):
<not_newline>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<not_newline>:
xor    %eax,%eax
cmp    $0xa,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @not_newline(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 10
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @not_newline(i32 %0) {
%2 = icmp ne i32 %0, 10
%3 = zext i1 %2 to i32
ret i32 %3
}
int main(__attribute__((__unused__)) int argc,
         __attribute__((__unused__)) char **argv) {
  __asm__("movb $0, 0");
  return 1;
}


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

x86 assembly (clang, -O2):
<main>:
movb   $0x0,0x0
mov    $0x1,%eax
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
ret i32 1
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
tail call void asm sideeffect "movb $$0, 0", "~{dirflag},~{fpsr},~{flags}"()
ret i32 1
}
/* Type definitions */
struct gpio_bank {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _reset_gpio(struct gpio_bank *, int);
scalar_t__ check_gpio(int);
struct gpio_bank *get_gpio_bank(int);
void omap_free_gpio(int gpio) {
  struct gpio_bank *bank;
  if (check_gpio(gpio) < 0)
    return;
  bank = get_gpio_bank(gpio);
  _reset_gpio(bank, gpio);
}


x86 assembly (clang, -O0):
<omap_free_gpio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <check_gpio@plt>
cmp    $0x0,%rax
jge    1152 <omap_free_gpio+0x22>
jmp    116a <omap_free_gpio+0x3a>
mov    -0x4(%rbp),%edi
call   1040 <get_gpio_bank@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1050 <_reset_gpio@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<omap_free_gpio>:
push   %rbx
mov    %edi,%ebx
call   1030 <check_gpio@plt>
test   %rax,%rax
js     114f <omap_free_gpio+0x1f>
mov    %ebx,%edi
call   1040 <get_gpio_bank@plt>
mov    %rax,%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1050 <_reset_gpio@plt>
pop    %rbx
ret

LLVM IR (-O0):
%struct.gpio_bank = type { i32 }
define void @omap_free_gpio(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.gpio_bank*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i64 @check_gpio(i32 %4)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
br label %14
8: ; preds = %1
%9 = load i32, i32* %2
%10 = call %struct.gpio_bank* @get_gpio_bank(i32 %9)
store %struct.gpio_bank* %10, %struct.gpio_bank** %3
%11 = load %struct.gpio_bank*, %struct.gpio_bank** %3
%12 = load i32, i32* %2
%13 = call i32 @_reset_gpio(%struct.gpio_bank* %11, i32 %12)
br label %14
14: ; preds = %8, %7
ret void
}

LLVM IR (-O2):
%struct.gpio_bank = type { i32 }
define void @omap_free_gpio(i32 %0) {
%2 = tail call i64 @check_gpio(i32 %0)
%3 = icmp slt i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call %struct.gpio_bank* @get_gpio_bank(i32 %0)
%6 = tail call i32 @_reset_gpio(%struct.gpio_bank* %5, i32 %0)
br label %7
7: ; preds = %1, %4
ret void
}
/* Variables and functions */
unsigned int UINT_MAX;
unsigned int diff_timestamp(unsigned int prev, unsigned int now) {
  if (now < prev) {
    return UINT_MAX - (prev - now) + 1;
  }
  return now - prev;
}


x86 assembly (clang, -O0):
<diff_timestamp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    1132 <diff_timestamp+0x32>
mov    0x2ecb(%rip),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
sub    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113b <diff_timestamp+0x3b>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<diff_timestamp>:
mov    %esi,%eax
sub    %edi,%eax
jae    1116 <diff_timestamp+0x16>
mov    0x2edb(%rip),%rax
mov    (%rax),%eax
sub    %edi,%esi
add    %esi,%eax
add    $0x1,%eax
ret

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

LLVM IR (-O2):
@UINT_MAX = global i32 0
define i32 @diff_timestamp(i32 %0, i32 %1) {
%3 = icmp ult i32 %1, %0
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @UINT_MAX
%6 = sub i32 1, %0
%7 = add i32 %6, %1
%8 = add i32 %7, %5
br label %11
9: ; preds = %2
%10 = sub i32 %1, %0
br label %11
11: ; preds = %9, %4
%12 = phi i32 [ %8, %4 ], [ %10, %9 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
void pressAnyKeyToContinue() {
  printf("Press any key to continue . . .");
  getchar();
}


x86 assembly (clang, -O0):
<pressAnyKeyToContinue>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pressAnyKeyToContinue>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <getchar@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Press any key to continue . . .\00"
define void @pressAnyKeyToContinue() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @getchar()
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"Press any key to continue . . .\00"
define void @pressAnyKeyToContinue() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ derefArgCast(char *);
int *getNull();
void ternaryArgCast(char cond) {
  static int x;
  derefArgCast((char *)((unsigned)cond ? &x : getNull()));
}


x86 assembly (clang, -O0):
<ternaryArgCast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x0,%eax
je     114b <ternaryArgCast+0x2b>
lea    0x2ef2(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1156 <ternaryArgCast+0x36>
mov    $0x0,%al
call   1030 <getNull@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <derefArgCast@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ternaryArgCast>:
test   %dil,%dil
je     1131 <ternaryArgCast+0x11>
lea    0x2f08(%rip),%rdi
jmp    1040 <derefArgCast@plt>
push   %rax
xor    %eax,%eax
call   1030 <getNull@plt>
mov    %rax,%rdi
add    $0x8,%rsp
jmp    1040 <derefArgCast@plt>

LLVM IR (-O0):
@ternaryArgCast.x = internal global i32 0
define void @ternaryArgCast(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
br label %9
7: ; preds = %1
%8 = call i32* (...) @getNull()
br label %9
9: ; preds = %7, %6
%10 = phi i32* [ @ternaryArgCast.x, %6 ], [ %8, %7 ]
%11 = bitcast i32* %10 to i8*
%12 = call i32 @derefArgCast(i8* %11)
ret void
}

LLVM IR (-O2):
@ternaryArgCast.x = internal global i32 0
define void @ternaryArgCast(i8 signext %0) {
%2 = icmp eq i8 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32* (...) @getNull()
%5 = bitcast i32* %4 to i8*
br label %6
6: ; preds = %1, %3
%7 = phi i8* [ %5, %3 ], [ bitcast (i32* @ternaryArgCast.x to i8*), %1 ]
%8 = tail call i32 @derefArgCast(i8* %7)
ret void
}