xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ test_assert(int);
int main(void) {
  char a[] = "Hello, world";
  int *p = (int *)a;
  *p = 0;
  test_assert(a[3] == 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x11(%rbp)
mov    0xed8(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xed3(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x11(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
movsbl -0xe(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <test_assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <test_assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.a = [13 x i8] c"Hello, world\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x i8]
%3 = alloca i32*
store i32 0, i32* %1
%4 = bitcast [13 x i8]* %2 to i8*
%5 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%6 = bitcast i8* %5 to i32*
store i32* %6, i32** %3
%7 = load i32*, i32** %3
store i32 0, i32* %7
%8 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 3
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 0
%12 = zext i1 %11 to i32
%13 = call i32 @test_assert(i32 %12)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test_assert(i32 1)
ret i32 0
}
void proc55() {}


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

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

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

LLVM IR (-O2):
define void @proc55() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ microdelay(int);
void nanodelay() { microdelay(10); }


x86 assembly (clang, -O0):
<nanodelay>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
call   1030 <microdelay@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @nanodelay() {
%1 = call i32 @microdelay(i32 10)
ret void
}

LLVM IR (-O2):
define void @nanodelay() {
%1 = tail call i32 @microdelay(i32 10)
ret void
}
void generet() {}


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

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

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

LLVM IR (-O2):
define void @generet() {
ret void
}
int foo(int bar) {
  int idx;
  int res = 0;
  for (idx = 1; idx < bar; idx++)
    res += idx;
  res *= idx;
  return res;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1138 <foo+0x38>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1115 <foo+0x15>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
xor    %eax,%eax
cmp    $0x2,%edi
jl     111d <foo+0x1d>
lea    -0x2(%rdi),%eax
lea    -0x3(%rdi),%ecx
imul   %rax,%rcx
shr    %rcx
lea    (%rcx,%rdi,2),%eax
add    $0xfffffffd,%eax
imul   %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %15
3: ; preds = %1
%4 = shl nuw i32 %0, 1
%5 = add nsw i32 %0, -2
%6 = zext i32 %5 to i33
%7 = add nsw i32 %0, -3
%8 = zext i32 %7 to i33
%9 = mul i33 %6, %8
%10 = lshr i33 %9, 1
%11 = trunc i33 %10 to i32
%12 = add i32 %4, %11
%13 = add i32 %12, -3
%14 = mul nsw i32 %13, %0
br label %15
15: ; preds = %3, %1
%16 = phi i32 [ %14, %3 ], [ 0, %1 ]
ret i32 %16
}
void glutDisplayFunc(void (*func)()) {}


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

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

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

LLVM IR (-O2):
define void @glutDisplayFunc(void (...)* nocapture %0) {
ret void
}
/* Type definitions */
struct listinfo {
  int dummy;
};
struct index_scanner {
  int dummy;
};

/* Variables and functions */
struct listinfo *get_list_at(struct index_scanner *, struct listinfo *, int);
struct listinfo *get_next_list(struct index_scanner *iscn,
                               struct listinfo *info) {
  return get_list_at(iscn, info, -1);
}


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

x86 assembly (clang, -O2):
<get_next_list>:
mov    $0xffffffff,%edx
jmp    1030 <get_list_at@plt>

LLVM IR (-O0):
%struct.index_scanner = type { i32 }
%struct.listinfo = type { i32 }
define %struct.listinfo* @get_next_list(%struct.index_scanner* %0, %struct.listinfo* %1) {
%3 = alloca %struct.index_scanner*
%4 = alloca %struct.listinfo*
store %struct.index_scanner* %0, %struct.index_scanner** %3
store %struct.listinfo* %1, %struct.listinfo** %4
%5 = load %struct.index_scanner*, %struct.index_scanner** %3
%6 = load %struct.listinfo*, %struct.listinfo** %4
%7 = call %struct.listinfo* @get_list_at(%struct.index_scanner* %5, %struct.listinfo* %6, i32 -1)
ret %struct.listinfo* %7
}

LLVM IR (-O2):
%struct.index_scanner = type { i32 }
%struct.listinfo = type { i32 }
define %struct.listinfo* @get_next_list(%struct.index_scanner* %0, %struct.listinfo* %1) {
%3 = tail call %struct.listinfo* @get_list_at(%struct.index_scanner* %0, %struct.listinfo* %1, i32 -1)
ret %struct.listinfo* %3
}
void func(void) {
  printf("in func %s, line %d\n", __func__, 8);
  return;
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xef3(%rip),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
lea    0xee9(%rip),%rdi
lea    0xef7(%rip),%rsi
mov    $0x8,%edx
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"in func %s, line %d\0A\00"
@__func__.func = [5 x i8] c"func\00"
define void @func() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.func, i64 0, i64 0), i32 8)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"in func %s, line %d\0A\00"
@__func__.func = [5 x i8] c"func\00"
define void @func() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.func, i64 0, i64 0), i32 8)
ret void
}
char *strtok(char *s, const char *delim) {
  static char *local;
  local = s;
  s[1] = *delim;
  return s;
}


x86 assembly (clang, -O0):
<strtok>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,0x2f11(%rip)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtok>:
mov    %rdi,%rax
mov    (%rsi),%cl
mov    %cl,0x1(%rdi)
ret

LLVM IR (-O0):
@strtok.local = internal global i8* null
define i8* @strtok(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
store i8* %5, i8** @strtok.local
%6 = load i8*, i8** %4
%7 = load i8, i8* %6
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %7, i8* %9
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
define i8* @strtok(i8* returned %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %3, i8* %4
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ inputStream_initFile();
int /*<<< orphan*/ inputStream_initHttp();
void initInputStream() {
  inputStream_initFile();
  inputStream_initHttp();
}


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

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

LLVM IR (-O0):
define void @initInputStream() {
%1 = call i32 (...) @inputStream_initFile()
%2 = call i32 (...) @inputStream_initHttp()
ret void
}

LLVM IR (-O2):
define void @initInputStream() {
%1 = tail call i32 (...) @inputStream_initFile()
%2 = tail call i32 (...) @inputStream_initHttp()
ret void
}
/* Type definitions */
struct pattern {
  int dummy;
};

/* Variables and functions */
int countlib(int);
int offset(int, int, int, int);
int autohelperowl_attackpat117(struct pattern *patt, int transformation,
                               int move, int color, int action) {
  int A;
  (void)patt;
  (void)color;
  (void)action;
  A = offset(-2, -1, move, transformation);
  return countlib(A) == 3;
}


x86 assembly (clang, -O0):
<autohelperowl_attackpat117>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    $0xfffffffe,%edi
mov    $0xffffffff,%esi
call   1030 <offset@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1040 <countlib@plt>
cmp    $0x3,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<autohelperowl_attackpat117>:
push   %rax
mov    %esi,%ecx
mov    $0xfffffffe,%edi
mov    $0xffffffff,%esi
call   1030 <offset@plt>
mov    %eax,%edi
call   1040 <countlib@plt>
xor    %ecx,%ecx
cmp    $0x3,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.pattern = type { i32 }
define i32 @autohelperowl_attackpat117(%struct.pattern* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct.pattern*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store %struct.pattern* %0, %struct.pattern** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = load %struct.pattern*, %struct.pattern** %6
%13 = load i32, i32* %9
%14 = load i32, i32* %10
%15 = load i32, i32* %8
%16 = load i32, i32* %7
%17 = call i32 @offset(i32 -2, i32 -1, i32 %15, i32 %16)
store i32 %17, i32* %11
%18 = load i32, i32* %11
%19 = call i32 @countlib(i32 %18)
%20 = icmp eq i32 %19, 3
%21 = zext i1 %20 to i32
ret i32 %21
}

LLVM IR (-O2):
%struct.pattern = type { i32 }
define i32 @autohelperowl_attackpat117(%struct.pattern* nocapture readnone %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @offset(i32 -2, i32 -1, i32 %2, i32 %1)
%7 = tail call i32 @countlib(i32 %6)
%8 = icmp eq i32 %7, 3
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Type definitions */
typedef char *uint64_t;

/* Variables and functions */
__attribute__((always_)) uint64_t sel4bench_private_rdtsc() {
  uint64_t time;
  asm volatile("rdtsc" : "=A"(time));
  return time;
}


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

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

LLVM IR (-O0):
define i8* @sel4bench_private_rdtsc() {
%1 = alloca i8*
%2 = call i8* asm sideeffect "rdtsc", "=A,~{dirflag},~{fpsr},~{flags}"()
store i8* %2, i8** %1
%3 = load i8*, i8** %1
ret i8* %3
}

LLVM IR (-O2):
define i8* @sel4bench_private_rdtsc() {
%1 = tail call i8* asm sideeffect "rdtsc", "=A,~{dirflag},~{fpsr},~{flags}"()
ret i8* %1
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_mon;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int date_get_month(void) {
  time_t t;
  struct tm *lt;
  t = time(NULL);
  lt = localtime(&t);
  return lt->tm_mon + 1;
}


x86 assembly (clang, -O0):
<date_get_month>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_get_month>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%eax
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @date_get_month() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %4, %struct.tm** %2
%5 = load %struct.tm*, %struct.tm** %2
%6 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
%7 = load i32, i32* %6
%8 = add nsw i32 %7, 1
ret i32 %8
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @date_get_month() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%6 = load i32, i32* %5
%7 = add nsw i32 %6, 1
ret i32 %7
}
extern double d1s1(double d1, float s1) { return d1 + s1; }


x86 assembly (clang, -O0):
<d1s1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<d1s1>:
cvtss2sd %xmm1,%xmm1
addsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @d1s1(double %0, float %1) {
%3 = fpext float %1 to double
%4 = fadd double %3, %0
ret double %4
}
char checkTipoTrama(const unsigned char *tr) {
  switch (tr[16] & 3) {
  case 0:
    return 'I';
    break;
  case 1:
    return 'S';
    break;
  case 2:
    return 'I';
    break;
  case 3:
    return 'U';
    break;
  }
}


x86 assembly (clang, -O0):
<checkTipoTrama>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0x10(%rax),%eax
and    $0x3,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     1155 <checkTipoTrama+0x55>
mov    -0x18(%rbp),%rax
lea    0xed3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x49,-0x1(%rbp)
jmp    1155 <checkTipoTrama+0x55>
movb   $0x53,-0x1(%rbp)
jmp    1155 <checkTipoTrama+0x55>
movb   $0x49,-0x1(%rbp)
jmp    1155 <checkTipoTrama+0x55>
movb   $0x55,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkTipoTrama>:
mov    0x10(%rdi),%cl
shl    $0x3,%cl
mov    $0x55495349,%eax
shr    %cl,%eax
ret

LLVM IR (-O0):
define signext i8 @checkTipoTrama(i8* %0) {
%2 = alloca i8
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 16
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = and i32 %7, 3
switch i32 %8, label %13 [
i32 0, label %9
i32 1, label %10
i32 2, label %11
i32 3, label %12
]
9: ; preds = %1
store i8 73, i8* %2
br label %13
10: ; preds = %1
store i8 83, i8* %2
br label %13
11: ; preds = %1
store i8 73, i8* %2
br label %13
12: ; preds = %1
store i8 85, i8* %2
br label %13
13: ; preds = %9, %10, %11, %12, %1
%14 = load i8, i8* %2
ret i8 %14
}

LLVM IR (-O2):
define signext i8 @checkTipoTrama(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 16
%3 = load i8, i8* %2
%4 = shl i8 %3, 3
%5 = and i8 %4, 24
%6 = zext i8 %5 to i32
%7 = lshr i32 1430868809, %6
%8 = trunc i32 %7 to i8
ret i8 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ConvertFromDouble(double, unsigned char *);
int fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
int ConvertFwriteDouble(FILE *fp, double val) {
  unsigned char tmp[8];
  ConvertFromDouble(val, tmp);
  if (fwrite(tmp, 8, 1, fp) != 1)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<ConvertFwriteDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    -0x20(%rbp),%rdi
call   1030 <ConvertFromDouble@plt>
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x8,%esi
mov    $0x1,%edx
call   1040 <fwrite@plt>
cmp    $0x1,%eax
je     116b <ConvertFwriteDouble+0x4b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1172 <ConvertFwriteDouble+0x52>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConvertFwriteDouble>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <ConvertFromDouble@plt>
mov    %r14,%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
setne  %cl
neg    %ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @ConvertFwriteDouble(i32* nocapture %0, double %1) {
%3 = alloca [8 x i8]
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%5 = call i32 @ConvertFromDouble(double %1, i8* %4)
%6 = call i32 @fwrite(i8* %4, i32 8, i32 1, i32* %0)
%7 = icmp ne i32 %6, 1
%8 = sext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
size_t const SIZE_MAX;
bool mulof_s(const size_t x, const size_t y) {
  static const size_t mulof = ((size_t)1 << (sizeof(size_t) * 4));
  return ((x >= mulof || y >= mulof) && x > 0 && y > SIZE_MAX / x);
}


x86 assembly (clang, -O0):
<mulof_s>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movabs $0x100000000,%rax
cmp    %rax,-0x8(%rbp)
jae    1139 <mulof_s+0x39>
xor    %eax,%eax
movabs $0x100000000,%rcx
cmp    %rcx,-0x10(%rbp)
mov    %al,-0x11(%rbp)
jb     1173 <mulof_s+0x73>
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
jbe    1173 <mulof_s+0x73>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    0x2e80(%rip),%rax
mov    (%rax),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x8(%rbp)
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
seta   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mulof_s>:
mov    %rsi,%rax
or     %rdi,%rax
shr    $0x20,%rax
setne  %al
test   %rdi,%rdi
setne  %cl
test   %rsi,%rsi
setne  %dl
and    %cl,%dl
and    %al,%dl
movzbl %dl,%eax
ret

LLVM IR (-O0):
@mulof_s.mulof = internal constant i64 4294967296
@SIZE_MAX = constant i64 0
define i32 @mulof_s(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = icmp uge i64 %5, 4294967296
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i64, i64* %4
%9 = icmp uge i64 %8, 4294967296
br i1 %9, label %10, label %19
10: ; preds = %7, %2
%11 = load i64, i64* %3
%12 = icmp ugt i64 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %10
%14 = load i64, i64* %4
%15 = load i64, i64* @SIZE_MAX
%16 = load i64, i64* %3
%17 = udiv i64 %15, %16
%18 = icmp ugt i64 %14, %17
br label %19
19: ; preds = %13, %10, %7
%20 = phi i1 [ false, %10 ], [ false, %7 ], [ %18, %13 ]
%21 = zext i1 %20 to i32
ret i32 %21
}

LLVM IR (-O2):
@SIZE_MAX = constant i64 0
define i32 @mulof_s(i64 %0, i64 %1) {
%3 = or i64 %1, %0
%4 = icmp ugt i64 %3, 4294967295
%5 = icmp ne i64 %0, 0
%6 = and i1 %5, %4
%7 = icmp ne i64 %1, 0
%8 = and i1 %7, %6
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void *writer_thread(void *arg) {
  sleep(5);
  printf("Thread I/O\n");
  return NULL;
}


x86 assembly (clang, -O0):
<writer_thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x5,%edi
call   1040 <sleep@plt>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writer_thread>:
push   %rax
mov    $0x5,%edi
call   1040 <sleep@plt>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Thread I/O\0A\00"
define i8* @writer_thread(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @sleep(i32 5)
%4 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i8* null
}

LLVM IR (-O2):
@str = [11 x i8] c"Thread I/O\00"
define noalias i8* @writer_thread(i8* nocapture readnone %0) {
%2 = tail call i32 @sleep(i32 5)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ heart_init();
void heart_execute_initialization() { heart_init(); }


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

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

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

LLVM IR (-O2):
define void @heart_execute_initialization() {
%1 = tail call i32 (...) @heart_init()
ret void
}
int isShellSymb(char c) {
  return (c) == '|' || (c) == '<' || (c) == '>' || (c) == '\'' || (c) == '=' ||
         (c) == '"' || (c) == '`';
}


x86 assembly (clang, -O0):
<isShellSymb>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x7c,%ecx
mov    %al,-0x2(%rbp)
je     1183 <isShellSymb+0x83>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x3c,%ecx
mov    %al,-0x2(%rbp)
je     1183 <isShellSymb+0x83>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x3e,%ecx
mov    %al,-0x2(%rbp)
je     1183 <isShellSymb+0x83>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x27,%ecx
mov    %al,-0x2(%rbp)
je     1183 <isShellSymb+0x83>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x3d,%ecx
mov    %al,-0x2(%rbp)
je     1183 <isShellSymb+0x83>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x22,%ecx
mov    %al,-0x2(%rbp)
je     1183 <isShellSymb+0x83>
movsbl -0x1(%rbp),%eax
cmp    $0x60,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isShellSymb>:
mov    $0x1,%eax
cmp    $0x3e,%dil
ja     1120 <isShellSymb+0x20>
movzbl %dil,%ecx
movabs $0x7000008400000000,%rdx
bt     %rcx,%rdx
jae    1120 <isShellSymb+0x20>
ret
cmp    $0x7c,%dil
je     111f <isShellSymb+0x1f>
xor    %eax,%eax
cmp    $0x60,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @isShellSymb(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 124
br i1 %5, label %30, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 60
br i1 %9, label %30, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 62
br i1 %13, label %30, label %14
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 39
br i1 %17, label %30, label %18
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 61
br i1 %21, label %30, label %22
22: ; preds = %18
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 34
br i1 %25, label %30, label %26
26: ; preds = %22
%27 = load i8, i8* %2
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 96
br label %30
30: ; preds = %26, %22, %18, %14, %10, %6, %1
%31 = phi i1 [ true, %22 ], [ true, %18 ], [ true, %14 ], [ true, %10 ], [ true, %6 ], [ true, %1 ], [ %29, %26 ]
%32 = zext i1 %31 to i32
ret i32 %32
}

LLVM IR (-O2):
define i32 @isShellSymb(i8 signext %0) {
switch i8 %0, label %2 [
i8 124, label %5
i8 62, label %5
i8 61, label %5
i8 60, label %5
i8 39, label %5
i8 34, label %5
]
2: ; preds = %1
%3 = icmp eq i8 %0, 96
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %1, %1, %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void sig_io(int signo) { exit(0); }


x86 assembly (clang, -O0):
<sig_io>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

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

LLVM IR (-O0):
define void @sig_io(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @sig_io(i32 %0) {
%2 = tail call i32 @exit(i32 0)
unreachable
}
void show() {}


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

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

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

LLVM IR (-O2):
define void @show() {
ret void
}
int elf_coredump_extra_notes_size(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @elf_coredump_extra_notes_size() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ps2_common_init();
int /*<<< orphan*/ ps2_mca_board_model_50_init();
void ps2_model_50_init() {
  ps2_common_init();
  ps2_mca_board_model_50_init();
}


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

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

LLVM IR (-O0):
define void @ps2_model_50_init() {
%1 = call i32 (...) @ps2_common_init()
%2 = call i32 (...) @ps2_mca_board_model_50_init()
ret void
}

LLVM IR (-O2):
define void @ps2_model_50_init() {
%1 = tail call i32 (...) @ps2_common_init()
%2 = tail call i32 (...) @ps2_mca_board_model_50_init()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, double *);
double get_percentage(void) {
  double percentage = 0.0;
  printf("Enter a percentage for your class: ");
  scanf("%lf", &percentage);
  return percentage;
}


x86 assembly (clang, -O0):
<get_percentage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_percentage>:
push   %rax
movq   $0x0,(%rsp)
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Enter a percentage for your class: \00"
@.str.1 = [4 x i8] c"%lf\00"
define double @get_percentage() {
%1 = alloca double
store double 0.000000e+00, double* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%4 = load double, double* %1
ret double %4
}

LLVM IR (-O2):
@.str = [36 x i8] c"Enter a percentage for your class: \00"
@.str.1 = [4 x i8] c"%lf\00"
define double @get_percentage() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
store double 0.000000e+00, double* %1
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = load double, double* %1
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ link_error();
void f12(unsigned long long int s) {
  if ((unsigned int)s == 0)
    return;
  if (s == 0)
    link_error();
}


x86 assembly (clang, -O0):
<f12>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmp    $0x0,%eax
jne    112e <f12+0x1e>
jmp    1140 <f12+0x30>
cmpq   $0x0,-0x8(%rbp)
jne    1140 <f12+0x30>
mov    $0x0,%al
call   1030 <link_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f12>:
test   %rdi,%rdi
jne    1120 <f12+0x10>
test   %edi,%edi
je     1120 <f12+0x10>
xor    %eax,%eax
jmp    1030 <link_error@plt>
ret

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

LLVM IR (-O2):
define void @f12(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = icmp ne i32 %2, 0
%4 = icmp eq i64 %0, 0
%5 = and i1 %4, %3
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 (...) @link_error()
br label %8
8: ; preds = %1, %6
ret void
}
float g(float x, float y) {
  float a = x * y;
  return a;
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @g(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = load float, float* %4
%8 = fmul float %6, %7
store float %8, float* %5
%9 = load float, float* %5
ret float %9
}

LLVM IR (-O2):
define float @g(float %0, float %1) {
%3 = fmul float %0, %1
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ LC_ALL;
int isalpha(int);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int ls_isalpha(int c) {
  int ret;
  setlocale(LC_ALL, "");
  ret = isalpha(c);
  setlocale(LC_ALL, "C");
  return ret;
}


x86 assembly (clang, -O0):
<ls_isalpha>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
call   1040 <setlocale@plt>
mov    -0x4(%rbp),%edi
call   1030 <isalpha@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
lea    0xea5(%rip),%rsi
call   1040 <setlocale@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_isalpha>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    0x2eb3(%rip),%r14
mov    (%r14),%edi
lea    0xeca(%rip),%rsi
call   1040 <setlocale@plt>
mov    %ebx,%edi
call   1030 <isalpha@plt>
mov    %eax,%ebx
mov    (%r14),%edi
lea    0xeb1(%rip),%rsi
call   1040 <setlocale@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"C\00"
define i32 @ls_isalpha(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* @LC_ALL
%5 = call i32 @setlocale(i32 %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* %2
%7 = call i32 @isalpha(i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* @LC_ALL
%9 = call i32 @setlocale(i32 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"C\00"
define i32 @ls_isalpha(i32 %0) {
%2 = load i32, i32* @LC_ALL
%3 = tail call i32 @setlocale(i32 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @isalpha(i32 %0)
%5 = load i32, i32* @LC_ALL
%6 = tail call i32 @setlocale(i32 %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 %4
}
void empty2() {
  ;
  ;
  ;
}


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

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

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

LLVM IR (-O2):
define void @empty2() {
ret void
}
/* Variables and functions */
char EOF;
char getchar();
void flush_stdin(void) {
  char ch;
  do {
    ch = getchar();
  } while (ch != EOF && ch != '\n');
}


x86 assembly (clang, -O0):
<flush_stdin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    0x2ebb(%rip),%rax
movsbl (%rax),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x2(%rbp)
je     114a <flush_stdin+0x3a>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
test   $0x1,%al
jne    1118 <flush_stdin+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flush_stdin>:
push   %rbx
mov    0x2ed0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
je     112f <flush_stdin+0x1f>
cmp    (%rbx),%al
jne    1120 <flush_stdin+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i8 0
define void @flush_stdin() {
%1 = alloca i8
br label %2
2: ; preds = %14, %0
%3 = call signext i8 (...) @getchar()
store i8 %3, i8* %1
br label %4
4: ; preds = %2
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = load i8, i8* @EOF
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %6, %8
br i1 %9, label %10, label %14
10: ; preds = %4
%11 = load i8, i8* %1
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 10
br label %14
14: ; preds = %10, %4
%15 = phi i1 [ false, %4 ], [ %13, %10 ]
br i1 %15, label %2, label %16
16: ; preds = %14
ret void
}

LLVM IR (-O2):
@EOF = global i8 0
define void @flush_stdin() {
br label %1
1: ; preds = %1, %0
%2 = tail call signext i8 (...) @getchar()
%3 = load i8, i8* @EOF
%4 = icmp ne i8 %2, %3
%5 = icmp ne i8 %2, 10
%6 = and i1 %5, %4
br i1 %6, label %1, label %7
7: ; preds = %1
ret void
}
/* Variables and functions */
char *strchr(char *, char);
void sysfs_devname_sys_to_dev(char *name) {
  char *c;
  if (name)
    while ((c = strchr(name, '!')))
      c[0] = '/';
}


x86 assembly (clang, -O0):
<sysfs_devname_sys_to_dev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1159 <sysfs_devname_sys_to_dev+0x49>
jmp    112c <sysfs_devname_sys_to_dev+0x1c>
mov    -0x8(%rbp),%rdi
mov    $0x21,%esi
call   1030 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1154 <sysfs_devname_sys_to_dev+0x44>
mov    -0x10(%rbp),%rax
movb   $0x2f,(%rax)
jmp    112c <sysfs_devname_sys_to_dev+0x1c>
jmp    1159 <sysfs_devname_sys_to_dev+0x49>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sysfs_devname_sys_to_dev>:
push   %rbx
test   %rdi,%rdi
je     1137 <sysfs_devname_sys_to_dev+0x27>
mov    %rdi,%rbx
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x21,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1137 <sysfs_devname_sys_to_dev+0x27>
movb   $0x2f,(%rax)
jmp    1120 <sysfs_devname_sys_to_dev+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @sysfs_devname_sys_to_dev(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %15
6: ; preds = %1
br label %7
7: ; preds = %11, %6
%8 = load i8*, i8** %2
%9 = call i8* @strchr(i8* %8, i8 signext 33)
store i8* %9, i8** %3
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 0
store i8 47, i8* %13
br label %7
14: ; preds = %7
br label %15
15: ; preds = %14, %1
ret void
}

LLVM IR (-O2):
define void @sysfs_devname_sys_to_dev(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i8* @strchr(i8* %0, i8 signext 33)
%5 = icmp eq i8* %4, null
br i1 %5, label %10, label %6
6: ; preds = %3, %6
%7 = phi i8* [ %8, %6 ], [ %4, %3 ]
store i8 47, i8* %7
%8 = tail call i8* @strchr(i8* %0, i8 signext 33)
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %6
10: ; preds = %6, %3, %1
ret void
}
void X509V3_EXT_nconf(void) {}


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

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

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

LLVM IR (-O2):
define void @X509V3_EXT_nconf() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ die(char *);
void *realloc(void *, size_t);
void *xrealloc(void *p, size_t len) {
  if ((p = realloc(p, len)) == NULL)
    die("Out of memory\n");
  return p;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    1157 <xrealloc+0x37>
lea    0xeae(%rip),%rdi
call   1040 <die@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %rbx
call   1030 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <xrealloc+0x1a>
lea    0xecb(%rip),%rdi
call   1040 <die@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Out of memory\0A\00"
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i8* @realloc(i8* %5, i64 %6)
store i8* %7, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @die(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@.str = [15 x i8] c"Out of memory\0A\00"
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @die(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Variables and functions */
char EOF;
int _is_newline(char c) { return ('\r' == c) || ('\n' == c) || (EOF == c); }


x86 assembly (clang, -O0):
<_is_newline>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
mov    $0x1,%al
mov    $0xd,%ecx
cmp    %edx,%ecx
mov    %al,-0x2(%rbp)
je     114c <_is_newline+0x4c>
movsbl -0x1(%rbp),%edx
mov    $0x1,%al
mov    $0xa,%ecx
cmp    %edx,%ecx
mov    %al,-0x2(%rbp)
je     114c <_is_newline+0x4c>
mov    0x2eab(%rip),%rax
movsbl (%rax),%eax
movsbl -0x1(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_is_newline>:
mov    $0x1,%eax
cmp    $0xa,%dil
je     1111 <_is_newline+0x11>
cmp    $0xd,%dil
jne    1112 <_is_newline+0x12>
ret
mov    0x2ecf(%rip),%rcx
xor    %eax,%eax
cmp    %dil,(%rcx)
sete   %al
ret

LLVM IR (-O0):
@EOF = global i8 0
define i32 @_is_newline(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 13, %4
br i1 %5, label %16, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 10, %8
br i1 %9, label %16, label %10
10: ; preds = %6
%11 = load i8, i8* @EOF
%12 = sext i8 %11 to i32
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %12, %14
br label %16
16: ; preds = %10, %6, %1
%17 = phi i1 [ true, %6 ], [ true, %1 ], [ %15, %10 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
@EOF = global i8 0
define i32 @_is_newline(i8 signext %0) {
switch i8 %0, label %2 [
i8 13, label %6
i8 10, label %6
]
2: ; preds = %1
%3 = load i8, i8* @EOF
%4 = icmp eq i8 %3, %0
%5 = zext i1 %4 to i32
br label %6
6: ; preds = %1, %1, %2
%7 = phi i32 [ 1, %1 ], [ %5, %2 ], [ 1, %1 ]
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int pthread_mutex_destroy(int /*<<< orphan*/ *);
int ___pthread_mutex_destroy(pthread_mutex_t *mutex) {
  ;
  return pthread_mutex_destroy(mutex);
}


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

x86 assembly (clang, -O2):
<___pthread_mutex_destroy>:
jmp    1030 <pthread_mutex_destroy@plt>

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

LLVM IR (-O2):
define i32 @___pthread_mutex_destroy(i32* %0) {
%2 = tail call i32 @pthread_mutex_destroy(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ putllint(long long);
int main() {
  long long int n = 123456;
  putllint(n);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1e240,%edi
call   1030 <putllint@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
store i64 123456, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @putllint(i64 %3)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @putllint(i64 123456)
ret i32 0
}
/* Variables and functions */
double asin(double);
double acsc(double x) { return asin(1.0 / x); }


x86 assembly (clang, -O0):
<acsc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
divsd  -0x8(%rbp),%xmm0
call   1030 <asin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<acsc>:
movsd  0xee8(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
jmp    1030 <asin@plt>

LLVM IR (-O0):
define double @acsc(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double 1.000000e+00, %3
%5 = call double @asin(double %4)
ret double %5
}

LLVM IR (-O2):
define double @acsc(double %0) {
%2 = fdiv double 1.000000e+00, %0
%3 = tail call double @asin(double %2)
ret double %3
}
int while_infinite_FN() {
  int i = 0;
  while (i < 10) {
  }
  return 0;
}


x86 assembly (clang, -O0):
<while_infinite_FN>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    111a <while_infinite_FN+0x1a>
jmp    110b <while_infinite_FN+0xb>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @while_infinite_FN() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %5, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 10
br i1 %4, label %5, label %6
5: ; preds = %2
br label %2
6: ; preds = %2
ret i32 0
}

LLVM IR (-O2):
define i32 @while_infinite_FN() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Type definitions */
typedef scalar_t__ uint16_t;

/* Variables and functions */
void sdmmc_write16(uint16_t reg, uint16_t val) {
  *(volatile uint16_t *)(0x10006000 + reg) = val;
}


x86 assembly (clang, -O0):
<sdmmc_write16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
add    $0x10006000,%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sdmmc_write16>:
mov    %rsi,0x10006000(%rdi)
ret

LLVM IR (-O0):
define void @sdmmc_write16(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %3
%7 = add nsw i64 268460032, %6
%8 = inttoptr i64 %7 to i64*
store volatile i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @sdmmc_write16(i64 %0, i64 %1) {
%3 = add nsw i64 %0, 268460032
%4 = inttoptr i64 %3 to i64*
store volatile i64 %1, i64* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ function3(size_t);
__attribute__((no)) void function2(size_t size) { function3(size); }


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

x86 assembly (clang, -O2):
<function2>:
jmp    1030 <function3@plt>

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

LLVM IR (-O2):
define void @function2(i64 %0) {
%2 = tail call i32 @function3(i64 %0)
ret void
}
/* Variables and functions */
size_t count_convert(const int max) {
  size_t count = 1;
  int i;
  for (i = max; i > 0; i = i >> 1)
    ++count;
  return (size_t)count;
}


x86 assembly (clang, -O0):
<count_convert>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movq   $0x1,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1139 <count_convert+0x39>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1115 <count_convert+0x15>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_convert>:
mov    $0x1,%eax
test   %edi,%edi
jle    111d <count_convert+0x1d>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
add    $0x1,%rax
shr    %ecx
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <count_convert+0x10>
ret

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

LLVM IR (-O2):
define i64 @count_convert(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ %0, %1 ]
%5 = phi i64 [ %6, %3 ], [ 1, %1 ]
%6 = add nuw nsw i64 %5, 1
%7 = lshr i32 %4, 1
%8 = icmp ult i32 %4, 2
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i64 [ 1, %1 ], [ %6, %3 ]
ret i64 %10
}