xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void easycharts_output_html(FILE *chart_file) {
  fprintf(chart_file,
          "<html><head><title>Easychart</title></head>\n"
          "<body onload=\"javascript:status='';\"></body></html>\n");
}


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

x86 assembly (clang, -O2):
<easycharts_output_html>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
mov    $0x60,%esi
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [97 x i8] c"<html><head><title>Easychart</title></head>\0A<body onload=\22javascript:status='';\22></body></html>\0A\00"
define void @easycharts_output_html(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [97 x i8] c"<html><head><title>Easychart</title></head>\0A<body onload=\22javascript:status='';\22></body></html>\0A\00"
define void @easycharts_output_html(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str, i64 0, i64 0), i64 96, i64 1, i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LED_CTRL_SaveConfig();
void LED_CTRL_Sleep(void) { LED_CTRL_SaveConfig(); }


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

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

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

LLVM IR (-O2):
define void @LED_CTRL_Sleep() {
%1 = tail call i32 (...) @LED_CTRL_SaveConfig()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ splitpath(char *, char **, char **);
char *dirname(char *path) {
  char *dir, *base;
  splitpath(path, &dir, &base);
  return dir;
}


x86 assembly (clang, -O0):
<dirname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <splitpath@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dirname>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1030 <splitpath@plt>
mov    0x8(%rsp),%rax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define i8* @dirname(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = bitcast i8** %2 to i8*
%5 = bitcast i8** %3 to i8*
%6 = call i32 @splitpath(i8* %0, i8** %2, i8** %3)
%7 = load i8*, i8** %2
ret i8* %7
}
int ifunc1(void) { return 0xdeadbeef; }


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

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

LLVM IR (-O0):
define i32 @ifunc1() {
ret i32 -559038737
}

LLVM IR (-O2):
define i32 @ifunc1() {
ret i32 -559038737
}
/* Variables and functions */
void _advance_buffer(size_t *size, void **buffer, size_t bytes) {
  *size -= bytes;
  *buffer += bytes;
}


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

x86 assembly (clang, -O2):
<_advance_buffer>:
sub    %rdx,(%rdi)
add    %rdx,(%rsi)
ret

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

LLVM IR (-O2):
define void @_advance_buffer(i64* nocapture %0, i8** nocapture %1, i64 %2) {
%4 = load i64, i64* %0
%5 = sub i64 %4, %2
store i64 %5, i64* %0
%6 = load i8*, i8** %1
%7 = getelementptr i8, i8* %6, i64 %2
store i8* %7, i8** %1
ret void
}
/* Variables and functions */
int foo(int, int *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(void) {
  fputs("UBSAN TEST START\n", stderr);
  int a[6] = {};
  int ret = foo(3, a);
  fputs("UBSAN TEST END\n", stderr);
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%esi
lea    0xeb1(%rip),%rdi
call   1030 <fputs@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
lea    -0x20(%rbp),%rsi
mov    $0x3,%edi
call   1050 <foo@plt>
mov    %eax,-0x24(%rbp)
mov    0x2e64(%rip),%rax
mov    (%rax),%esi
lea    0xe8d(%rip),%rdi
call   1030 <fputs@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x2eb2(%rip),%r14
mov    (%r14),%esi
lea    0xec8(%rip),%rdi
call   1030 <fputs@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movq   $0x0,0x10(%rsp)
mov    %rsp,%rsi
mov    $0x3,%edi
call   1040 <foo@plt>
mov    %eax,%ebx
mov    (%r14),%esi
lea    0xeac(%rip),%rdi
call   1030 <fputs@plt>
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"UBSAN TEST START\0A\00"
@stderr = global i32 0
@.str.1 = [16 x i8] c"UBSAN TEST END\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = load i32, i32* @stderr
%5 = call i32 @fputs(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = bitcast [6 x i32]* %2 to i8*
%7 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%8 = call i32 @foo(i32 3, i32* %7)
store i32 %8, i32* %3
%9 = load i32, i32* @stderr
%10 = call i32 @fputs(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
@.str = [18 x i8] c"UBSAN TEST START\0A\00"
@stderr = global i32 0
@.str.1 = [16 x i8] c"UBSAN TEST END\0A\00"
define i32 @main() {
%1 = alloca [6 x i32]
%2 = load i32, i32* @stderr
%3 = tail call i32 @fputs(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = bitcast [6 x i32]* %1 to i8*
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%6 = call i32 @foo(i32 3, i32* %5)
%7 = load i32, i32* @stderr
%8 = call i32 @fputs(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i32 %6
}
int rte_oo_order(unsigned long x) { return x >> 16; }


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

x86 assembly (clang, -O2):
<rte_oo_order>:
mov    %rdi,%rax
shr    $0x10,%rax
ret

LLVM IR (-O0):
define i32 @rte_oo_order(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @rte_oo_order(i64 %0) {
%2 = lshr i64 %0, 16
%3 = trunc i64 %2 to i32
ret i32 %3
}
void ff_hevc_put_hevc_uni_w_epel_v48_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_w_epel_v48_12_sse4() {
ret void
}
double drand(double seed) {
  int q;
  seed *= 1389796;
  q = (int)(seed / 2147483647);
  seed -= (double)q * 2147483647;
  return seed / 2147483647;
}


x86 assembly (clang, -O0):
<drand>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed8(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xea4(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe8a(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<drand>:
mulsd  0xef8(%rip),%xmm0
movsd  0xef8(%rip),%xmm1
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
cvttpd2dq %xmm2,%xmm2
cvtdq2pd %xmm2,%xmm2
mulsd  %xmm1,%xmm2
subsd  %xmm2,%xmm0
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @drand(double %0) {
%2 = alloca double
%3 = alloca i32
store double %0, double* %2
%4 = load double, double* %2
%5 = fmul double %4, 0x413534E400000000
store double %5, double* %2
%6 = load double, double* %2
%7 = fdiv double %6, 0x41DFFFFFFFC00000
%8 = fptosi double %7 to i32
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = sitofp i32 %9 to double
%11 = load double, double* %2
%12 = fneg double %10
%13 = call double @llvm.fmuladd.f64(double %12, double 0x41DFFFFFFFC00000, double %11)
store double %13, double* %2
%14 = load double, double* %2
%15 = fdiv double %14, 0x41DFFFFFFFC00000
ret double %15
}

LLVM IR (-O2):
define double @drand(double %0) {
%2 = fmul double %0, 0x413534E400000000
%3 = fdiv double %2, 0x41DFFFFFFFC00000
%4 = fptosi double %3 to i32
%5 = sitofp i32 %4 to double
%6 = fneg double %5
%7 = tail call double @llvm.fmuladd.f64(double %6, double 0x41DFFFFFFFC00000, double %2)
%8 = fdiv double %7, 0x41DFFFFFFFC00000
ret double %8
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int write_quaddobl_target_solutions(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(247, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<write_quaddobl_target_solutions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0xf7,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_quaddobl_target_solutions>:
mov    $0xf7,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

LLVM IR (-O0):
define i32 @write_quaddobl_target_solutions() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc4c(i32 247, i32* %5, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @write_quaddobl_target_solutions() {
%1 = tail call i32 @_ada_use_c2phc4c(i32 247, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
char *deblank(char *str) {
  char *out = str, *put = str;
  for (; *str != '\0'; ++str) {
    if ((*str != ' ') || (*str != '\n'))
      *put++ = *str;
  }
  *put = '\0';
  return out;
}


x86 assembly (clang, -O0):
<deblank>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1175 <deblank+0x75>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1148 <deblank+0x48>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     115f <deblank+0x5f>
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    1164 <deblank+0x64>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1118 <deblank+0x18>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<deblank>:
mov    %rdi,%rax
mov    (%rdi),%cl
mov    %rdi,%rdx
test   %cl,%cl
je     111e <deblank+0x1e>
mov    %rax,%rdx
nop
mov    %cl,(%rdx)
movzbl 0x1(%rdx),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1110 <deblank+0x10>
movb   $0x0,(%rdx)
ret

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

LLVM IR (-O2):
define i8* @deblank(i8* returned %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %8, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
store i8 %5, i8* %6
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %4
10: ; preds = %4, %1
%11 = phi i8* [ %0, %1 ], [ %7, %4 ]
store i8 0, i8* %11
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ railroad(char **);
int main(int argc, char *argv[]) {
  if (argc > 1) {
    railroad(argv + 1);
  } else {
    static char *hello[] = {"Hello World", 0};
    railroad(hello);
  }
  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   $0x1,-0x8(%rbp)
jle    1142 <main+0x32>
mov    -0x10(%rbp),%rdi
add    $0x8,%rdi
call   1030 <railroad@plt>
jmp    114e <main+0x3e>
lea    0x2ee7(%rip),%rdi
call   1030 <railroad@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jl     111f <main+0xf>
add    $0x8,%rsi
mov    %rsi,%rdi
jmp    1126 <main+0x16>
lea    0x2f0a(%rip),%rdi
call   1030 <railroad@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@main.hello = internal global [2 x i8*] [i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i8* null]
@.str = [12 x i8] c"Hello World\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 sgt i32 %6, 1
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = call i32 @railroad(i8** %10)
br label %14
12: ; preds = %2
%13 = call i32 @railroad(i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @main.hello, i64 0, i64 0))
br label %14
14: ; preds = %12, %8
ret i32 0
}

LLVM IR (-O2):
@main.hello = internal global [2 x i8*] [i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i8* null]
@.str = [12 x i8] c"Hello World\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = tail call i32 @railroad(i8** %5)
br label %9
7: ; preds = %2
%8 = tail call i32 @railroad(i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @main.hello, i64 0, i64 0))
br label %9
9: ; preds = %7, %4
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int alph_num(int type) {
  switch (type) {
  case 0:
    return 5;
  case 1:
    return 17;
  case 2:
    return 27;
  default:
    abort();
  }
}


x86 assembly (clang, -O0):
<alph_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     1150 <alph_num+0x40>
jmp    112e <alph_num+0x1e>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     115c <alph_num+0x4c>
jmp    113f <alph_num+0x2f>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1168 <alph_num+0x58>
jmp    1174 <alph_num+0x64>
movl   $0x5,-0x4(%rbp)
jmp    117b <alph_num+0x6b>
movl   $0x11,-0x4(%rbp)
jmp    117b <alph_num+0x6b>
movl   $0x1b,-0x4(%rbp)
jmp    117b <alph_num+0x6b>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alph_num>:
push   %rax
cmp    $0x3,%edi
jae    1125 <alph_num+0x15>
movslq %edi,%rax
lea    0xee0(%rip),%rcx
mov    (%rcx,%rax,4),%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @alph_num(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
]
5: ; preds = %1
store i32 5, i32* %2
br label %10
6: ; preds = %1
store i32 17, i32* %2
br label %10
7: ; preds = %1
store i32 27, i32* %2
br label %10
8: ; preds = %1
%9 = call i32 (...) @abort()
unreachable
10: ; preds = %7, %6, %5
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@switch.table.alph_num = [3 x i32] [i32 5, i32 17, i32 27]
define i32 @alph_num(i32 %0) {
%2 = icmp ult i32 %0, 3
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
%6 = sext i32 %0 to i64
%7 = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.alph_num, i64 0, i64 %6
%8 = load i32, i32* %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ phred64ToPhred(char);
double phredToDouble(int /*<<< orphan*/);
double phred64ToDouble(char p) { return phredToDouble(phred64ToPhred(p)); }


x86 assembly (clang, -O0):
<phred64ToDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <phred64ToPhred@plt>
mov    %eax,%edi
call   1030 <phredToDouble@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phred64ToDouble>:
push   %rax
call   1040 <phred64ToPhred@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <phredToDouble@plt>

LLVM IR (-O0):
define double @phred64ToDouble(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @phred64ToPhred(i8 signext %3)
%5 = call double @phredToDouble(i32 %4)
ret double %5
}

LLVM IR (-O2):
define double @phred64ToDouble(i8 signext %0) {
%2 = tail call i32 @phred64ToPhred(i8 signext %0)
%3 = tail call double @phredToDouble(i32 %2)
ret double %3
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ getdelim(char **, size_t *, char, int /*<<< orphan*/ *);
ssize_t getline(char **restrict lineptr, size_t *restrict n,
                FILE *restrict stream) {
  return getdelim(lineptr, n, '\n', stream);
}


x86 assembly (clang, -O0):
<getline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    $0xa,%edx
call   1030 <getdelim@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getline>:
mov    %rdx,%rcx
mov    $0xa,%edx
jmp    1030 <getdelim@plt>

LLVM IR (-O0):
define i32 @getline(i8** noalias %0, i64* noalias %1, i32* noalias %2) {
%4 = alloca i8**
%5 = alloca i64*
%6 = alloca i32*
store i8** %0, i8*** %4
store i64* %1, i64** %5
store i32* %2, i32** %6
%7 = load i8**, i8*** %4
%8 = load i64*, i64** %5
%9 = load i32*, i32** %6
%10 = call i32 @getdelim(i8** %7, i64* %8, i8 signext 10, i32* %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @getline(i8** noalias %0, i64* noalias %1, i32* noalias %2) {
%4 = tail call i32 @getdelim(i8** %0, i64* %1, i8 signext 10, i32* %2)
ret i32 %4
}
int test_imm_0Fint8_mem(signed char *val) {
  return ((*val) & (0x0F << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_0Fint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%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_0Fint8_mem>:
testb  $0xf,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_0Fint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, 15
%7 = icmp ne i32 %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_0Fint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 15
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void sig_handler(int signum) {
  printf("\nInterrupted.\n");
  exit(0);
}


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

x86 assembly (clang, -O2):
<sig_handler>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"\0AInterrupted.\0A\00"
define void @sig_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [14 x i8] c"\0AInterrupted.\00"
define void @sig_handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 0)
unreachable
}
int main() {
  int data1 = 10;
  int data2 = 20;
  __asm__ __volatile__("imull %1, %0" : "=r"(data2) : "m"(data1), "0"(data2));
  printf("The result is %d\n", data2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x14,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0xa,0x4(%rsp)
mov    $0x14,%esi
imul   0x4(%rsp),%esi
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"The result is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
store i32 20, i32* %3
%4 = load i32, i32* %3
%5 = call i32 asm sideeffect "imull $1, $0", "=r,*m,0,~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %2, i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"The result is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 10, i32* %1
%3 = call i32 asm sideeffect "imull $1, $0", "=r,*m,0,~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %1, i32 20)
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
void vuln_func(char *buffer) {
  char local_buffer[10];
  strcpy(local_buffer, buffer);
}


x86 assembly (clang, -O0):
<vuln_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x12(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vuln_func>:
sub    $0x18,%rsp
mov    %rdi,%rsi
lea    0xe(%rsp),%rdi
call   1030 <strcpy@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @vuln_func(i8* %0) {
%2 = alloca i8*
%3 = alloca [10 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @strcpy(i8* %4, i8* %5)
ret void
}

LLVM IR (-O2):
define void @vuln_func(i8* %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* %0)
ret void
}
int my_strlen(char *str) {
  int i;
  i = 0;
  while (str[i] != '\0')
    i++;
  return i;
}


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

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

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

LLVM IR (-O2):
define i32 @my_strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
float clamp(float p, float lo, float hi) {
  if (p > hi) {
    return hi;
  } else if (p < lo) {
    return lo;
  } else {
    return p;
  }
}


x86 assembly (clang, -O0):
<clamp>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1131 <clamp+0x31>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    115d <clamp+0x5d>
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1153 <clamp+0x53>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    115d <clamp+0x5d>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp>:
maxss  %xmm0,%xmm1
movaps %xmm2,%xmm3
cmpltss %xmm0,%xmm3
movaps %xmm3,%xmm0
andnps %xmm1,%xmm0
andps  %xmm2,%xmm3
orps   %xmm0,%xmm3
movaps %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @clamp(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
%8 = load float, float* %5
%9 = load float, float* %7
%10 = fcmp ogt float %8, %9
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = load float, float* %7
store float %12, float* %4
br label %21
13: ; preds = %3
%14 = load float, float* %5
%15 = load float, float* %6
%16 = fcmp olt float %14, %15
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = load float, float* %6
store float %18, float* %4
br label %21
19: ; preds = %13
%20 = load float, float* %5
store float %20, float* %4
br label %21
21: ; preds = %19, %17, %11
%22 = load float, float* %4
ret float %22
}

LLVM IR (-O2):
define float @clamp(float %0, float %1, float %2) {
%4 = fcmp ogt float %0, %2
%5 = fcmp olt float %0, %1
%6 = select i1 %5, float %1, float %0
%7 = select i1 %4, float %2, float %6
ret float %7
}
/* Variables and functions */
float pow(int, int);
float QToFloat(int num) { return pow(2, -16) * (float)num; }


x86 assembly (clang, -O0):
<QToFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x2,%edi
mov    $0xfffffff0,%esi
call   1030 <pow@plt>
cvtsi2ssl -0x4(%rbp),%xmm1
mulss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<QToFloat>:
push   %rbx
mov    %edi,%ebx
mov    $0x2,%edi
mov    $0xfffffff0,%esi
call   1030 <pow@plt>
cvtsi2ss %ebx,%xmm1
mulss  %xmm1,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define float @QToFloat(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call float @pow(i32 2, i32 -16)
%4 = load i32, i32* %2
%5 = sitofp i32 %4 to float
%6 = fmul float %3, %5
ret float %6
}

LLVM IR (-O2):
define float @QToFloat(i32 %0) {
%2 = tail call float @pow(i32 2, i32 -16)
%3 = sitofp i32 %0 to float
%4 = fmul float %2, %3
ret float %4
}
/* Variables and functions */
int close(int);
int socket_close(int fd) { return close(fd); }


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

x86 assembly (clang, -O2):
<socket_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define i32 @socket_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 %2
}
int numb(char *str) {
  int k;
  for (k = 0; *str >= '0' && *str <= '9'; str++)
    k = k * 10 + *str - '0';
  return (k);
}


x86 assembly (clang, -O0):
<numb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0xd(%rbp)
jl     1134 <numb+0x34>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1144 <numb+0x44>
jmp    1168 <numb+0x68>
imul   $0xa,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <numb+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<numb>:
mov    (%rdi),%cl
lea    -0x30(%rcx),%edx
xor    %eax,%eax
cmp    $0x9,%dl
ja     113b <numb+0x3b>
add    $0x1,%rdi
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl %cl,%ecx
lea    (%rax,%rax,4),%eax
lea    (%rcx,%rax,2),%eax
add    $0xffffffd0,%eax
movzbl (%rdi),%ecx
lea    -0x30(%rcx),%edx
add    $0x1,%rdi
cmp    $0xa,%dl
jb     1120 <numb+0x20>
ret

LLVM IR (-O0):
define i32 @numb(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %24, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp sge i32 %7, 48
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = load i8*, i8** %2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp sle i32 %12, 57
br label %14
14: ; preds = %9, %4
%15 = phi i1 [ false, %4 ], [ %13, %9 ]
br i1 %15, label %16, label %27
16: ; preds = %14
%17 = load i32, i32* %3
%18 = mul nsw i32 %17, 10
%19 = load i8*, i8** %2
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = add nsw i32 %18, %21
%23 = sub nsw i32 %22, 48
store i32 %23, i32* %3
br label %24
24: ; preds = %16
%25 = load i8*, i8** %2
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %2
br label %4
27: ; preds = %14
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
define i32 @numb(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, -48
%4 = icmp ult i8 %3, 10
br i1 %4, label %5, label %17
5: ; preds = %1, %5
%6 = phi i8 [ %14, %5 ], [ %2, %1 ]
%7 = phi i32 [ %12, %5 ], [ 0, %1 ]
%8 = phi i8* [ %13, %5 ], [ %0, %1 ]
%9 = zext i8 %6 to i32
%10 = mul nsw i32 %7, 10
%11 = add i32 %10, -48
%12 = add i32 %11, %9
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = load i8, i8* %13
%15 = add i8 %14, -48
%16 = icmp ult i8 %15, 10
br i1 %16, label %5, label %17
17: ; preds = %5, %1
%18 = phi i32 [ 0, %1 ], [ %12, %5 ]
ret i32 %18
}
double make_double(double x) { return x * 2; }


x86 assembly (clang, -O0):
<make_double>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_double>:
addsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @make_double(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 2.000000e+00
ret double %4
}

LLVM IR (-O2):
define double @make_double(double %0) {
%2 = fmul double %0, 2.000000e+00
ret double %2
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ _color_set(int, int);
void vt_color_bg_set(uint8_t color) {
  if (color > 7) {
    return;
  }
  _color_set(40, color);
}


x86 assembly (clang, -O0):
<vt_color_bg_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x7,-0x4(%rbp)
jle    112a <vt_color_bg_set+0x1a>
jmp    1137 <vt_color_bg_set+0x27>
mov    -0x4(%rbp),%esi
mov    $0x28,%edi
call   1030 <_color_set@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vt_color_bg_set>:
cmp    $0x7,%edi
jle    1116 <vt_color_bg_set+0x6>
ret
mov    %edi,%esi
mov    $0x28,%edi
jmp    1030 <_color_set@plt>

LLVM IR (-O0):
define void @vt_color_bg_set(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 7
br i1 %4, label %5, label %6
5: ; preds = %1
br label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @_color_set(i32 40, i32 %7)
br label %9
9: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
define void @vt_color_bg_set(i32 %0) {
%2 = icmp sgt i32 %0, 7
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @_color_set(i32 40, i32 %0)
br label %5
5: ; preds = %1, %3
ret void
}
/* Variables and functions */
int NthUglyNumber(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int num;
  printf("Enter the Nth number: ");
  scanf("%d", &num);
  int no = NthUglyNumber(num);
  printf("%dth ugly no. is %d ", num, no);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1030 <NthUglyNumber@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1030 <NthUglyNumber@plt>
mov    0x4(%rsp),%esi
lea    0xeb6(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter the Nth number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [21 x i8] c"%dth ugly no. is %d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = call i32 @NthUglyNumber(i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Enter the Nth number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [21 x i8] c"%dth ugly no. is %d \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @NthUglyNumber(i32 %5)
%7 = load i32, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %6)
ret i32 0
}
void gtk_combo_box_set_model() {}


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

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

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

LLVM IR (-O2):
define void @gtk_combo_box_set_model() {
ret void
}
int next_rqueue_idx(int idx) { return ++idx % (10 * 2 + 1); }


x86 assembly (clang, -O0):
<next_rqueue_idx>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    $0x15,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_rqueue_idx>:
add    $0x1,%edi
movslq %edi,%rax
imul   $0x30c30c31,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,4),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @next_rqueue_idx(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
store i32 %4, i32* %2
%5 = srem i32 %4, 21
ret i32 %5
}

LLVM IR (-O2):
define i32 @next_rqueue_idx(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = srem i32 %2, 21
ret i32 %3
}
void r8a7740_init_pm_domains(void) {}


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

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

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

LLVM IR (-O2):
define void @r8a7740_init_pm_domains() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void final() {
  endwin();
  exit(0);
}


x86 assembly (clang, -O0):
<final>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <endwin@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<final>:
push   %rax
xor    %eax,%eax
call   1030 <endwin@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @final() {
%1 = call i32 (...) @endwin()
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @final() {
%1 = tail call i32 (...) @endwin()
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ SIGALRM;
scalar_t__ SIG_ERR;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ signal(int /*<<< orphan*/, void (*)());
void timeout() {
  if (signal(SIGALRM, timeout) == SIG_ERR)
    exit(errno);
}


x86 assembly (clang, -O0):
<timeout>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    0x2e94(%rip),%rsi
call   1030 <signal@plt>
mov    0x2e98(%rip),%rcx
cmp    (%rcx),%rax
jne    1157 <timeout+0x37>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeout>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
mov    0x2e97(%rip),%rsi
call   1030 <signal@plt>
mov    0x2e9b(%rip),%rcx
cmp    (%rcx),%rax
je     1144 <timeout+0x24>
pop    %rax
ret
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@SIGALRM = global i32 0
@SIG_ERR = global i64 0
@errno = global i32 0
define void @timeout() {
%1 = load i32, i32* @SIGALRM
%2 = call i64 @signal(i32 %1, void (...)* bitcast (void ()* @timeout to void (...)*))
%3 = load i64, i64* @SIG_ERR
%4 = icmp eq i64 %2, %3
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32, i32* @errno
%7 = call i32 @exit(i32 %6)
unreachable
8: ; preds = %0
ret void
}

LLVM IR (-O2):
@SIGALRM = global i32 0
@SIG_ERR = global i64 0
@errno = global i32 0
define void @timeout() {
%1 = load i32, i32* @SIGALRM
%2 = tail call i64 @signal(i32 %1, void (...)* bitcast (void ()* @timeout to void (...)*))
%3 = load i64, i64* @SIG_ERR
%4 = icmp eq i64 %2, %3
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32, i32* @errno
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %0
ret void
}
/* Variables and functions */
int yaffs_link_reldir(int /*<<< orphan*/, char const *, char const *);
int yaffs_link(const char *oldpath, const char *linkpath) {
  return yaffs_link_reldir((0), oldpath, linkpath);
}


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

x86 assembly (clang, -O2):
<yaffs_link>:
mov    %rsi,%rdx
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <yaffs_link_reldir@plt>

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

LLVM IR (-O2):
define i32 @yaffs_link(i8* %0, i8* %1) {
%3 = tail call i32 @yaffs_link_reldir(i32 0, i8* %0, i8* %1)
ret i32 %3
}
void foo(void) {
  int i, j;
#pragma omp for collapse(2)
  for (i = 0; i < 10; ++i)
    for (j = 0; j <= i; ++j)
      ;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    114e <foo+0x4e>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     113b <foo+0x3b>
jmp    112d <foo+0x2d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111c <foo+0x1c>
jmp    1140 <foo+0x40>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <foo+0xb>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @foo() {
ret void
}
int main(void) { int f(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
void print_prop(int x, int max, char prop[]) {
  if ((x - 1) > max)
    printf("You said\n%s", prop);
  else
    puts("Not enough characters");
}


x86 assembly (clang, -O0):
<print_prop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cmp    -0x8(%rbp),%eax
jle    1156 <print_prop+0x36>
mov    -0x10(%rbp),%rsi
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
jmp    1162 <print_prop+0x42>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_prop>:
add    $0xffffffff,%edi
cmp    %esi,%edi
jle    1136 <print_prop+0x16>
lea    0xed2(%rip),%rdi
mov    %rdx,%rsi
jmp    1040 <printf@plt>
lea    0xecf(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"You said\0A%s\00"
@.str.1 = [22 x i8] c"Not enough characters\00"
define void @print_prop(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = sub nsw i32 %7, 1
%9 = load i32, i32* %5
%10 = icmp sgt i32 %8, %9
br i1 %10, label %11, label %14
11: ; preds = %3
%12 = load i8*, i8** %6
%13 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %16
14: ; preds = %3
%15 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"You said\0A%s\00"
@.str.1 = [22 x i8] c"Not enough characters\00"
define void @print_prop(i32 %0, i32 %1, i8* %2) {
%4 = add nsw i32 %0, -1
%5 = icmp sgt i32 %4, %1
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %10
8: ; preds = %3
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void on_test_result(int total, int ok, int fail) {
  int ret;
  if (total > 0 && (total == ok) && fail == 0) {
    ret = 0;
  } else {
    ret = 1;
  }
  exit(ret);
}


x86 assembly (clang, -O0):
<on_test_result>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    114d <on_test_result+0x3d>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    114d <on_test_result+0x3d>
cmpl   $0x0,-0xc(%rbp)
jne    114d <on_test_result+0x3d>
movl   $0x0,-0x10(%rbp)
jmp    1154 <on_test_result+0x44>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<on_test_result>:
test   %edi,%edi
jle    1124 <on_test_result+0x14>
cmp    %esi,%edi
jne    1124 <on_test_result+0x14>
xor    %edi,%edi
test   %edx,%edx
jne    1124 <on_test_result+0x14>
push   %rax
call   1030 <exit@plt>
mov    $0x1,%edi
push   %rax
call   1030 <exit@plt>

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

LLVM IR (-O2):
define void @on_test_result(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %9
5: ; preds = %3
%6 = icmp eq i32 %0, %1
%7 = icmp eq i32 %2, 0
%8 = and i1 %6, %7
br i1 %8, label %10, label %9
9: ; preds = %5, %3
br label %10
10: ; preds = %5, %9
%11 = phi i32 [ 1, %9 ], [ 0, %5 ]
%12 = tail call i32 @exit(i32 %11)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ console_tx_hex16(unsigned short);
void print_debug_hex16(unsigned short value) { console_tx_hex16(value); }


x86 assembly (clang, -O0):
<print_debug_hex16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edi
call   1030 <console_tx_hex16@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_debug_hex16>:
jmp    1030 <console_tx_hex16@plt>

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

LLVM IR (-O2):
define void @print_debug_hex16(i16 zeroext %0) {
%2 = tail call i32 @console_tx_hex16(i16 zeroext %0)
ret void
}
void INT_Excep_CAN0_TXM0(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_CAN0_TXM0() {
ret void
}