xunge/DecIR huggingface dataset:
/* Variables and functions */
int gethostname(char *, size_t);
int GetHostName(char *name, size_t len) {
  int junk;
  junk = gethostname(name, len);
  return (junk);
}


x86 assembly (clang, -O0):
<GetHostName>:
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   1030 <gethostname@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetHostName>:
jmp    1030 <gethostname@plt>

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

LLVM IR (-O2):
define i32 @GetHostName(i8* %0, i64 %1) {
%3 = tail call i32 @gethostname(i8* %0, i64 %1)
ret i32 %3
}
unsigned int fls(unsigned int x) {
  return x ? sizeof(x) * 8 - __builtin_clz(x) : 0;
}


x86 assembly (clang, -O0):
<fls>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     112e <fls+0x2e>
mov    -0x4(%rbp),%eax
bsr    %eax,%eax
xor    $0x1f,%eax
movslq %eax,%rcx
mov    $0x20,%eax
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1139 <fls+0x39>
xor    %eax,%eax
mov    %rax,-0x10(%rbp)
jmp    1139 <fls+0x39>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fls>:
test   %edi,%edi
je     110e <fls+0xe>
bsr    %edi,%eax
xor    $0xffffffe0,%eax
add    $0x21,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @fls(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i32 @llvm.ctlz.i32(i32 %6, i1 true)
%8 = sext i32 %7 to i64
%9 = sub i64 32, %8
br label %11
10: ; preds = %1
br label %11
11: ; preds = %10, %5
%12 = phi i64 [ %9, %5 ], [ 0, %10 ]
%13 = trunc i64 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @fls(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @llvm.ctlz.i32(i32 %0, i1 true)
%5 = sub nuw nsw i32 32, %4
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ %5, %3 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ error0(char *, char *);
void ac_inv(int v, char *vv) {
  if (!v) {
    error0("Class Invariant Violation.", vv);
  }
}


x86 assembly (clang, -O0):
<ac_inv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1139 <ac_inv+0x29>
mov    -0x10(%rbp),%rsi
lea    0xecc(%rip),%rdi
call   1030 <error0@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ac_inv>:
test   %edi,%edi
je     1115 <ac_inv+0x5>
ret
lea    0xee4(%rip),%rdi
jmp    1030 <error0@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Class Invariant Violation.\00"
define void @ac_inv(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = call i32 @error0(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %10
10: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"Class Invariant Violation.\00"
define void @ac_inv(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @error0(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %6
6: ; preds = %4, %2
ret void
}
/* Variables and functions */
void *calloc(int, size_t);
void *json_alloc(size_t size) { return calloc(1, size); }


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

x86 assembly (clang, -O2):
<json_alloc>:
mov    %rdi,%rsi
mov    $0x1,%edi
jmp    1030 <calloc@plt>

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

LLVM IR (-O2):
define i8* @json_alloc(i64 %0) {
%2 = tail call i8* @calloc(i32 1, i64 %0)
ret i8* %2
}
void occampi_typeattr_freechook(void *hook) { return; }


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

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

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

LLVM IR (-O2):
define void @occampi_typeattr_freechook(i8* nocapture %0) {
ret void
}
int test_imm_C9int8_mem(signed char *val) {
  return ((*val) & (-0xC9 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C9int8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0xffffff37,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_C9int8_mem>:
movsbl (%rdi),%eax
test   $0xffffff37,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_C9int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -201
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
int _fp_nan(double x) {
  volatile double x0 = x;
  return (x0 != x0);
}


x86 assembly (clang, -O0):
<_fp_nan>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
ucomisd %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_fp_nan>:
movsd  %xmm0,-0x8(%rsp)
movsd  -0x8(%rsp),%xmm0
cmpneqsd -0x8(%rsp),%xmm0
movq   %xmm0,%rax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @_fp_nan(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
store volatile double %4, double* %3
%5 = load volatile double, double* %3
%6 = load volatile double, double* %3
%7 = fcmp une double %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @_fp_nan(double %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
store volatile double %0, double* %2
%4 = load volatile double, double* %2
%5 = load volatile double, double* %2
%6 = fcmp une double %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t _RARRead32(const uint8_t *b) {
  return ((uint32_t)b[3] << 24) | ((uint32_t)b[2] << 16) |
         ((uint32_t)b[1] << 8) | (uint32_t)b[0];
}


x86 assembly (clang, -O0):
<_RARRead32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
mov    0x10(%rcx),%rcx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%rcx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_RARRead32>:
mov    0x18(%rdi),%ecx
shl    $0x18,%ecx
mov    0x8(%rdi),%eax
mov    0x10(%rdi),%edx
shl    $0x10,%edx
or     %ecx,%edx
shl    $0x8,%eax
or     %edx,%eax
or     (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @_RARRead32(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = getelementptr inbounds i64, i64* %3, i64 3
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = shl i32 %6, 24
%8 = load i64*, i64** %2
%9 = getelementptr inbounds i64, i64* %8, i64 2
%10 = load i64, i64* %9
%11 = trunc i64 %10 to i32
%12 = shl i32 %11, 16
%13 = or i32 %7, %12
%14 = load i64*, i64** %2
%15 = getelementptr inbounds i64, i64* %14, i64 1
%16 = load i64, i64* %15
%17 = trunc i64 %16 to i32
%18 = shl i32 %17, 8
%19 = or i32 %13, %18
%20 = load i64*, i64** %2
%21 = getelementptr inbounds i64, i64* %20, i64 0
%22 = load i64, i64* %21
%23 = trunc i64 %22 to i32
%24 = or i32 %19, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @_RARRead32(i64* nocapture %0) {
%2 = getelementptr inbounds i64, i64* %0, i64 3
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = shl i32 %4, 24
%6 = getelementptr inbounds i64, i64* %0, i64 2
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
%9 = shl i32 %8, 16
%10 = or i32 %9, %5
%11 = getelementptr inbounds i64, i64* %0, i64 1
%12 = load i64, i64* %11
%13 = trunc i64 %12 to i32
%14 = shl i32 %13, 8
%15 = or i32 %10, %14
%16 = load i64, i64* %0
%17 = trunc i64 %16 to i32
%18 = or i32 %15, %17
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void COMP4_5_6_IRQHandler() { default_handler(); }


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

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

LLVM IR (-O0):
define weak void @COMP4_5_6_IRQHandler() {
%1 = call i32 (...) @default_handler()
ret void
}

LLVM IR (-O2):
define weak void @COMP4_5_6_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ xfree(void *);
int free_data(const void *key, const void *datum) {
  xfree((void *)datum);
  return 0;
}


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

x86 assembly (clang, -O2):
<free_data>:
push   %rax
mov    %rsi,%rdi
call   1030 <xfree@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @free_data(i8* nocapture readnone %0, i8* %1) {
%3 = tail call i32 @xfree(i8* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ clang_analyzer_eval(int);
int f(int);
void testGlobalVariable() { clang_analyzer_eval(f(5) == 1); }


x86 assembly (clang, -O0):
<testGlobalVariable>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%edi
call   1030 <f@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testGlobalVariable>:
push   %rax
mov    $0x5,%edi
call   1030 <f@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
pop    %rax
jmp    1040 <clang_analyzer_eval@plt>

LLVM IR (-O0):
define void @testGlobalVariable() {
%1 = call i32 @f(i32 5)
%2 = icmp eq i32 %1, 1
%3 = zext i1 %2 to i32
%4 = call i32 @clang_analyzer_eval(i32 %3)
ret void
}

LLVM IR (-O2):
define void @testGlobalVariable() {
%1 = tail call i32 @f(i32 5)
%2 = icmp eq i32 %1, 1
%3 = zext i1 %2 to i32
%4 = tail call i32 @clang_analyzer_eval(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void start(void) { printf("hello world!\n"); }


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"hello world!\0A\00"
define void @start() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [13 x i8] c"hello world!\00"
define void @start() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ apr_terminate();
void apr_terminate2(void) { apr_terminate(); }


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

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

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

LLVM IR (-O2):
define void @apr_terminate2() {
%1 = tail call i32 (...) @apr_terminate()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ error(int);
void bad_syntax(void) { error(5); }


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

x86 assembly (clang, -O2):
<bad_syntax>:
mov    $0x5,%edi
jmp    1030 <error@plt>

LLVM IR (-O0):
define void @bad_syntax() {
%1 = call i32 @error(i32 5)
ret void
}

LLVM IR (-O2):
define void @bad_syntax() {
%1 = tail call i32 @error(i32 5)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void destory_yuv422_frame(uint8_t *buf) { free(buf); }


x86 assembly (clang, -O0):
<destory_yuv422_frame>:
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):
<destory_yuv422_frame>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @destory_yuv422_frame(i32* nocapture %0) {
%2 = tail call i32 @free(i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SYSTEMTIMER_waitMsOnStart(int);
int /*<<< orphan*/ sendBytes(int, int, int);
void DISPLAYS_start(void) {
  SYSTEMTIMER_waitMsOnStart(50);
  sendBytes(0x48, 0x11, 0x11);
}


x86 assembly (clang, -O0):
<DISPLAYS_start>:
push   %rbp
mov    %rsp,%rbp
mov    $0x32,%edi
call   1030 <SYSTEMTIMER_waitMsOnStart@plt>
mov    $0x48,%edi
mov    $0x11,%edx
mov    %edx,%esi
call   1040 <sendBytes@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<DISPLAYS_start>:
push   %rax
mov    $0x32,%edi
call   1030 <SYSTEMTIMER_waitMsOnStart@plt>
mov    $0x48,%edi
mov    $0x11,%esi
mov    $0x11,%edx
pop    %rax
jmp    1040 <sendBytes@plt>

LLVM IR (-O0):
define void @DISPLAYS_start() {
%1 = call i32 @SYSTEMTIMER_waitMsOnStart(i32 50)
%2 = call i32 @sendBytes(i32 72, i32 17, i32 17)
ret void
}

LLVM IR (-O2):
define void @DISPLAYS_start() {
%1 = tail call i32 @SYSTEMTIMER_waitMsOnStart(i32 50)
%2 = tail call i32 @sendBytes(i32 72, i32 17, i32 17)
ret void
}
/* Variables and functions */
int getline(char **, size_t *, int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ stdin;
int read_line(char **line) {
  int bytesRead;
  size_t nBytes = 512;
  *line = (char *)malloc(512 + 1);
  bytesRead = getline(line, &nBytes, stdin);
  return bytesRead;
}


x86 assembly (clang, -O0):
<read_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x200,-0x18(%rbp)
mov    $0x201,%edi
call   1030 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
mov    0x2e95(%rip),%rax
mov    (%rax),%edx
lea    -0x18(%rbp),%rsi
call   1040 <getline@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_line>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movq   $0x200,0x8(%rsp)
mov    $0x201,%edi
call   1030 <malloc@plt>
mov    %rax,(%rbx)
mov    0x2ea3(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <getline@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
define i32 @read_line(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
%4 = alloca i64
store i8** %0, i8*** %2
store i64 512, i64* %4
%5 = call i64 @malloc(i32 513)
%6 = inttoptr i64 %5 to i8*
%7 = load i8**, i8*** %2
store i8* %6, i8** %7
%8 = load i8**, i8*** %2
%9 = load i32, i32* @stdin
%10 = call i32 @getline(i8** %8, i64* %4, i32 %9)
store i32 %10, i32* %3
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @read_line(i8** %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
store i64 512, i64* %2
%4 = tail call i64 @malloc(i32 513)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %0
%6 = load i32, i32* @stdin
%7 = call i32 @getline(i8** %0, i64* %2, i32 %6)
ret i32 %7
}
int test(int *p) { return *p; }


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

x86 assembly (clang, -O2):
<test>:
mov    (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @test(i32* nocapture %0) {
%2 = load i32, i32* %0
ret i32 %2
}
int cmp_long_long(const void *ap, const void *bp) {
  long long a = *(long long *)ap;
  long long b = *(long long *)bp;
  if (a < b)
    return -1;
  else if (a > b)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<cmp_long_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    113c <cmp_long_long+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    115d <cmp_long_long+0x5d>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jle    1156 <cmp_long_long+0x56>
movl   $0x1,-0x4(%rbp)
jmp    115d <cmp_long_long+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_long_long>:
mov    (%rdi),%rax
xor    %ecx,%ecx
cmp    (%rsi),%rax
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp_long_long(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = bitcast i8* %1 to i64*
%6 = load i64, i64* %5
%7 = icmp slt i64 %4, %6
%8 = icmp sgt i64 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char const *, char const *,
                           char const *);
void iptables_delpre(char *cmd, const char *Vip, const char *Sip,
                     const char *Sport) {
  sprintf(cmd,
          "/sbin/iptables"
          " -t nat -D PREROUTING -p tcp -d %s --dport %s -j DNAT --to %s",
          Vip, Sport, Sip);
}


x86 assembly (clang, -O0):
<iptables_delpre>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xec1(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iptables_delpre>:
mov    %rdx,%r8
mov    %rsi,%rdx
lea    0xee3(%rip),%rsi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [76 x i8] c"/sbin/iptables -t nat -D PREROUTING -p tcp -d %s --dport %s -j DNAT --to %s\00"
define void @iptables_delpre(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i8*, i8** %8
%12 = load i8*, i8** %7
%13 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %11, i8* %12)
ret void
}

LLVM IR (-O2):
@.str = [76 x i8] c"/sbin/iptables -t nat -D PREROUTING -p tcp -d %s --dport %s -j DNAT --to %s\00"
define void @iptables_delpre(i8* nocapture writeonly %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %3, i8* %2)
ret void
}
void bar(double x) {}


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

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

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

LLVM IR (-O2):
define void @bar(double %0) {
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void ip_set_flag_mf(uint8_t *p_ip, uint8_t flag) {
  p_ip[6] &= ~0x20;
  p_ip[6] |= (flag & 1) << 5;
}


x86 assembly (clang, -O0):
<ip_set_flag_mf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%ecx
and    $0xffffffdf,%ecx
mov    %ecx,0x18(%rax)
mov    -0xc(%rbp),%ecx
and    $0x1,%ecx
shl    $0x5,%ecx
mov    -0x8(%rbp),%rax
or     0x18(%rax),%ecx
mov    %ecx,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ip_set_flag_mf>:
mov    0x18(%rdi),%eax
and    $0xffffffdf,%eax
shl    $0x5,%esi
and    $0x20,%esi
or     %eax,%esi
mov    %esi,0x18(%rdi)
ret

LLVM IR (-O0):
define void @ip_set_flag_mf(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 = getelementptr inbounds i32, i32* %5, i64 6
%7 = load i32, i32* %6
%8 = and i32 %7, -33
store i32 %8, i32* %6
%9 = load i32, i32* %4
%10 = and i32 %9, 1
%11 = shl i32 %10, 5
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 6
%14 = load i32, i32* %13
%15 = or i32 %14, %11
store i32 %15, i32* %13
ret void
}

LLVM IR (-O2):
define void @ip_set_flag_mf(i32* nocapture %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 6
%4 = load i32, i32* %3
%5 = and i32 %4, -33
%6 = shl i32 %1, 5
%7 = and i32 %6, 32
%8 = or i32 %5, %7
store i32 %8, i32* %3
ret void
}
unsigned char ft_ishex(const char s) {
  return ((0x2f < s && s < 0x3a) || (0x40 < s && s < 0x47) ||
          (0x60 < s && s < 0x67));
}


x86 assembly (clang, -O0):
<ft_ishex>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x2f,%eax
cmp    %ecx,%eax
jge    112d <ft_ishex+0x2d>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x3a,%ecx
mov    %al,-0x2(%rbp)
jl     1179 <ft_ishex+0x79>
movsbl -0x1(%rbp),%ecx
mov    $0x40,%eax
cmp    %ecx,%eax
jge    1150 <ft_ishex+0x50>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x47,%ecx
mov    %al,-0x2(%rbp)
jl     1179 <ft_ishex+0x79>
movsbl -0x1(%rbp),%edx
xor    %eax,%eax
mov    $0x60,%ecx
cmp    %edx,%ecx
mov    %al,-0x3(%rbp)
jge    1173 <ft_ishex+0x73>
movsbl -0x1(%rbp),%eax
cmp    $0x67,%eax
setl   %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_ishex>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
setb   %cl
and    $0xdf,%dil
add    $0xbf,%dil
cmp    $0x6,%dil
setb   %al
or     %cl,%al
ret

LLVM IR (-O0):
define zeroext i8 @ft_ishex(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp slt i32 47, %4
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp slt i32 %8, 58
br i1 %9, label %28, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp slt i32 64, %12
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp slt i32 %16, 71
br i1 %17, label %28, label %18
18: ; preds = %14, %10
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp slt i32 96, %20
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp slt i32 %24, 103
br label %26
26: ; preds = %22, %18
%27 = phi i1 [ false, %18 ], [ %25, %22 ]
br label %28
28: ; preds = %26, %14, %6
%29 = phi i1 [ true, %14 ], [ true, %6 ], [ %27, %26 ]
%30 = zext i1 %29 to i32
%31 = trunc i32 %30 to i8
ret i8 %31
}

LLVM IR (-O2):
define zeroext i8 @ft_ishex(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = and i8 %0, -33
%5 = add i8 %4, -65
%6 = icmp ult i8 %5, 6
%7 = or i1 %3, %6
%8 = zext i1 %7 to i8
ret i8 %8
}
int isfinite(double x) {
  unsigned short *val = (unsigned short *)&x;
  return (val[3] & 0x7ff0) != 0x7ff0;
}


x86 assembly (clang, -O0):
<isfinite>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzwl 0x6(%rax),%eax
and    $0x7ff0,%eax
cmp    $0x7ff0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isfinite>:
movq   %xmm0,%rcx
not    %rcx
movabs $0x7ff0000000000000,%rdx
xor    %eax,%eax
test   %rdx,%rcx
setne  %al
ret

LLVM IR (-O0):
define i32 @isfinite(double %0) {
%2 = alloca double
%3 = alloca i16*
store double %0, double* %2
%4 = bitcast double* %2 to i16*
store i16* %4, i16** %3
%5 = load i16*, i16** %3
%6 = getelementptr inbounds i16, i16* %5, i64 3
%7 = load i16, i16* %6
%8 = zext i16 %7 to i32
%9 = and i32 %8, 32752
%10 = icmp ne i32 %9, 32752
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @isfinite(double %0) {
%2 = bitcast double %0 to i64
%3 = and i64 %2, 9218868437227405312
%4 = icmp ne i64 %3, 9218868437227405312
%5 = zext i1 %4 to i32
ret i32 %5
}
int offset_of_char(unsigned c, const unsigned char *px, unsigned length) {
  int i;
  for (i = 0; i < (int)length; i++) {
    if (c == px[i])
      return i;
  }
  return -1;
}


x86 assembly (clang, -O0):
<offset_of_char>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1156 <offset_of_char+0x56>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x18(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    1143 <offset_of_char+0x43>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115d <offset_of_char+0x5d>
jmp    1148 <offset_of_char+0x48>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1115 <offset_of_char+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<offset_of_char>:
mov    $0xffffffff,%eax
test   %edx,%edx
jle    1121 <offset_of_char+0x21>
mov    %edx,%r8d
xor    %ecx,%ecx
xchg   %ax,%ax
movzbl (%rsi,%rcx,1),%edx
cmp    %edi,%edx
je     1122 <offset_of_char+0x22>
add    $0x1,%rcx
cmp    %rcx,%r8
jne    1110 <offset_of_char+0x10>
ret
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @offset_of_char(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%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 0, i32* %8
br label %9
9: ; preds = %25, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %7
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %28
13: ; preds = %9
%14 = load i32, i32* %5
%15 = load i8*, i8** %6
%16 = load i32, i32* %8
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = icmp eq i32 %14, %20
br i1 %21, label %22, label %24
22: ; preds = %13
%23 = load i32, i32* %8
store i32 %23, i32* %4
br label %29
24: ; preds = %13
br label %25
25: ; preds = %24
%26 = load i32, i32* %8
%27 = add nsw i32 %26, 1
store i32 %27, i32* %8
br label %9
28: ; preds = %9
store i32 -1, i32* %4
br label %29
29: ; preds = %28, %22
%30 = load i32, i32* %4
ret i32 %30
}

LLVM IR (-O2):
define i32 @offset_of_char(i32 %0, i8* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %18
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %13
%8 = phi i64 [ 0, %5 ], [ %14, %13 ]
%9 = getelementptr inbounds i8, i8* %1, i64 %8
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = icmp eq i32 %11, %0
br i1 %12, label %16, label %13
13: ; preds = %7
%14 = add nuw nsw i64 %8, 1
%15 = icmp eq i64 %14, %6
br i1 %15, label %18, label %7
16: ; preds = %7
%17 = trunc i64 %8 to i32
br label %18
18: ; preds = %13, %16, %3
%19 = phi i32 [ -1, %3 ], [ %17, %16 ], [ -1, %13 ]
ret i32 %19
}
/* Variables and functions */
int ox(int, void *);
int main(int argc, char *argv[]) {
  int r;
  r = ox((argc > 2000), (void *)0);
  return r;
}


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)
cmpl   $0x7d0,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <ox@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
cmp    $0x7d1,%edi
setge  %al
mov    %eax,%edi
xor    %esi,%esi
jmp    1030 <ox@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 2000
%9 = zext i1 %8 to i32
%10 = call i32 @ox(i32 %9, i8* null)
store i32 %10, i32* %6
%11 = load i32, i32* %6
ret i32 %11
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp sgt i32 %0, 2000
%4 = zext i1 %3 to i32
%5 = tail call i32 @ox(i32 %4, i8* null)
ret i32 %5
}
void engine_destroy(void) {}


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

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

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

LLVM IR (-O2):
define void @engine_destroy() {
ret void
}
/* Type definitions */
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
};
struct sockaddr {
  int sa_family;
};

/* Variables and functions */
#define AF_INET 128
int ntohs(int /*<<< orphan*/);
int sock_getport(struct sockaddr *addr) {
  switch (addr->sa_family) {
  case AF_INET:
    return ntohs(((struct sockaddr_in *)addr)->sin_port);
  }
  return -1;
}


x86 assembly (clang, -O0):
<sock_getport>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
sub    $0x80,%eax
jne    1145 <sock_getport+0x35>
jmp    1132 <sock_getport+0x22>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1030 <ntohs@plt>
mov    %eax,-0x4(%rbp)
jmp    114c <sock_getport+0x3c>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sock_getport>:
cmpl   $0x80,(%rdi)
jne    1122 <sock_getport+0x12>
mov    $0x80,%edi
jmp    1030 <ntohs@plt>
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
%struct.sockaddr_in = type { i32 }
define i32 @sock_getport(%struct.sockaddr* %0) {
%2 = alloca i32
%3 = alloca %struct.sockaddr*
store %struct.sockaddr* %0, %struct.sockaddr** %3
%4 = load %struct.sockaddr*, %struct.sockaddr** %3
%5 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %4, i32 0, i32 0
%6 = load i32, i32* %5
switch i32 %6, label %13 [
i32 128, label %7
]
7: ; preds = %1
%8 = load %struct.sockaddr*, %struct.sockaddr** %3
%9 = bitcast %struct.sockaddr* %8 to %struct.sockaddr_in*
%10 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
%11 = load i32, i32* %10
%12 = call i32 @ntohs(i32 %11)
store i32 %12, i32* %2
br label %14
13: ; preds = %1
store i32 -1, i32* %2
br label %14
14: ; preds = %13, %7
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
define i32 @sock_getport(%struct.sockaddr* nocapture %0) {
%2 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 128
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @ntohs(i32 128)
br label %7
7: ; preds = %1, %5
%8 = phi i32 [ %6, %5 ], [ -1, %1 ]
ret i32 %8
}
void rn_init() {}


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

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

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

LLVM IR (-O2):
define void @rn_init() {
ret void
}
I0AR1(r0, r1, x0, x1, p0, p1) double r0, r1;
double *p0, *p1;
{
  if (22 <= (p1[1111111 / 4]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<I0AR1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
mov    %esi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movsd  0x21e888(%rax),%xmm0
movsd  0xed0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1146 <I0AR1+0x46>
movl   $0x1,-0x4(%rbp)
jmp    114d <I0AR1+0x4d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<I0AR1>:
movsd  0x21e888(%rcx),%xmm0
xor    %eax,%eax
ucomisd 0xeee(%rip),%xmm0
setae  %al
ret

LLVM IR (-O0):
define i32 @I0AR1(double %0, double %1, i32 %2, i32 %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
%13 = alloca double*
store double %0, double* %8
store double %1, double* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store double* %4, double** %12
store double* %5, double** %13
%14 = load double*, double** %13
%15 = getelementptr inbounds double, double* %14, i64 277777
%16 = load double, double* %15
%17 = fcmp ole double 2.200000e+01, %16
br i1 %17, label %18, label %19
18: ; preds = %6
store i32 1, i32* %7
br label %20
19: ; preds = %6
store i32 0, i32* %7
br label %20
20: ; preds = %19, %18
%21 = load i32, i32* %7
ret i32 %21
}

LLVM IR (-O2):
define i32 @I0AR1(double %0, double %1, i32 %2, i32 %3, double* nocapture readnone %4, double* nocapture %5) {
%7 = getelementptr inbounds double, double* %5, i64 277777
%8 = load double, double* %7
%9 = fcmp oge double %8, 2.200000e+01
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Variables and functions */
void *cs2qdhcb();
void *cs2qdhcb_(void) { return cs2qdhcb(); }


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

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

LLVM IR (-O0):
define i8* @cs2qdhcb_() {
%1 = call i8* (...) @cs2qdhcb()
ret i8* %1
}

LLVM IR (-O2):
define i8* @cs2qdhcb_() {
%1 = tail call i8* (...) @cs2qdhcb()
ret i8* %1
}
int test_imm_70int64_midword_reg(long long val) {
  return ((val >> 16) & (0x70 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_70int64_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, 112
%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_70int64_midword_reg(i64 %0) {
%2 = and i64 %0, 7340032
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
size_t ft_strlen(char *);
void ft_striter(char *s, void (*f)(char *)) {
  size_t i;
  size_t j;
  i = 0;
  j = ft_strlen(s);
  while (i < j) {
    f(&s[i]);
    i++;
  }
}


x86 assembly (clang, -O0):
<ft_striter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ft_strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1162 <ft_striter+0x52>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdi
add    -0x18(%rbp),%rdi
call   *%rax
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1135 <ft_striter+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_striter>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <ft_strlen@plt>
test   %rax,%rax
je     1140 <ft_striter+0x30>
mov    %rax,%r15
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   *%r14
add    $0x1,%rbx
add    $0xffffffffffffffff,%r15
jne    1130 <ft_striter+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @ft_striter(i8* %0, void (i8*)* %1) {
%3 = alloca i8*
%4 = alloca void (i8*)*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %3
store void (i8*)* %1, void (i8*)** %4
store i64 0, i64* %5
%7 = load i8*, i8** %3
%8 = call i64 @ft_strlen(i8* %7)
store i64 %8, i64* %6
br label %9
9: ; preds = %13, %2
%10 = load i64, i64* %5
%11 = load i64, i64* %6
%12 = icmp ult i64 %10, %11
br i1 %12, label %13, label %20
13: ; preds = %9
%14 = load void (i8*)*, void (i8*)** %4
%15 = load i8*, i8** %3
%16 = load i64, i64* %5
%17 = getelementptr inbounds i8, i8* %15, i64 %16
%18 = load i64, i64* %5
%19 = add i64 %18, 1
store i64 %19, i64* %5
br label %9
20: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @ft_striter(i8* %0, void (i8*)* nocapture %1) {
%3 = tail call i64 @ft_strlen(i8* %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %8, %5 ], [ 0, %2 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %6
tail call void %1(i8* %7)
%8 = add nuw i64 %6, 1
%9 = icmp eq i64 %8, %3
br i1 %9, label %10, label %5
10: ; preds = %5, %2
ret void
}
/* Variables and functions */
scalar_t__ stdlib_base_is_nanf(float const);
float stdlib_base_rampf(const float x) {
  if (stdlib_base_is_nanf(x)) {
    return 0.0f / 0.0f;
  }
  if (x > 0.0f) {
    return x;
  }
  return 0.0f;
}


x86 assembly (clang, -O0):
<stdlib_base_rampf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <stdlib_base_is_nanf@plt>
cmp    $0x0,%rax
je     1143 <stdlib_base_rampf+0x33>
movss  0xec7(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    116b <stdlib_base_rampf+0x5b>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1163 <stdlib_base_rampf+0x53>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    116b <stdlib_base_rampf+0x5b>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdlib_base_rampf>:
push   %rax
movss  %xmm0,0x4(%rsp)
call   1030 <stdlib_base_is_nanf@plt>
test   %rax,%rax
je     112b <stdlib_base_rampf+0x1b>
movss  0xed7(%rip),%xmm0
pop    %rax
ret
xorps  %xmm0,%xmm0
movss  0x4(%rsp),%xmm1
maxss  %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @stdlib_base_rampf(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = call i64 @stdlib_base_is_nanf(float %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store float 0x7FF8000000000000, float* %2
br label %14
8: ; preds = %1
%9 = load float, float* %3
%10 = fcmp ogt float %9, 0.000000e+00
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = load float, float* %3
store float %12, float* %2
br label %14
13: ; preds = %8
store float 0.000000e+00, float* %2
br label %14
14: ; preds = %13, %11, %7
%15 = load float, float* %2
ret float %15
}

LLVM IR (-O2):
define float @stdlib_base_rampf(float %0) {
%2 = tail call i64 @stdlib_base_is_nanf(float %0)
%3 = icmp eq i64 %2, 0
%4 = fcmp ogt float %0, 0.000000e+00
%5 = select i1 %4, float %0, float 0.000000e+00
%6 = select i1 %3, float %5, float 0x7FF8000000000000
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int A, B;
  scanf("%d %d", &A, &B);
  printf("PROD = %d\n", A * B);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%esi
imul   0x4(%rsp),%esi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [11 x i8] c"PROD = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = mul nsw i32 %5, %6
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [11 x i8] c"PROD = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = mul nsw i32 %7, %6
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float centigrade;
  scanf("%f", &centigrade);
  printf("Fahrenheit: %f\n", centigrade * 1.8000 + 32);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb7(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeb3(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xebc(%rip),%xmm0
addsd  0xebc(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [16 x i8] c"Fahrenheit: %f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%3 = load float, float* %1
%4 = fpext float %3 to double
%5 = call double @llvm.fmuladd.f64(double %4, double 1.800000e+00, double 3.200000e+01)
%6 = fptrunc double %5 to float
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), float %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [16 x i8] c"Fahrenheit: %f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%4 = load float, float* %1
%5 = fpext float %4 to double
%6 = call double @llvm.fmuladd.f64(double %5, double 1.800000e+00, double 3.200000e+01)
%7 = fptrunc double %6 to float
%8 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), float %7)
ret i32 0
}
int test_fun(int x, int y, int z) {
  int c = 0;
  while (x < y) {
    if (x < z) {
      x = x + 1;
    } else {
      z = z + 1;
    }
    c = c + 1;
  }
  return c;
}


x86 assembly (clang, -O0):
<test_fun>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1151 <test_fun+0x51>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113a <test_fun+0x3a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1143 <test_fun+0x43>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1114 <test_fun+0x14>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_fun>:
xor    %eax,%eax
cmp    %esi,%edi
jge    112a <test_fun+0x2a>
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
xor    %r8d,%r8d
xor    %ecx,%ecx
cmp    %edx,%edi
setge  %r8b
setl   %cl
add    %ecx,%edi
add    %r8d,%edx
add    $0x1,%eax
cmp    %esi,%edi
jl     1110 <test_fun+0x10>
ret

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

LLVM IR (-O2):
define i32 @test_fun(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
br i1 %4, label %5, label %17
5: ; preds = %3, %5
%6 = phi i32 [ %15, %5 ], [ 0, %3 ]
%7 = phi i32 [ %14, %5 ], [ %2, %3 ]
%8 = phi i32 [ %11, %5 ], [ %0, %3 ]
%9 = icmp slt i32 %8, %7
%10 = zext i1 %9 to i32
%11 = add nsw i32 %8, %10
%12 = xor i1 %9, true
%13 = zext i1 %12 to i32
%14 = add nsw i32 %7, %13
%15 = add nuw nsw i32 %6, 1
%16 = icmp slt i32 %11, %1
br i1 %16, label %5, label %17
17: ; preds = %5, %3
%18 = phi i32 [ 0, %3 ], [ %15, %5 ]
ret i32 %18
}
/* Type definitions */
struct aFILE {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _get_actual_fp(struct aFILE *);
char *fgets(char *, int, int /*<<< orphan*/);
char *my_fgets(char *s, int n, struct aFILE *fp) {
  return fgets(s, n, _get_actual_fp(fp));
}


x86 assembly (clang, -O0):
<my_fgets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <_get_actual_fp@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
call   1040 <fgets@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_fgets>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %rdx,%rdi
call   1030 <_get_actual_fp@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fgets@plt>

LLVM IR (-O0):
%struct.aFILE = type { i32 }
define i8* @my_fgets(i8* %0, i32 %1, %struct.aFILE* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca %struct.aFILE*
store i8* %0, i8** %4
store i32 %1, i32* %5
store %struct.aFILE* %2, %struct.aFILE** %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load %struct.aFILE*, %struct.aFILE** %6
%10 = call i32 @_get_actual_fp(%struct.aFILE* %9)
%11 = call i8* @fgets(i8* %7, i32 %8, i32 %10)
ret i8* %11
}

LLVM IR (-O2):
%struct.aFILE = type { i32 }
define i8* @my_fgets(i8* %0, i32 %1, %struct.aFILE* %2) {
%4 = tail call i32 @_get_actual_fp(%struct.aFILE* %2)
%5 = tail call i8* @fgets(i8* %0, i32 %1, i32 %4)
ret i8* %5
}