xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ execvp(char *, char **);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int exec(int argc, char **argv) {
  if (argc < 2) {
    fprintf(stderr, "Usage: exec <filename>\n");
    return 2;
  }
  execvp(argv[1], &argv[1]);
  return 0;
}


x86 assembly (clang, -O0):
<exec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    115a <exec+0x3a>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
lea    0xeb7(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1176 <exec+0x56>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1040 <execvp@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exec>:
push   %rax
cmp    $0x1,%edi
jg     1142 <exec+0x22>
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
lea    0xeca(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%eax
pop    %rcx
ret
mov    0x8(%rsi),%rdi
add    $0x8,%rsi
call   1040 <execvp@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Usage: exec <filename>\0A\00"
define i32 @exec(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %11
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @execvp(i8* %9, i8** %8)
br label %11
11: ; preds = %7, %4
%12 = phi i32 [ 2, %4 ], [ 0, %7 ]
ret i32 %12
}
int test_nonstrict(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @test_nonstrict() {
ret i32 0
}
int test_imm_D9int64_midword_reg(long long val) {
  return ((val >> 16) & (0xD9 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_D9int64_midword_reg>:
test   $0xd90000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_D9int64_midword_reg(i64 %0) {
%2 = and i64 %0, 14221312
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct termios {
  int dummy;
};

/* Variables and functions */
scalar_t__ tcgetattr(int, struct termios *);
int isatty(int fd) {
  struct termios ts;
  return (tcgetattr(fd, &ts) >= 0);
}


x86 assembly (clang, -O0):
<isatty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1030 <tcgetattr@plt>
cmp    $0x0,%rax
setge  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isatty>:
push   %rax
mov    %rsp,%rsi
call   1030 <tcgetattr@plt>
shr    $0x3f,%rax
xor    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.termios = type { i32 }
define i32 @isatty(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.termios
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i64 @tcgetattr(i32 %4, %struct.termios* %3)
%6 = icmp sge i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
%struct.termios = type { i32 }
define i32 @isatty(i32 %0) {
%2 = alloca %struct.termios
%3 = bitcast %struct.termios* %2 to i8*
%4 = call i64 @tcgetattr(i32 %0, %struct.termios* %2)
%5 = lshr i64 %4, 63
%6 = trunc i64 %5 to i32
%7 = xor i32 %6, 1
ret i32 %7
}
/* Variables and functions */
size_t oml_malloc_usable_size(void *ptr) {
  if (!ptr)
    return 0;
  size_t *sptr = (size_t *)ptr - 1;
  return *sptr - sizeof(size_t);
}


x86 assembly (clang, -O0):
<oml_malloc_usable_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1120 <oml_malloc_usable_size+0x20>
movq   $0x0,-0x8(%rbp)
jmp    113b <oml_malloc_usable_size+0x3b>
mov    -0x10(%rbp),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
sub    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<oml_malloc_usable_size>:
test   %rdi,%rdi
je     110e <oml_malloc_usable_size+0xe>
mov    -0x8(%rdi),%rax
add    $0xfffffffffffffff8,%rax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @oml_malloc_usable_size(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = getelementptr inbounds i8, i8* %0, i64 -8
%5 = bitcast i8* %4 to i64*
%6 = load i64, i64* %5
%7 = add i64 %6, -8
br label %8
8: ; preds = %1, %3
%9 = phi i64 [ %7, %3 ], [ 0, %1 ]
ret i64 %9
}
/* Variables and functions */
int /*<<< orphan*/ __poet_fail();
int nondet(int, int);
int main(void) {
  int x = nondet(1, 10);
  if (x > 15)
    __poet_fail();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
mov    $0xa,%esi
call   1040 <nondet@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xf,-0x8(%rbp)
jle    1152 <main+0x32>
mov    $0x0,%al
call   1030 <__poet_fail@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0xa,%esi
call   1040 <nondet@plt>
cmp    $0x10,%eax
jl     113c <main+0x1c>
xor    %eax,%eax
call   1030 <__poet_fail@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @nondet(i32 1, i32 10)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 15
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @__poet_fail()
br label %8
8: ; preds = %6, %0
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @nondet(i32 1, i32 10)
%2 = icmp sgt i32 %1, 15
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @__poet_fail()
br label %5
5: ; preds = %3, %0
ret i32 0
}
int kbase_dma_fence_init(struct kbase_context *kctx) { return 0; }


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

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

LLVM IR (-O0):
%struct.kbase_context = type opaque
define i32 @kbase_dma_fence_init(%struct.kbase_context* %0) {
%2 = alloca %struct.kbase_context*
store %struct.kbase_context* %0, %struct.kbase_context** %2
ret i32 0
}

LLVM IR (-O2):
%struct.kbase_context = type opaque
define i32 @kbase_dma_fence_init(%struct.kbase_context* nocapture readnone %0) {
ret i32 0
}
int int_range(int min, int max) {
  extern int int_value(void);
  int val = int_value();
  if (val < min || max < val)
    val = min;
  return val;
}


x86 assembly (clang, -O0):
<int_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
call   1030 <int_value@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jl     113e <int_range+0x2e>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1144 <int_range+0x34>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_range>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <int_value@plt>
cmp    %ebx,%eax
mov    %eax,%ecx
cmovg  %ebp,%ecx
cmp    %ebp,%eax
cmovl  %ebp,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @int_range(i32 %0, i32 %1) {
%3 = tail call i32 @int_value()
%4 = icmp slt i32 %3, %0
%5 = icmp sgt i32 %3, %1
%6 = or i1 %4, %5
%7 = select i1 %6, i32 %0, i32 %3
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
int getint() {
  int tmp;
  scanf("%d", &tmp);
  return tmp;
}


x86 assembly (clang, -O0):
<getint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getint>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @getint() {
%1 = alloca i32
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @getint() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ GL_QUADS;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glNormal3i(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ glVertex3f(int, int, int);
void drawFace(void) {
  glBegin(GL_QUADS);
  glNormal3i(0, 0, 1);
  glVertex3f(1, 1, 1);
  glVertex3f(-1, 1, 1);
  glVertex3f(-1, -1, 1);
  glVertex3f(1, -1, 1);
  glEnd();
}


x86 assembly (clang, -O0):
<drawFace>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1060 <glBegin@plt>
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1050 <glNormal3i@plt>
mov    $0x1,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1030 <glVertex3f@plt>
mov    $0xffffffff,%edi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <glVertex3f@plt>
mov    $0xffffffff,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1030 <glVertex3f@plt>
mov    $0x1,%edx
mov    $0xffffffff,%esi
mov    %edx,%edi
call   1030 <glVertex3f@plt>
mov    $0x0,%al
call   1040 <glEnd@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawFace>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
call   1060 <glBegin@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1050 <glNormal3i@plt>
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <glVertex3f@plt>
mov    $0xffffffff,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <glVertex3f@plt>
mov    $0xffffffff,%edi
mov    $0xffffffff,%esi
mov    $0x1,%edx
call   1030 <glVertex3f@plt>
mov    $0x1,%edi
mov    $0xffffffff,%esi
mov    $0x1,%edx
call   1030 <glVertex3f@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <glEnd@plt>

LLVM IR (-O0):
@GL_QUADS = global i32 0
define void @drawFace() {
%1 = load i32, i32* @GL_QUADS
%2 = call i32 @glBegin(i32 %1)
%3 = call i32 @glNormal3i(i32 0, i32 0, i32 1)
%4 = call i32 @glVertex3f(i32 1, i32 1, i32 1)
%5 = call i32 @glVertex3f(i32 -1, i32 1, i32 1)
%6 = call i32 @glVertex3f(i32 -1, i32 -1, i32 1)
%7 = call i32 @glVertex3f(i32 1, i32 -1, i32 1)
%8 = call i32 (...) @glEnd()
ret void
}

LLVM IR (-O2):
@GL_QUADS = global i32 0
define void @drawFace() {
%1 = load i32, i32* @GL_QUADS
%2 = tail call i32 @glBegin(i32 %1)
%3 = tail call i32 @glNormal3i(i32 0, i32 0, i32 1)
%4 = tail call i32 @glVertex3f(i32 1, i32 1, i32 1)
%5 = tail call i32 @glVertex3f(i32 -1, i32 1, i32 1)
%6 = tail call i32 @glVertex3f(i32 -1, i32 -1, i32 1)
%7 = tail call i32 @glVertex3f(i32 1, i32 -1, i32 1)
%8 = tail call i32 (...) @glEnd()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ vec3f(float, float, float);
float vec3f_length(int /*<<< orphan*/);
float call_length3(float x, float y, float z) {
  return vec3f_length(vec3f(x, y, z));
}


x86 assembly (clang, -O0):
<call_length3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
call   1040 <vec3f@plt>
mov    %eax,%edi
call   1030 <vec3f_length@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define float @call_length3(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 @vec3f(float %7, float %8, float %9)
%11 = call float @vec3f_length(i32 %10)
ret float %11
}

LLVM IR (-O2):
define float @call_length3(float %0, float %1, float %2) {
%4 = tail call i32 @vec3f(float %0, float %1, float %2)
%5 = tail call float @vec3f_length(i32 %4)
ret float %5
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int ffs(int /*<<< orphan*/);
int bitmap32_ffs(int32_t *bitmap) { return ffs(*bitmap) - 1; }


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

x86 assembly (clang, -O2):
<bitmap32_ffs>:
mov    (%rdi),%eax
bsf    %eax,%ecx
mov    $0xffffffff,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @bitmap32_ffs(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = call i32 @ffs(i32 %4)
%6 = sub nsw i32 %5, 1
ret i32 %6
}

LLVM IR (-O2):
define i32 @bitmap32_ffs(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @llvm.cttz.i32(i32 %2, i1 true)
%4 = icmp eq i32 %2, 0
%5 = select i1 %4, i32 -1, i32 %3
ret i32 %5
}
double degfcorr(int ai) {
  const double degf[16] = {0.00000, 0.00005, 0.00009, 0.00012, 0.00015, 0.00020,
                           0.00030, 0.00045, 0.00060, 0.00090, 0.00150, 0.00210,
                           0.00270, 0.00330, 0.00460, 0.00580};
  return 0 < ai && ai <= 15 ? degf[ai] : 0.0058;
}


x86 assembly (clang, -O0):
<degfcorr>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
lea    0xee4(%rip),%rsi
mov    $0x80,%edx
call   1030 <memcpy@plt>
xor    %eax,%eax
cmp    -0x4(%rbp),%eax
jge    1165 <degfcorr+0x55>
cmpl   $0xf,-0x4(%rbp)
jg     1165 <degfcorr+0x55>
movslq -0x4(%rbp),%rax
movsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x98(%rbp)
ff
jmp    117a <degfcorr+0x6a>
movsd  0xe93(%rip),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    117a <degfcorr+0x6a>
movsd  -0x98(%rbp),%xmm0
ff
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<degfcorr>:
lea    -0x1(%rdi),%eax
cmp    $0xe,%eax
ja     1117 <degfcorr+0x17>
mov    %edi,%eax
lea    0xeff(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
ret
movsd  0xee1(%rip),%xmm0
ret

LLVM IR (-O0):
@__const.degfcorr.degf = [16 x double] [double 0.000000e+00, double 5.000000e-05, double 9.000000e-05, double 1.200000e-04, double 1.500000e-04, double 2.000000e-04, double 3.000000e-04, double 4.500000e-04, double 6.000000e-04, double 9.000000e-04, double 1.500000e-03, double 2.100000e-03, double 2.700000e-03, double 3.300000e-03, double 4.600000e-03, double 5.800000e-03]
define double @degfcorr(i32 %0) {
%2 = alloca i32
%3 = alloca [16 x double]
store i32 %0, i32* %2
%4 = bitcast [16 x double]* %3 to i8*
%5 = load i32, i32* %2
%6 = icmp slt i32 0, %5
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp sle i32 %8, 15
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 %12
%14 = load double, double* %13
br label %16
15: ; preds = %7, %1
br label %16
16: ; preds = %15, %10
%17 = phi double [ %14, %10 ], [ 5.800000e-03, %15 ]
ret double %17
}

LLVM IR (-O2):
@__const.degfcorr.degf = [16 x double] [double 0.000000e+00, double 5.000000e-05, double 9.000000e-05, double 1.200000e-04, double 1.500000e-04, double 2.000000e-04, double 3.000000e-04, double 4.500000e-04, double 6.000000e-04, double 9.000000e-04, double 1.500000e-03, double 2.100000e-03, double 2.700000e-03, double 3.300000e-03, double 4.600000e-03, double 5.800000e-03]
define double @degfcorr(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 15
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = zext i32 %0 to i64
%6 = getelementptr inbounds [16 x double], [16 x double]* @__const.degfcorr.degf, i64 0, i64 %5
%7 = load double, double* %6
br label %8
8: ; preds = %1, %4
%9 = phi double [ %7, %4 ], [ 5.800000e-03, %1 ]
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void show_cur(void) { printf("\033[?25h"); }


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"\1B[?25h\00"
define void @show_cur() {
%1 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"\1B[?25h\00"
define void @show_cur() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ task_deassert_flag(int, int);
void task_deassert_active(int id) { task_deassert_flag(id, (1 << 2)); }


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

x86 assembly (clang, -O2):
<task_deassert_active>:
mov    $0x4,%esi
jmp    1030 <task_deassert_flag@plt>

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

LLVM IR (-O2):
define void @task_deassert_active(i32 %0) {
%2 = tail call i32 @task_deassert_flag(i32 %0, i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ MSG_DONTWAIT;
scalar_t__ recv(int, char *, int, int /*<<< orphan*/);
int synchnet(int f) {
  int j = 0;
  char dummy;
  while (1) {
    if (recv(f, &dummy, 1, MSG_DONTWAIT) < 0)
      break;
    j++;
  }
  return j;
}


x86 assembly (clang, -O0):
<synchnet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb4(%rip),%rax
mov    (%rax),%ecx
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
call   1030 <recv@plt>
cmp    $0x0,%rax
jge    114b <synchnet+0x3b>
jmp    1159 <synchnet+0x49>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <synchnet+0x12>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<synchnet>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0xffffffff,%ebx
mov    0x2ebb(%rip),%r15
lea    0x7(%rsp),%r14
nopw   0x0(%rax,%rax,1)
mov    (%r15),%ecx
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <recv@plt>
add    $0x1,%ebx
test   %rax,%rax
jns    1130 <synchnet+0x20>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@MSG_DONTWAIT = global i32 0
define i32 @synchnet(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %2
store i32 0, i32* %3
br label %5
5: ; preds = %1, %11
%6 = load i32, i32* %2
%7 = load i32, i32* @MSG_DONTWAIT
%8 = call i64 @recv(i32 %6, i8* %4, i32 1, i32 %7)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %5
br label %14
11: ; preds = %5
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %5
14: ; preds = %10
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@MSG_DONTWAIT = global i32 0
define i32 @synchnet(i32 %0) {
%2 = alloca i8
br label %3
3: ; preds = %3, %1
%4 = phi i32 [ 0, %1 ], [ %8, %3 ]
%5 = load i32, i32* @MSG_DONTWAIT
%6 = call i64 @recv(i32 %0, i8* %2, i32 1, i32 %5)
%7 = icmp slt i64 %6, 0
%8 = add nuw nsw i32 %4, 1
br i1 %7, label %9, label %3
9: ; preds = %3
ret i32 %4
}
int test3(int e, int f) { return (e ^ f) == f; }


x86 assembly (clang, -O0):
<test3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test3>:
xor    %eax,%eax
test   %edi,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @test3(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = xor i32 %5, %6
%8 = load i32, i32* %4
%9 = icmp eq i32 %7, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @test3(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
void *free_list_pop(void **list) {
  void *block = *list;
  *list = *((void **)block);
  return block;
}


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

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

LLVM IR (-O0):
define i8* @free_list_pop(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = load i8*, i8** %4
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i8**
%8 = load i8*, i8** %7
%9 = load i8**, i8*** %2
store i8* %8, i8** %9
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
define i8* @free_list_pop(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = bitcast i8* %2 to i8**
%4 = load i8*, i8** %3
store i8* %4, i8** %0
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ ili9320_WriteReg(int, int);
void ili9320_DisplayOff(void) {
  ili9320_WriteReg(0x10, 0x0000);
  ili9320_WriteReg(0x11, 0x0000);
  ili9320_WriteReg(0x12, 0x0000);
  ili9320_WriteReg(0x13, 0x0000);
  ili9320_WriteReg(0x29, 0x0000);
  ili9320_WriteReg(0x07, 0x0);
}


x86 assembly (clang, -O0):
<ili9320_DisplayOff>:
push   %rbp
mov    %rsp,%rbp
mov    $0x10,%edi
xor    %esi,%esi
call   1030 <ili9320_WriteReg@plt>
mov    $0x11,%edi
xor    %esi,%esi
call   1030 <ili9320_WriteReg@plt>
mov    $0x12,%edi
xor    %esi,%esi
call   1030 <ili9320_WriteReg@plt>
mov    $0x13,%edi
xor    %esi,%esi
call   1030 <ili9320_WriteReg@plt>
mov    $0x29,%edi
xor    %esi,%esi
call   1030 <ili9320_WriteReg@plt>
mov    $0x7,%edi
xor    %esi,%esi
call   1030 <ili9320_WriteReg@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ili9320_DisplayOff>:
push   %rax
mov    $0x10,%edi
xor    %esi,%esi
call   1030 <ili9320_WriteReg@plt>
mov    $0x11,%edi
xor    %esi,%esi
call   1030 <ili9320_WriteReg@plt>
mov    $0x12,%edi
xor    %esi,%esi
call   1030 <ili9320_WriteReg@plt>
mov    $0x13,%edi
xor    %esi,%esi
call   1030 <ili9320_WriteReg@plt>
mov    $0x29,%edi
xor    %esi,%esi
call   1030 <ili9320_WriteReg@plt>
mov    $0x7,%edi
xor    %esi,%esi
pop    %rax
jmp    1030 <ili9320_WriteReg@plt>

LLVM IR (-O0):
define void @ili9320_DisplayOff() {
%1 = call i32 @ili9320_WriteReg(i32 16, i32 0)
%2 = call i32 @ili9320_WriteReg(i32 17, i32 0)
%3 = call i32 @ili9320_WriteReg(i32 18, i32 0)
%4 = call i32 @ili9320_WriteReg(i32 19, i32 0)
%5 = call i32 @ili9320_WriteReg(i32 41, i32 0)
%6 = call i32 @ili9320_WriteReg(i32 7, i32 0)
ret void
}

LLVM IR (-O2):
define void @ili9320_DisplayOff() {
%1 = tail call i32 @ili9320_WriteReg(i32 16, i32 0)
%2 = tail call i32 @ili9320_WriteReg(i32 17, i32 0)
%3 = tail call i32 @ili9320_WriteReg(i32 18, i32 0)
%4 = tail call i32 @ili9320_WriteReg(i32 19, i32 0)
%5 = tail call i32 @ili9320_WriteReg(i32 41, i32 0)
%6 = tail call i32 @ili9320_WriteReg(i32 7, i32 0)
ret void
}
void S_LocalSound(char *s) {}


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

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

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

LLVM IR (-O2):
define void @S_LocalSound(i8* nocapture %0) {
ret void
}
long hexbin(ch)
char ch;
{
  if (isdigit(ch))
    return ((long)(ch - '0'));
  else
    return ((long)((isupper(ch) ? tolower(ch) : ch) - 'a' + 10));
}


x86 assembly (clang, -O0):
<hexbin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
je     1162 <hexbin+0x32>
movsbl -0x9(%rbp),%eax
sub    $0x30,%eax
cltq
mov    %rax,-0x8(%rbp)
jmp    119b <hexbin+0x6b>
movsbl -0x9(%rbp),%edi
call   1050 <isupper@plt>
cmp    $0x0,%eax
je     1185 <hexbin+0x55>
movsbl -0x9(%rbp),%edi
call   1040 <tolower@plt>
mov    %eax,-0x10(%rbp)
jmp    118c <hexbin+0x5c>
movsbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexbin>:
push   %rbx
movsbl %dil,%ebx
lea    -0x30(%rbx),%eax
cmp    $0xa,%eax
jb     1146 <hexbin+0x26>
mov    %ebx,%edi
call   1040 <isupper@plt>
test   %eax,%eax
je     1141 <hexbin+0x21>
mov    %ebx,%edi
call   1030 <tolower@plt>
mov    %eax,%ebx
add    $0xffffffa9,%ebx
mov    %ebx,%eax
cltq
pop    %rbx
ret

LLVM IR (-O0):
define i64 @hexbin(i32 %0) {
%2 = alloca i64
%3 = alloca i8
%4 = trunc i32 %0 to i8
store i8 %4, i8* %3
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = call i32 @isdigit(i32 %6)
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = sub nsw i32 %11, 48
%13 = sext i32 %12 to i64
store i64 %13, i64* %2
br label %31
14: ; preds = %1
%15 = load i8, i8* %3
%16 = sext i8 %15 to i32
%17 = call i32 @isupper(i32 %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %14
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = call i32 @tolower(i32 %21)
br label %26
23: ; preds = %14
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
br label %26
26: ; preds = %23, %19
%27 = phi i32 [ %22, %19 ], [ %25, %23 ]
%28 = sub nsw i32 %27, 97
%29 = add nsw i32 %28, 10
%30 = sext i32 %29 to i64
store i64 %30, i64* %2
br label %31
31: ; preds = %26, %9
%32 = load i64, i64* %2
ret i64 %32
}

LLVM IR (-O2):
define i64 @hexbin(i32 %0) {
%2 = shl i32 %0, 24
%3 = ashr exact i32 %2, 24
%4 = add nsw i32 %3, -48
%5 = icmp ult i32 %4, 10
br i1 %5, label %14, label %6
6: ; preds = %1
%7 = tail call i32 @isupper(i32 %3)
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @tolower(i32 %3)
br label %11
11: ; preds = %6, %9
%12 = phi i32 [ %10, %9 ], [ %3, %6 ]
%13 = add nsw i32 %12, -87
br label %14
14: ; preds = %1, %11
%15 = phi i32 [ %13, %11 ], [ %4, %1 ]
%16 = sext i32 %15 to i64
ret i64 %16
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void wsky_free(void *data) { free(data); }


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

x86 assembly (clang, -O2):
<wsky_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @wsky_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int tsubi_null_close(void *userdata) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @tsubi_null_close(i8* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef size_t uint16_t;

/* Variables and functions */
int /*<<< orphan*/ US_GET_BYTE_0(size_t);
int /*<<< orphan*/ US_GET_BYTE_1(size_t);
void us_bits_set_doublet(void *base, uint16_t offset, uint16_t value) {
  uint8_t *data = (uint8_t *)base;
  data[offset] = US_GET_BYTE_1(value);
  data[offset + 1] = US_GET_BYTE_0(value);
}


x86 assembly (clang, -O0):
<us_bits_set_doublet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <US_GET_BYTE_1@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rdi
call   1040 <US_GET_BYTE_0@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %edx,0x4(%rax,%rcx,4)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<us_bits_set_doublet>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
call   1030 <US_GET_BYTE_1@plt>
mov    %eax,(%r15,%r14,4)
mov    %rbx,%rdi
call   1040 <US_GET_BYTE_0@plt>
mov    %eax,0x4(%r15,%r14,4)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @us_bits_set_doublet(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
store i32* %9, i32** %7
%10 = load i64, i64* %6
%11 = call i32 @US_GET_BYTE_1(i64 %10)
%12 = load i32*, i32** %7
%13 = load i64, i64* %5
%14 = getelementptr inbounds i32, i32* %12, i64 %13
store i32 %11, i32* %14
%15 = load i64, i64* %6
%16 = call i32 @US_GET_BYTE_0(i64 %15)
%17 = load i32*, i32** %7
%18 = load i64, i64* %5
%19 = add i64 %18, 1
%20 = getelementptr inbounds i32, i32* %17, i64 %19
store i32 %16, i32* %20
ret void
}

LLVM IR (-O2):
define void @us_bits_set_doublet(i8* nocapture writeonly %0, i64 %1, i64 %2) {
%4 = bitcast i8* %0 to i32*
%5 = tail call i32 @US_GET_BYTE_1(i64 %2)
%6 = getelementptr inbounds i32, i32* %4, i64 %1
store i32 %5, i32* %6
%7 = tail call i32 @US_GET_BYTE_0(i64 %2)
%8 = add i64 %1, 1
%9 = getelementptr inbounds i32, i32* %4, i64 %8
store i32 %7, i32* %9
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int __semihost(int, int /*<<< orphan*/ *);
int semihost_exit(void) {
  uint32_t args[4];
  return __semihost((0x18), args);
}


x86 assembly (clang, -O0):
<semihost_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rsi
mov    $0x18,%edi
call   1030 <__semihost@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<semihost_exit>:
sub    $0x18,%rsp
mov    %rsp,%rsi
mov    $0x18,%edi
call   1030 <__semihost@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @semihost_exit() {
%1 = alloca [4 x i32]
%2 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%3 = call i32 @__semihost(i32 24, i32* %2)
ret i32 %3
}

LLVM IR (-O2):
define i32 @semihost_exit() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @__semihost(i32 24, i32* %3)
ret i32 %4
}
int fun_two(j) {
  printf("%d ", j);
  if (j <= 0)
    return fun_one(j);
  else
    return fun_two(j - 5);
}


x86 assembly (clang, -O0):
<fun_two>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jg     1168 <fun_two+0x38>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1030 <fun_one@plt>
mov    %eax,-0x4(%rbp)
jmp    1176 <fun_two+0x46>
mov    -0x8(%rbp),%edi
sub    $0x5,%edi
call   1050 <fun_two@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun_two>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %edi,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0x5(%rbx),%edi
test   %ebx,%ebx
jg     1130 <fun_two+0x10>
add    $0x5,%edi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fun_one@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define i32 @fun_two(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %3
%7 = icmp sle i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* %3
%10 = call i32 (i32, ...) bitcast (i32 (...)* @fun_one to i32 (i32, ...)*)(i32 %9)
store i32 %10, i32* %2
br label %15
11: ; preds = %1
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 5
%14 = call i32 @fun_two(i32 %13)
store i32 %14, i32* %2
br label %15
15: ; preds = %11, %8
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @fun_two(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ %0, %1 ], [ %6, %2 ]
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = icmp slt i32 %3, 1
%6 = add nsw i32 %3, -5
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @fun_one to i32 (i32, ...)*)(i32 %3)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ uart_setup();
void consoleinit(void) { uart_setup(); }


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

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

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

LLVM IR (-O2):
define void @consoleinit() {
%1 = tail call i32 (...) @uart_setup()
ret void
}
/* Variables and functions */
int machdep_sys_recvfrom(int, void *, int, int, int /*<<< orphan*/ *,
                         int /*<<< orphan*/);
machdep_sys_recv(int s, void *buf, int len, int flags) {
  return (machdep_sys_recvfrom(s, buf, len, flags, NULL, 0));
}


x86 assembly (clang, -O0):
<machdep_sys_recv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
xor    %eax,%eax
mov    %eax,%r8d
xor    %r9d,%r9d
call   1030 <machdep_sys_recvfrom@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<machdep_sys_recv>:
xor    %r8d,%r8d
xor    %r9d,%r9d
jmp    1030 <machdep_sys_recvfrom@plt>

LLVM IR (-O0):
define i32 @machdep_sys_recv(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @machdep_sys_recvfrom(i32 %9, i8* %10, i32 %11, i32 %12, i32* null, i32 0)
ret i32 %13
}

LLVM IR (-O2):
define i32 @machdep_sys_recv(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @machdep_sys_recvfrom(i32 %0, i8* %1, i32 %2, i32 %3, i32* null, i32 0)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ flush_input(int /*<<< orphan*/);
int /*<<< orphan*/ get_single_quiet(char *);
int /*<<< orphan*/ my_printf(char *);
int /*<<< orphan*/ my_putchar(char);
void hit_return_now(void) {
  flush_input(0);
  my_printf("\nHit return to continue...");
  get_single_quiet("\n");
  my_putchar('\n');
}


x86 assembly (clang, -O0):
<hit_return_now>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1060 <flush_input@plt>
lea    0xeae(%rip),%rdi
call   1030 <my_printf@plt>
lea    0xebd(%rip),%rdi
call   1040 <get_single_quiet@plt>
mov    $0xa,%edi
call   1050 <my_putchar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hit_return_now>:
push   %rax
xor    %edi,%edi
call   1060 <flush_input@plt>
lea    0xeb1(%rip),%rdi
call   1030 <my_printf@plt>
lea    0xec0(%rip),%rdi
call   1040 <get_single_quiet@plt>
mov    $0xa,%edi
pop    %rax
jmp    1050 <my_putchar@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"\0AHit return to continue...\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @hit_return_now() {
%1 = call i32 @flush_input(i32 0)
%2 = call i32 @my_printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @get_single_quiet(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @my_putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"\0AHit return to continue...\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @hit_return_now() {
%1 = tail call i32 @flush_input(i32 0)
%2 = tail call i32 @my_printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @get_single_quiet(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @my_putchar(i8 signext 10)
ret void
}
void pollen_interfaces_Gpio_toggle__E() {}


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

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

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

LLVM IR (-O2):
define void @pollen_interfaces_Gpio_toggle__E() {
ret void
}
/* Variables and functions */
unsigned short rand();
unsigned short range_ushrt(unsigned short min, unsigned short max) {
  unsigned short val = rand();
  return val < min || max < val ? min : val;
}


x86 assembly (clang, -O0):
<range_ushrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %ax,-0x6(%rbp)
movzwl -0x6(%rbp),%eax
movzwl -0x2(%rbp),%ecx
cmp    %ecx,%eax
jl     1151 <range_ushrt+0x41>
movzwl -0x4(%rbp),%eax
movzwl -0x6(%rbp),%ecx
cmp    %ecx,%eax
jge    115d <range_ushrt+0x4d>
movzwl -0x2(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1164 <range_ushrt+0x54>
movzwl -0x6(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<range_ushrt>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
cmp    %bx,%ax
mov    %eax,%ecx
cmova  %ebp,%ecx
cmp    %bp,%ax
cmovb  %ebp,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define zeroext i16 @range_ushrt(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
%5 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%6 = call zeroext i16 (...) @rand()
store i16 %6, i16* %5
%7 = load i16, i16* %5
%8 = zext i16 %7 to i32
%9 = load i16, i16* %3
%10 = zext i16 %9 to i32
%11 = icmp slt i32 %8, %10
br i1 %11, label %18, label %12
12: ; preds = %2
%13 = load i16, i16* %4
%14 = zext i16 %13 to i32
%15 = load i16, i16* %5
%16 = zext i16 %15 to i32
%17 = icmp slt i32 %14, %16
br i1 %17, label %18, label %21
18: ; preds = %12, %2
%19 = load i16, i16* %3
%20 = zext i16 %19 to i32
br label %24
21: ; preds = %12
%22 = load i16, i16* %5
%23 = zext i16 %22 to i32
br label %24
24: ; preds = %21, %18
%25 = phi i32 [ %20, %18 ], [ %23, %21 ]
%26 = trunc i32 %25 to i16
ret i16 %26
}

LLVM IR (-O2):
define zeroext i16 @range_ushrt(i16 zeroext %0, i16 zeroext %1) {
%3 = tail call zeroext i16 (...) @rand()
%4 = icmp ult i16 %3, %0
%5 = icmp ugt i16 %3, %1
%6 = or i1 %4, %5
%7 = select i1 %6, i16 %0, i16 %3
ret i16 %7
}
/* Variables and functions */
int ad_get_info(int, int);
int cmd_get_info(int dev) { return ad_get_info(1, dev); }


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

x86 assembly (clang, -O2):
<cmd_get_info>:
mov    %edi,%esi
mov    $0x1,%edi
jmp    1030 <ad_get_info@plt>

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

LLVM IR (-O2):
define i32 @cmd_get_info(i32 %0) {
%2 = tail call i32 @ad_get_info(i32 1, i32 %0)
ret i32 %2
}
/* Type definitions */
struct bi_tree {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ bi_tree_update_impl(struct bi_tree *, int, int);
void bi_tree_insert(struct bi_tree *bi, int val, int idx) {
  if (bi == NULL)
    return;
  bi_tree_update_impl(bi, val, idx + 1);
}


x86 assembly (clang, -O0):
<bi_tree_insert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1132 <bi_tree_insert+0x22>
jmp    1144 <bi_tree_insert+0x34>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
add    $0x1,%edx
call   1030 <bi_tree_update_impl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bi_tree_insert>:
test   %rdi,%rdi
je     111d <bi_tree_insert+0xd>
add    $0x1,%edx
jmp    1030 <bi_tree_update_impl@plt>
ret

LLVM IR (-O0):
%struct.bi_tree = type { i32 }
define void @bi_tree_insert(%struct.bi_tree* %0, i32 %1, i32 %2) {
%4 = alloca %struct.bi_tree*
%5 = alloca i32
%6 = alloca i32
store %struct.bi_tree* %0, %struct.bi_tree** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load %struct.bi_tree*, %struct.bi_tree** %4
%8 = icmp eq %struct.bi_tree* %7, null
br i1 %8, label %9, label %10
9: ; preds = %3
br label %16
10: ; preds = %3
%11 = load %struct.bi_tree*, %struct.bi_tree** %4
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = add nsw i32 %13, 1
%15 = call i32 @bi_tree_update_impl(%struct.bi_tree* %11, i32 %12, i32 %14)
br label %16
16: ; preds = %10, %9
ret void
}

LLVM IR (-O2):
%struct.bi_tree = type { i32 }
define void @bi_tree_insert(%struct.bi_tree* %0, i32 %1, i32 %2) {
%4 = icmp eq %struct.bi_tree* %0, null
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = add nsw i32 %2, 1
%7 = tail call i32 @bi_tree_update_impl(%struct.bi_tree* %0, i32 %1, i32 %6)
br label %8
8: ; preds = %3, %5
ret void
}
/* Variables and functions */
void *calloc(int, int);
int /*<<< orphan*/ free(void *);
void *malloc(int);
void __attribute__((used)) __GC_KEEPALIVE__() {
  static int times = 1;
  void *x = malloc(times);
  free(x);
  x = calloc(1, times);
  free(x);
  x = calloc(times, 1);
  free(x);
  times++;
}


x86 assembly (clang, -O0):
<__GC_KEEPALIVE__>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2efa(%rip),%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    0x2ee2(%rip),%esi
mov    $0x1,%edi
call   1040 <calloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    0x2ec5(%rip),%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    0x2ea8(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e9f(%rip)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__GC_KEEPALIVE__>:
push   %rbx
mov    0x2f01(%rip),%ebx
mov    %ebx,%edi
call   1050 <malloc@plt>
mov    %rax,%rdi
call   1030 <free@plt>
mov    $0x1,%edi
mov    %ebx,%esi
call   1040 <calloc@plt>
mov    %rax,%rdi
call   1030 <free@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%rdi
call   1030 <free@plt>
add    $0x1,%ebx
mov    %ebx,0x2ec1(%rip)
pop    %rbx
ret

LLVM IR (-O0):
@__GC_KEEPALIVE__.times = internal global i32 1
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void ()* @__GC_KEEPALIVE__ to i8*)], section "llvm.metadata"
define void @__GC_KEEPALIVE__() {
%1 = alloca i8*
%2 = load i32, i32* @__GC_KEEPALIVE__.times
%3 = call i8* @malloc(i32 %2)
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call i32 @free(i8* %4)
%6 = load i32, i32* @__GC_KEEPALIVE__.times
%7 = call i8* @calloc(i32 1, i32 %6)
store i8* %7, i8** %1
%8 = load i8*, i8** %1
%9 = call i32 @free(i8* %8)
%10 = load i32, i32* @__GC_KEEPALIVE__.times
%11 = call i8* @calloc(i32 %10, i32 1)
store i8* %11, i8** %1
%12 = load i8*, i8** %1
%13 = call i32 @free(i8* %12)
%14 = load i32, i32* @__GC_KEEPALIVE__.times
%15 = add nsw i32 %14, 1
store i32 %15, i32* @__GC_KEEPALIVE__.times
ret void
}

LLVM IR (-O2):
@__GC_KEEPALIVE__.times = internal unnamed_addr global i32 1
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void ()* @__GC_KEEPALIVE__ to i8*)], section "llvm.metadata"
define void @__GC_KEEPALIVE__() {
%1 = load i32, i32* @__GC_KEEPALIVE__.times
%2 = tail call i8* @malloc(i32 %1)
%3 = tail call i32 @free(i8* %2)
%4 = tail call i8* @calloc(i32 1, i32 %1)
%5 = tail call i32 @free(i8* %4)
%6 = tail call i8* @calloc(i32 %1, i32 1)
%7 = tail call i32 @free(i8* %6)
%8 = add nsw i32 %1, 1
store i32 %8, i32* @__GC_KEEPALIVE__.times
ret void
}
/* Variables and functions */
int /*<<< orphan*/ DrawLine(double, double);
int /*<<< orphan*/ InitGraphics();
int /*<<< orphan*/ MovePen(double, double);
main() {
  InitGraphics();
  MovePen(0.5, 0.5);
  DrawLine(0.0, 1.0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <InitGraphics@plt>
movsd  0xec5(%rip),%xmm1
movaps %xmm1,%xmm0
call   1050 <MovePen@plt>
xorps  %xmm0,%xmm0
movsd  0xeaa(%rip),%xmm1
call   1040 <DrawLine@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <InitGraphics@plt>
movsd  0xec0(%rip),%xmm0
movaps %xmm0,%xmm1
call   1050 <MovePen@plt>
movsd  0xeb8(%rip),%xmm1
xorps  %xmm0,%xmm0
call   1040 <DrawLine@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @InitGraphics()
%2 = call i32 @MovePen(double 5.000000e-01, double 5.000000e-01)
%3 = call i32 @DrawLine(double 0.000000e+00, double 1.000000e+00)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @InitGraphics()
%2 = tail call i32 @MovePen(double 5.000000e-01, double 5.000000e-01)
%3 = tail call i32 @DrawLine(double 0.000000e+00, double 1.000000e+00)
ret i32 0
}