xunge/DecIR huggingface dataset:
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *, int /*<<< orphan*/);
int write_quaddobl_start_solutions(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(245, a, b, c, 0);
  return fail;
}


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

x86 assembly (clang, -O2):
<write_quaddobl_start_solutions>:
mov    $0xf5,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @write_quaddobl_start_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_c2phc(i32 245, 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_start_solutions() {
%1 = tail call i32 @_ada_use_c2phc(i32 245, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
void f55(void) {
  ({
    ({ 0; });
  a:
    goto a;
    ({ 0; });
    0;
  });
  ({
    ({ 0; });
    ({ 0; });
    0;
  });
  0;
}


x86 assembly (clang, -O0):
<f55>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
jmp    110b <f55+0xb>

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

LLVM IR (-O0):
define void @f55() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* %1
br label %4
4: ; preds = %4, %0
br label %4
}

LLVM IR (-O2):
define void @f55() {
br label %1
1: ; preds = %1, %0
br label %1
}
double fshr(double a, double b) { return (int)a >> (int)b; }


x86 assembly (clang, -O0):
<fshr>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
cvttsd2si -0x8(%rbp),%eax
cvttsd2si -0x10(%rbp),%ecx
sar    %cl,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fshr>:
cvttsd2si %xmm0,%eax
cvttsd2si %xmm1,%ecx
sar    %cl,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
ret

LLVM IR (-O0):
define double @fshr(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = fptosi double %5 to i32
%7 = load double, double* %4
%8 = fptosi double %7 to i32
%9 = ashr i32 %6, %8
%10 = sitofp i32 %9 to double
ret double %10
}

LLVM IR (-O2):
define double @fshr(double %0, double %1) {
%3 = fptosi double %0 to i32
%4 = fptosi double %1 to i32
%5 = ashr i32 %3, %4
%6 = sitofp i32 %5 to double
ret double %6
}
void av_parse_cpu_caps() {}


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

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

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

LLVM IR (-O2):
define void @av_parse_cpu_caps() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bar(int);
int /*<<< orphan*/ fn1();
int fn2() {
  fn1();
  bar(10);
}


x86 assembly (clang, -O0):
<fn2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <fn1@plt>
mov    $0xa,%edi
call   1030 <bar@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn2>:
push   %rax
xor    %eax,%eax
call   1040 <fn1@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <bar@plt>

LLVM IR (-O0):
define i32 @fn2() {
%1 = alloca i32
%2 = call i32 (...) @fn1()
%3 = call i32 @bar(i32 10)
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
define i32 @fn2() {
%1 = tail call i32 (...) @fn1()
%2 = tail call i32 @bar(i32 10)
ret i32 undef
}
void freelist(char **list) {
  int i, len = lenlist(list);
  for (i = 0; i < len; i++)
    free(list[i]);
  free(list);
}


x86 assembly (clang, -O0):
<freelist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <lenlist@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    116c <freelist+0x4c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1141 <freelist+0x21>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freelist>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %eax,%eax
call   1040 <lenlist@plt>
test   %eax,%eax
jle    1152 <freelist+0x32>
mov    %eax,%r15d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <freelist+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @freelist(i8** %0) {
%2 = tail call i32 (i8**, ...) bitcast (i32 (...)* @lenlist to i32 (i8**, ...)*)(i8** %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %12
4: ; preds = %1
%5 = zext i32 %2 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %10, %6 ]
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
tail call void @free(i8* %9)
%10 = add nuw nsw i64 %7, 1
%11 = icmp eq i64 %10, %5
br i1 %11, label %12, label %6
12: ; preds = %6, %1
%13 = bitcast i8** %0 to i8*
tail call void @free(i8* %13)
ret void
}
/* Variables and functions */
int sattach(int, char **);
int main(int argc, char **argv) { return sattach(argc, argv); }


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

x86 assembly (clang, -O2):
<main>:
jmp    1030 <sattach@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @sattach(i32 %0, i8** %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ ss2qbc(float *, float *, float *);
void ss2qbc_(float *r, float *g, float *b) { ss2qbc(r, g, b); }


x86 assembly (clang, -O0):
<ss2qbc_>:
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),%rdx
call   1030 <ss2qbc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ss2qbc_>:
jmp    1030 <ss2qbc@plt>

LLVM IR (-O0):
define void @ss2qbc_(float* %0, float* %1, float* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float*
store float* %0, float** %4
store float* %1, float** %5
store float* %2, float** %6
%7 = load float*, float** %4
%8 = load float*, float** %5
%9 = load float*, float** %6
%10 = call i32 @ss2qbc(float* %7, float* %8, float* %9)
ret void
}

LLVM IR (-O2):
define void @ss2qbc_(float* %0, float* %1, float* %2) {
%4 = tail call i32 @ss2qbc(float* %0, float* %1, float* %2)
ret void
}
int test08(int a, int b, int c, int d) {
  int x = a == b;
  int y = c == 0;
  return x & y;
}


x86 assembly (clang, -O0):
<test08>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
and    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test08>:
xor    %esi,%edi
xor    %eax,%eax
or     %edx,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @test08(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = icmp eq i32 %11, %12
%14 = zext i1 %13 to i32
store i32 %14, i32* %9
%15 = load i32, i32* %7
%16 = icmp eq i32 %15, 0
%17 = zext i1 %16 to i32
store i32 %17, i32* %10
%18 = load i32, i32* %9
%19 = load i32, i32* %10
%20 = and i32 %18, %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @test08(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %0, %1
%6 = icmp eq i32 %2, 0
%7 = and i1 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ display;
};
typedef TYPE_1__ XLeaveWindowEvent;

/* Variables and functions */
void *get_XLeaveWindowEvent_display(void *_p) {
  return (void *)((XLeaveWindowEvent *)_p)->display;
}


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

x86 assembly (clang, -O2):
<get_XLeaveWindowEvent_display>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i8* @get_XLeaveWindowEvent_display(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = inttoptr i64 %6 to i8*
ret i8* %7
}

LLVM IR (-O2):
define i8* @get_XLeaveWindowEvent_display(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void CheckDataDir(char *datadir) {
  if (datadir) {
    fprintf(stderr, "Specify only one option out of -l -e -r -u or -p \n");
    exit(250);
  }
}


x86 assembly (clang, -O0):
<CheckDataDir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1156 <CheckDataDir+0x36>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xeb9(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xfa,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckDataDir>:
test   %rdi,%rdi
jne    1126 <CheckDataDir+0x6>
ret
push   %rax
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xfa,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [51 x i8] c"Specify only one option out of -l -e -r -u or -p \0A\00"
define void @CheckDataDir(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @exit(i32 250)
unreachable
9: ; preds = %1
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [51 x i8] c"Specify only one option out of -l -e -r -u or -p \0A\00"
define void @CheckDataDir(i8* readnone %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 250)
unreachable
7: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(
      stderr,
      "usage: newsyslog [-CFNPnrsv] [-a directory] [-d directory] [-f "
      "config_file]\n"
      "                 [-S pidfile] [-t timefmt] [[-R tagname] file ...]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [144 x i8] c"usage: newsyslog [-CFNPnrsv] [-a directory] [-d directory] [-f config_file]\0A [-S pidfile] [-t timefmt] [[-R tagname] file ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [144 x i8] c"usage: newsyslog [-CFNPnrsv] [-a directory] [-d directory] [-f config_file]\0A [-S pidfile] [-t timefmt] [[-R tagname] file ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, char const *, char const *,
                          int);
void __assert_fail(const char *expr, const char *file, int line,
                   const char *func) {
  printf("Assertion failed: %s (%s: %s: %d)\n", expr, file, func, line);
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<__assert_fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x14(%rbp),%r8d
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
jmp    1143 <__assert_fail+0x33>

x86 assembly (clang, -O2):
<__assert_fail>:
push   %rax
mov    %edx,%r8d
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
jmp    1130 <__assert_fail+0x20>

LLVM IR (-O0):
@.str = [35 x i8] c"Assertion failed: %s (%s: %s: %d)\0A\00"
define void @__assert_fail(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i8*, i8** %8
%12 = load i32, i32* %7
%13 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10, i8* %11, i32 %12)
br label %14
14: ; preds = %14, %4
br label %14
}

LLVM IR (-O2):
@.str = [35 x i8] c"Assertion failed: %s (%s: %s: %d)\0A\00"
define void @__assert_fail(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i8* %3, i32 %2)
br label %6
6: ; preds = %6, %4
br label %6
}
unsigned long foo(void) {
  { return (2305843009213693951UL); }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movabs $0x1fffffffffffffff,%rax
ff ff 1f
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
movabs $0x1fffffffffffffff,%rax
ff ff 1f
ret

LLVM IR (-O0):
define i64 @foo() {
ret i64 2305843009213693951
}

LLVM IR (-O2):
define i64 @foo() {
ret i64 2305843009213693951
}
/* Variables and functions */
int square(int);
int main() {
  int i = 99;
  i++;
  i = square(i);
  i--;
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 99, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @square(i32 %5)
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = add nsw i32 %7, -1
store i32 %8, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @square(i32 100)
ret i32 0
}
float bar(float b) { return b * b; }


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

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

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

LLVM IR (-O2):
define float @bar(float %0) {
%2 = fmul float %0, %0
ret float %2
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, unsigned long);
int main(int argc, char **argv) {
  printf("long max %ul\n", 0x7fffffffffffffffL);
  unsigned long c;
  c = (c << 8) | c;
  c = (c << 16) | c;
  c = (c << 32) | c;
  printf("%ul\n", c);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rdi
movabs $0x7fffffffffffffff,%rsi
ff ff 7f
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
shl    $0x8,%rax
or     -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x10,%rax
or     -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x20,%rax
or     -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
movabs $0x7fffffffffffffff,%rsi
ff ff 7f
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea6(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"long max %ul\0A\00"
@.str.1 = [5 x i8] c"%ul\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 9223372036854775807)
%8 = load i64, i64* %6
%9 = shl i64 %8, 8
%10 = load i64, i64* %6
%11 = or i64 %9, %10
store i64 %11, i64* %6
%12 = load i64, i64* %6
%13 = shl i64 %12, 16
%14 = load i64, i64* %6
%15 = or i64 %13, %14
store i64 %15, i64* %6
%16 = load i64, i64* %6
%17 = shl i64 %16, 32
%18 = load i64, i64* %6
%19 = or i64 %17, %18
store i64 %19, i64* %6
%20 = load i64, i64* %6
%21 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %20)
%22 = load i32, i32* @EXIT_SUCCESS
ret i32 %22
}

LLVM IR (-O2):
@.str = [14 x i8] c"long max %ul\0A\00"
@.str.1 = [5 x i8] c"%ul\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 9223372036854775807)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 undef)
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}
/* Variables and functions */
int fastlz1_compress(void const *, int, void *);
int fastlz2_compress(void const *, int, void *);
int fastlz_compress_level(int level, const void *input, int length,
                          void *output) {
  if (level == 1)
    return fastlz1_compress(input, length, output);
  if (level == 2)
    return fastlz2_compress(input, length, output);
  return 0;
}


x86 assembly (clang, -O0):
<fastlz_compress_level>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1158 <fastlz_compress_level+0x38>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1030 <fastlz1_compress@plt>
mov    %eax,-0x4(%rbp)
jmp    1181 <fastlz_compress_level+0x61>
cmpl   $0x2,-0x8(%rbp)
jne    117a <fastlz_compress_level+0x5a>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1040 <fastlz2_compress@plt>
mov    %eax,-0x4(%rbp)
jmp    1181 <fastlz_compress_level+0x61>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastlz_compress_level>:
cmp    $0x2,%edi
je     1137 <fastlz_compress_level+0x17>
cmp    $0x1,%edi
jne    1144 <fastlz_compress_level+0x24>
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rcx,%rdx
jmp    1030 <fastlz1_compress@plt>
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rcx,%rdx
jmp    1040 <fastlz2_compress@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @fastlz_compress_level(i32 %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
store i32 %0, i32* %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i8* %3, i8** %9
%10 = load i32, i32* %6
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %17
12: ; preds = %4
%13 = load i8*, i8** %7
%14 = load i32, i32* %8
%15 = load i8*, i8** %9
%16 = call i32 @fastlz1_compress(i8* %13, i32 %14, i8* %15)
store i32 %16, i32* %5
br label %26
17: ; preds = %4
%18 = load i32, i32* %6
%19 = icmp eq i32 %18, 2
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i8*, i8** %7
%22 = load i32, i32* %8
%23 = load i8*, i8** %9
%24 = call i32 @fastlz2_compress(i8* %21, i32 %22, i8* %23)
store i32 %24, i32* %5
br label %26
25: ; preds = %17
store i32 0, i32* %5
br label %26
26: ; preds = %25, %20, %12
%27 = load i32, i32* %5
ret i32 %27
}

LLVM IR (-O2):
define i32 @fastlz_compress_level(i32 %0, i8* %1, i32 %2, i8* %3) {
switch i32 %0, label %9 [
i32 1, label %5
i32 2, label %7
]
5: ; preds = %4
%6 = tail call i32 @fastlz1_compress(i8* %1, i32 %2, i8* %3)
br label %9
7: ; preds = %4
%8 = tail call i32 @fastlz2_compress(i8* %1, i32 %2, i8* %3)
br label %9
9: ; preds = %4, %7, %5
%10 = phi i32 [ %6, %5 ], [ %8, %7 ], [ 0, %4 ]
ret i32 %10
}
void sigma_dut_register_cmds(void) {
  void basic_register_cmds(void);
  basic_register_cmds();
  void sta_register_cmds(void);
  sta_register_cmds();
  void traffic_register_cmds(void);
  traffic_register_cmds();
  void p2p_register_cmds(void);
  p2p_register_cmds();
  void ap_register_cmds(void);
  ap_register_cmds();
  void powerswitch_register_cmds(void);
  powerswitch_register_cmds();
  void atheros_register_cmds(void);
  atheros_register_cmds();
}


x86 assembly (clang, -O0):
<sigma_dut_register_cmds>:
push   %rbp
mov    %rsp,%rbp
call   1060 <basic_register_cmds@plt>
call   1030 <sta_register_cmds@plt>
call   1050 <traffic_register_cmds@plt>
call   1090 <p2p_register_cmds@plt>
call   1080 <ap_register_cmds@plt>
call   1040 <powerswitch_register_cmds@plt>
call   1070 <atheros_register_cmds@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigma_dut_register_cmds>:
push   %rax
call   1060 <basic_register_cmds@plt>
call   1030 <sta_register_cmds@plt>
call   1050 <traffic_register_cmds@plt>
call   1090 <p2p_register_cmds@plt>
call   1080 <ap_register_cmds@plt>
call   1040 <powerswitch_register_cmds@plt>
pop    %rax
jmp    1070 <atheros_register_cmds@plt>

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

LLVM IR (-O2):
define void @sigma_dut_register_cmds() {
tail call void @basic_register_cmds()
tail call void @sta_register_cmds()
tail call void @traffic_register_cmds()
tail call void @p2p_register_cmds()
tail call void @ap_register_cmds()
tail call void @powerswitch_register_cmds()
tail call void @atheros_register_cmds()
ret void
}
/* Variables and functions */
bool nrf52_errata_127(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf52_errata_127() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void error1(char *errtxt) {
  fprintf(stderr, "Error: %s. Aborting.\n", errtxt);
  fflush(stderr);
  exit(1);
}


x86 assembly (clang, -O0):
<error1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeb0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<error1>:
push   %rbx
mov    %rdi,%rdx
mov    0x2ea5(%rip),%rbx
mov    (%rbx),%edi
lea    0xebc(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"Error: %s. Aborting.\0A\00"
define void @error1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stderr
%7 = call i32 @fflush(i32 %6)
%8 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Error: %s. Aborting.\0A\00"
define void @error1(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 @fflush(i32 %4)
%6 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
struct inode {
  int dummy;
};

/* Variables and functions */
struct inode *namex(char *, int /*<<< orphan*/, char *);
struct inode *namei(char *path) {
  char name[14];
  return namex(path, 0, name);
}


x86 assembly (clang, -O0):
<namei>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x16(%rbp),%rdx
xor    %esi,%esi
call   1030 <namex@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<namei>:
sub    $0x18,%rsp
lea    0xa(%rsp),%rdx
xor    %esi,%esi
call   1030 <namex@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.inode = type { i32 }
define %struct.inode* @namei(i8* %0) {
%2 = alloca i8*
%3 = alloca [14 x i8]
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds [14 x i8], [14 x i8]* %3, i64 0, i64 0
%6 = call %struct.inode* @namex(i8* %4, i32 0, i8* %5)
ret %struct.inode* %6
}

LLVM IR (-O2):
%struct.inode = type { i32 }
define %struct.inode* @namei(i8* %0) {
%2 = alloca [14 x i8]
%3 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%4 = call %struct.inode* @namex(i8* %0, i32 0, i8* %3)
ret %struct.inode* %4
}
int sum(int n, int m) {
  if (n <= 0) {
    return m + n;
  } else {
    return sum(n - 1, m + 1);
  }
}


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     1136 <sum+0x26>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114a <sum+0x3a>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
call   1030 <sum@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum>:
mov    %edi,%ecx
sar    $0x1f,%ecx
and    %edi,%ecx
xor    %eax,%eax
test   %edi,%edi
cmovg  %edi,%eax
add    %esi,%eax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @sum(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 1
%4 = select i1 %3, i32 %0, i32 0
%5 = select i1 %3, i32 0, i32 %0
%6 = add i32 %5, %1
%7 = add nsw i32 %6, %4
ret i32 %7
}
/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;

/* Variables and functions */
int ntohl(int);
uint64_t ntohll(uint64_t a) {
  uint32_t lo = a & 0xffffffff;
  uint32_t hi = a >> 32U;
  lo = ntohl(lo);
  hi = ntohl(hi);
  return ((uint64_t)lo) << 32U | hi;
}


x86 assembly (clang, -O0):
<ntohll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <ntohl@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <ntohl@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x20,%ecx
shl    %cl,%eax
or     -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ntohll>:
push   %rax
call   1030 <ntohl@plt>
pop    %rax
jmp    1030 <ntohl@plt>

LLVM IR (-O0):
define i32 @ntohll(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = and i32 %5, -1
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = ashr i32 %7, 32
store i32 %8, i32* %4
%9 = load i32, i32* %3
%10 = call i32 @ntohl(i32 %9)
store i32 %10, i32* %3
%11 = load i32, i32* %4
%12 = call i32 @ntohl(i32 %11)
store i32 %12, i32* %4
%13 = load i32, i32* %3
%14 = shl i32 %13, 32
%15 = load i32, i32* %4
%16 = or i32 %14, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @ntohll(i32 %0) {
%2 = tail call i32 @ntohl(i32 %0)
%3 = tail call i32 @ntohl(i32 poison)
ret i32 poison
}
/* Variables and functions */
int /*<<< orphan*/ handle_error(char *);
scalar_t__ sem_unlink(char const *);
void sem_Unlink(const char *name) {
  if (sem_unlink(name) != 0) {
    handle_error("Error unlining semaphore");
  }
}


x86 assembly (clang, -O0):
<sem_Unlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <sem_unlink@plt>
cmp    $0x0,%rax
je     114b <sem_Unlink+0x2b>
lea    0xeba(%rip),%rdi
call   1040 <handle_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sem_Unlink>:
push   %rax
call   1030 <sem_unlink@plt>
test   %rax,%rax
je     1138 <sem_Unlink+0x18>
lea    0xece(%rip),%rdi
pop    %rax
jmp    1040 <handle_error@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Error unlining semaphore\00"
define void @sem_Unlink(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @sem_unlink(i8* %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @handle_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Error unlining semaphore\00"
define void @sem_Unlink(i8* %0) {
%2 = tail call i64 @sem_unlink(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @handle_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ reset_colors();
int /*<<< orphan*/ set_test_colors();
int /*<<< orphan*/ show_line_deletions();
int /*<<< orphan*/ show_line_insertions();
int /*<<< orphan*/ tst_insdel(char const *);
int test_color_insdel(const char *the_title) {
  set_test_colors();
  show_line_insertions();
  show_line_deletions();
  tst_insdel(the_title);
  reset_colors();
  return 0;
}


x86 assembly (clang, -O0):
<test_color_insdel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1060 <set_test_colors@plt>
mov    $0x0,%al
call   1050 <show_line_insertions@plt>
mov    $0x0,%al
call   1070 <show_line_deletions@plt>
mov    -0x8(%rbp),%rdi
call   1030 <tst_insdel@plt>
mov    $0x0,%al
call   1040 <reset_colors@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_color_insdel>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1060 <set_test_colors@plt>
xor    %eax,%eax
call   1050 <show_line_insertions@plt>
xor    %eax,%eax
call   1070 <show_line_deletions@plt>
mov    %rbx,%rdi
call   1030 <tst_insdel@plt>
xor    %eax,%eax
call   1040 <reset_colors@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @test_color_insdel(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @set_test_colors()
%4 = call i32 (...) @show_line_insertions()
%5 = call i32 (...) @show_line_deletions()
%6 = load i8*, i8** %2
%7 = call i32 @tst_insdel(i8* %6)
%8 = call i32 (...) @reset_colors()
ret i32 0
}

LLVM IR (-O2):
define i32 @test_color_insdel(i8* %0) {
%2 = tail call i32 (...) @set_test_colors()
%3 = tail call i32 (...) @show_line_insertions()
%4 = tail call i32 (...) @show_line_deletions()
%5 = tail call i32 @tst_insdel(i8* %0)
%6 = tail call i32 (...) @reset_colors()
ret i32 0
}
int MAG3110_ReadAsInt() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @MAG3110_ReadAsInt() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _warn(char *, void *);
int /*<<< orphan*/ free(void *);
scalar_t__ get_valid(void *);
void free_raw(void *ptr) {
  if (get_valid(ptr)) {
    _warn("Deallocating pointer with address %p", ptr);
    free(ptr);
    return;
  }
  _warn("Pointer at address %p is not valid", ptr);
}


x86 assembly (clang, -O0):
<free_raw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <get_valid@plt>
cmp    $0x0,%rax
je     116d <free_raw+0x3d>
mov    -0x8(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1050 <_warn@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
jmp    117d <free_raw+0x4d>
mov    -0x8(%rbp),%rsi
lea    0xead(%rip),%rdi
call   1050 <_warn@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_raw>:
push   %rbx
mov    %rdi,%rbx
call   1040 <get_valid@plt>
test   %rax,%rax
je     1156 <free_raw+0x26>
lea    0xebb(%rip),%rdi
mov    %rbx,%rsi
call   1050 <_warn@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>
lea    0xec8(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1050 <_warn@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"Deallocating pointer with address %p\00"
@.str.1 = [35 x i8] c"Pointer at address %p is not valid\00"
define void @free_raw(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @get_valid(i8* %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @_warn(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i8*, i8** %2
%10 = call i32 @free(i8* %9)
br label %14
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = call i32 @_warn(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %11, %6
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"Deallocating pointer with address %p\00"
@.str.1 = [35 x i8] c"Pointer at address %p is not valid\00"
define void @free_raw(i8* %0) {
%2 = tail call i64 @get_valid(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @_warn(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = tail call i32 @free(i8* %0)
br label %9
7: ; preds = %1
%8 = tail call i32 @_warn(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %9
9: ; preds = %7, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ VIM_SIF_I2cWriteByte(unsigned char, unsigned char);
void SensorSetReg_OM6802(unsigned char uAddr, unsigned short uVal) {
  VIM_SIF_I2cWriteByte((unsigned char)uAddr, (unsigned char)uVal);
}


x86 assembly (clang, -O0):
<SensorSetReg_OM6802>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x1(%rbp),%cl
mov    -0x4(%rbp),%ax
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorSetReg_OM6802>:
movzbl %sil,%esi
jmp    1030 <VIM_SIF_I2cWriteByte@plt>

LLVM IR (-O0):
define void @SensorSetReg_OM6802(i8 zeroext %0, i16 zeroext %1) {
%3 = alloca i8
%4 = alloca i16
store i8 %0, i8* %3
store i16 %1, i16* %4
%5 = load i8, i8* %3
%6 = load i16, i16* %4
%7 = trunc i16 %6 to i8
%8 = call i32 @VIM_SIF_I2cWriteByte(i8 zeroext %5, i8 zeroext %7)
ret void
}

LLVM IR (-O2):
define void @SensorSetReg_OM6802(i8 zeroext %0, i16 zeroext %1) {
%3 = trunc i16 %1 to i8
%4 = tail call i32 @VIM_SIF_I2cWriteByte(i8 zeroext %0, i8 zeroext %3)
ret void
}
void fan_ON(void *fan_address) { *((volatile int *)fan_address + 3) = 1; }


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

x86 assembly (clang, -O2):
<fan_ON>:
movl   $0x1,0xc(%rdi)
ret

LLVM IR (-O0):
define void @fan_ON(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = getelementptr inbounds i32, i32* %4, i64 3
store volatile i32 1, i32* %5
ret void
}

LLVM IR (-O2):
define void @fan_ON(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 12
%3 = bitcast i8* %2 to i32*
store volatile i32 1, i32* %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ le32toh(int /*<<< orphan*/);
uint32_t unaligned_read_le32(const void *_u) {
  const struct __attribute__((__packed__, __may_alias__)) {
    uint32_t x;
  } *u = _u;
  return le32toh(u->x);
}


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

x86 assembly (clang, -O2):
<unaligned_read_le32>:
mov    (%rdi),%edi
jmp    1030 <le32toh@plt>

LLVM IR (-O0):
%struct.anon = type { i32 }
define i32 @unaligned_read_le32(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.anon*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to %struct.anon*
store %struct.anon* %5, %struct.anon** %3
%6 = load %struct.anon*, %struct.anon** %3
%7 = getelementptr inbounds %struct.anon, %struct.anon* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = call i32 @le32toh(i32 %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @unaligned_read_le32(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @le32toh(i32 %3)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;
typedef int /*<<< orphan*/ pthread_cond_t;

/* Variables and functions */
int /*<<< orphan*/ abort();
int pthread_cond_wait(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
void __safe_p_cond_wait(pthread_cond_t *cv, pthread_mutex_t *mtx) {
  int en = pthread_cond_wait(cv, mtx);
  if (en) {
    abort();
  }
}


x86 assembly (clang, -O0):
<__safe_p_cond_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <pthread_cond_wait@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1151 <__safe_p_cond_wait+0x31>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__safe_p_cond_wait>:
push   %rax
call   1040 <pthread_cond_wait@plt>
test   %eax,%eax
jne    112c <__safe_p_cond_wait+0xc>
pop    %rax
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @__safe_p_cond_wait(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32*, i32** %4
%8 = call i32 @pthread_cond_wait(i32* %6, i32* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @__safe_p_cond_wait(i32* %0, i32* %1) {
%3 = tail call i32 @pthread_cond_wait(i32* %0, i32* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %2
ret void
}
main() {
  for (int i = 0;;)
    ;
  for (int x[] = {1, 2, 3};;)
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
jmp    1112 <main+0x12>

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %3, %0
br label %3
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void INTFC_issueCombatFinal(int i, int bossalive) {
  if (bossalive) {
    printf("\nCombat Final : Joueur %d perd le combat final !\n", i + 1);
  } else {
    printf("\n\033[32mCF : Joueur %d remporte la partie !\n\033[0m", i + 1);
  }
}


x86 assembly (clang, -O0):
<INTFC_issueCombatFinal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     113f <INTFC_issueCombatFinal+0x2f>
mov    -0x4(%rbp),%esi
add    $0x1,%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
jmp    1151 <INTFC_issueCombatFinal+0x41>
mov    -0x4(%rbp),%esi
add    $0x1,%esi
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<INTFC_issueCombatFinal>:
lea    0x1(%rdi),%eax
test   %esi,%esi
lea    0xf16(%rip),%rcx
lea    0xedd(%rip),%rdi
cmove  %rcx,%rdi
mov    %eax,%esi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"\0ACombat Final : Joueur %d perd le combat final !\0A\00"
@.str.1 = [47 x i8] c"\0A\1B[32mCF : Joueur %d remporte la partie !\0A\1B[0m\00"
define void @INTFC_issueCombatFinal(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
%10 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %15
11: ; preds = %2
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
%14 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %11, %7
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"\0ACombat Final : Joueur %d perd le combat final !\0A\00"
@.str.1 = [47 x i8] c"\0A\1B[32mCF : Joueur %d remporte la partie !\0A\1B[0m\00"
define void @INTFC_issueCombatFinal(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = add nsw i32 %0, 1
%5 = select i1 %3, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0)
%6 = tail call i32 @printf(i8* %5, i32 %4)
ret void
}
/* Variables and functions */
int find_pivot(int *, int, int);
void quicksort(int arr[], int l, int r) {
  int pivot;
  if (l < r) {
    pivot = find_pivot(arr, l, r);
    quicksort(arr, l, pivot - 1);
    quicksort(arr, pivot + 1, r);
  }
}


x86 assembly (clang, -O0):
<quicksort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1174 <quicksort+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <find_pivot@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1030 <quicksort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1030 <quicksort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicksort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <quicksort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <find_pivot@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <quicksort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quicksort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @quicksort(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* %5
%9 = load i32, i32* %6
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %3
%12 = load i32*, i32** %4
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = call i32 @find_pivot(i32* %12, i32 %13, i32 %14)
store i32 %15, i32* %7
%16 = load i32*, i32** %4
%17 = load i32, i32* %5
%18 = load i32, i32* %7
%19 = sub nsw i32 %18, 1
%20 = load i32*, i32** %4
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
%23 = load i32, i32* %6
br label %24
24: ; preds = %11, %3
ret void
}

LLVM IR (-O2):
define void @quicksort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @find_pivot(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quicksort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *fgets(unsigned char *, int, int /*<<< orphan*/ *);
int serial_readline(FILE *fstream, unsigned char *buf, int size) {
  char *ptr;
  ptr = fgets(buf, size, fstream);
  return ptr == NULL;
}


x86 assembly (clang, -O0):
<serial_readline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%rdx
call   1030 <fgets@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_readline>:
push   %rax
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rax,%rdx
call   1030 <fgets@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @serial_readline(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = load i32*, i32** %4
%11 = call i8* @fgets(i8* %8, i32 %9, i32* %10)
store i8* %11, i8** %7
%12 = load i8*, i8** %7
%13 = icmp eq i8* %12, null
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @serial_readline(i32* nocapture %0, i8* %1, i32 %2) {
%4 = tail call i8* @fgets(i8* %1, i32 %2, i32* %0)
%5 = icmp eq i8* %4, null
%6 = zext i1 %5 to i32
ret i32 %6
}