xunge/DecIR huggingface dataset:
int win32_is_dir_sep(int c) { return c == '/' || c == '\\'; }


x86 assembly (clang, -O0):
<win32_is_dir_sep>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x2f,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1120 <win32_is_dir_sep+0x20>
cmpl   $0x5c,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<win32_is_dir_sep>:
cmp    $0x2f,%edi
sete   %al
cmp    $0x5c,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @win32_is_dir_sep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 47
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 92
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ true, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @win32_is_dir_sep(i32 %0) {
%2 = icmp eq i32 %0, 47
%3 = icmp eq i32 %0, 92
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ uDelay(unsigned int const);
void mDelay(const unsigned int msec) { uDelay(msec * 1000); }


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

x86 assembly (clang, -O2):
<mDelay>:
imul   $0x3e8,%edi,%edi
jmp    1030 <uDelay@plt>

LLVM IR (-O0):
define void @mDelay(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul i32 %3, 1000
%5 = call i32 @uDelay(i32 %4)
ret void
}

LLVM IR (-O2):
define void @mDelay(i32 %0) {
%2 = mul i32 %0, 1000
%3 = tail call i32 @uDelay(i32 %2)
ret void
}
void unipiRelay(int relay, int value) {}


x86 assembly (clang, -O0):
<unipiRelay>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @unipiRelay(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @unipiRelay(i32 %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ PRIO_PROCESS;
int /*<<< orphan*/ decode_error(char *, int /*<<< orphan*/, int);
int setpriority(int /*<<< orphan*/, int /*<<< orphan*/, int);
int set_niceness(pid_t pid, int nice) {
  int ret;
  if ((ret = setpriority(PRIO_PROCESS, pid, nice))) {
    decode_error("could not set PID %d to nice %d", pid, nice);
    return (ret);
  }
  return (0);
}


x86 assembly (clang, -O0):
<set_niceness>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <setpriority@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     116b <set_niceness+0x4b>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea5(%rip),%rdi
call   1040 <decode_error@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1172 <set_niceness+0x52>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_niceness>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <setpriority@plt>
mov    %eax,%ebx
test   %eax,%eax
je     1153 <set_niceness+0x33>
lea    0xeb7(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <decode_error@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@PRIO_PROCESS = global i32 0
@.str = [32 x i8] c"could not set PID %d to nice %d\00"
define i32 @set_niceness(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* @PRIO_PROCESS
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = call i32 @setpriority(i32 %7, i32 %8, i32 %9)
store i32 %10, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = call i32 @decode_error(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14)
%16 = load i32, i32* %6
store i32 %16, i32* %3
br label %18
17: ; preds = %2
store i32 0, i32* %3
br label %18
18: ; preds = %17, %12
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@PRIO_PROCESS = global i32 0
@.str = [32 x i8] c"could not set PID %d to nice %d\00"
define i32 @set_niceness(i32 %0, i32 %1) {
%3 = load i32, i32* @PRIO_PROCESS
%4 = tail call i32 @setpriority(i32 %3, i32 %0, i32 %1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @decode_error(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
br label %8
8: ; preds = %2, %6
ret i32 %4
}
/* Variables and functions */
size_t calculate_index(size_t bucket_count, int hash) {
  return ((size_t)hash) & (bucket_count - 1);
}


x86 assembly (clang, -O0):
<calculate_index>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movslq -0xc(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    $0x1,%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_index>:
movslq %esi,%rcx
lea    -0x1(%rdi),%rax
and    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @calculate_index(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = sext i32 %5 to i64
%7 = load i64, i64* %3
%8 = sub i64 %7, 1
%9 = and i64 %6, %8
ret i64 %9
}

LLVM IR (-O2):
define i64 @calculate_index(i64 %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = add i64 %0, -1
%5 = and i64 %4, %3
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ fseek(int /*<<< orphan*/, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
void purgeBuffer(void) { fseek(stdin, 0, SEEK_END); }


x86 assembly (clang, -O0):
<purgeBuffer>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
mov    0x2ec4(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <fseek@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<purgeBuffer>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
mov    0x2ec8(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
jmp    1030 <fseek@plt>

LLVM IR (-O0):
@stdin = global i32 0
@SEEK_END = global i32 0
define void @purgeBuffer() {
%1 = load i32, i32* @stdin
%2 = load i32, i32* @SEEK_END
%3 = call i32 @fseek(i32 %1, i32 0, i32 %2)
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@SEEK_END = global i32 0
define void @purgeBuffer() {
%1 = load i32, i32* @stdin
%2 = load i32, i32* @SEEK_END
%3 = tail call i32 @fseek(i32 %1, i32 0, i32 %2)
ret void
}
int parseCharToNumber(char letter) {
  if (((int)letter <= (int)'9') && ((int)letter >= (int)'0')) {
    return (int)letter - (int)'0';
  } else
    return -1;
}


x86 assembly (clang, -O0):
<parseCharToNumber>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1133 <parseCharToNumber+0x33>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1133 <parseCharToNumber+0x33>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    113a <parseCharToNumber+0x3a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseCharToNumber>:
lea    -0x30(%rdi),%eax
lea    -0x30(%rdi),%ecx
cmp    $0xa,%al
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @parseCharToNumber(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sle i32 %5, 57
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sge i32 %9, 48
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 48
store i32 %14, i32* %2
br label %16
15: ; preds = %7, %1
store i32 -1, i32* %2
br label %16
16: ; preds = %15, %11
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @parseCharToNumber(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = sext i8 %0 to i32
%5 = add nsw i32 %4, -48
%6 = select i1 %3, i32 %5, i32 -1
ret i32 %6
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int solcon_retrieve_next_quaddobl_initialize(void) {
  int a, *b, fail;
  double *c;
  a = 0;
  fail = _ada_use_c2phc(278, &a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<solcon_retrieve_next_quaddobl_initialize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x116,%edi
lea    -0x4(%rbp),%rsi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solcon_retrieve_next_quaddobl_initialize>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x116,%edi
call   1030 <_ada_use_c2phc@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @solcon_retrieve_next_quaddobl_initialize() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @_ada_use_c2phc(i32 278, i32* %1, i32* undef, double* undef)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ doStuff_variadic(int *, int);
void f_variadic_inp_inv(void) {
  int t = 5;
  int v = 3;
  int *tp = &t;
  doStuff_variadic(tp, v);
}


x86 assembly (clang, -O0):
<f_variadic_inp_inv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x5,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <doStuff_variadic@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_variadic_inp_inv>:
push   %rax
movl   $0x5,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x3,%esi
call   1030 <doStuff_variadic@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @f_variadic_inp_inv() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 5, i32* %1
store i32 3, i32* %2
store i32* %1, i32** %3
%4 = load i32*, i32** %3
%5 = load i32, i32* %2
%6 = call i32 @doStuff_variadic(i32* %4, i32 %5)
ret void
}

LLVM IR (-O2):
define void @f_variadic_inp_inv() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 5, i32* %1
%3 = call i32 @doStuff_variadic(i32* %1, i32 3)
ret void
}
int test_imm_BAint64_midword_mem(long long *val) {
  return ((*val >> 16) & (0xBA << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_BAint64_midword_mem>:
testb  $0xba,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_BAint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 16
%6 = and i64 %5, 186
%7 = icmp ne i64 %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_BAint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 12189696
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t addrToInstr(uint32_t addr) { return (addr >> 3); }


x86 assembly (clang, -O0):
<addrToInstr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x3,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<addrToInstr>:
mov    %edi,%eax
sar    $0x3,%eax
ret

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

LLVM IR (-O2):
define i32 @addrToInstr(i32 %0) {
%2 = ashr i32 %0, 3
ret i32 %2
}
/* Variables and functions */
int f2(int, int);
int h2(void) { return f2(1, 2); }


x86 assembly (clang, -O0):
<h2>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <f2@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @h2() {
%1 = call i32 @f2(i32 1, i32 2)
ret i32 %1
}

LLVM IR (-O2):
define i32 @h2() {
%1 = tail call i32 @f2(i32 1, i32 2)
ret i32 %1
}
int test_imm_9Fint16_reg(short val) {
  return ((val) & (0x9F << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_9Fint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0x9f,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_9Fint16_reg>:
test   $0x9f,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_9Fint16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, 159
%6 = icmp ne i32 %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_9Fint16_reg(i16 signext %0) {
%2 = and i16 %0, 159
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() { printf("als-mics not supported on this system!\n"); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"als-mics not supported on this system!\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [39 x i8] c"als-mics not supported on this system!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned long);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *x_malloc(size_t size) {
  void *p;
  p = malloc(size);
  if (p == NULL) {
    fprintf(stderr, "failed to malloc %lu bytes", (unsigned long)size);
    exit(100);
  }
  return p;
}


x86 assembly (clang, -O0):
<x_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1177 <x_malloc+0x47>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe98(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x64,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x_malloc>:
push   %rbx
mov    %rdi,%rbx
call   1040 <malloc@plt>
test   %rax,%rax
je     1140 <x_malloc+0x10>
pop    %rbx
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    $0x64,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"failed to malloc %lu bytes\00"
define i8* @x_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i64, i64* %2
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 %10)
%12 = call i32 @exit(i32 100)
unreachable
13: ; preds = %1
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"failed to malloc %lu bytes\00"
define noalias i8* @x_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 %0)
%7 = tail call i32 @exit(i32 100)
unreachable
8: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ log_warn(char *);
void cwai(void) { log_warn("mc6809nc: CWAI - not supported yet!"); }


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

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

LLVM IR (-O0):
@.str = [36 x i8] c"mc6809nc: CWAI - not supported yet!\00"
define void @cwai() {
%1 = call i32 @log_warn(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"mc6809nc: CWAI - not supported yet!\00"
define void @cwai() {
%1 = tail call i32 @log_warn(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
ret void
}
void menu_add(const char *name, struct menu_entry *new_entry, int count) {}


x86 assembly (clang, -O0):
<menu_add>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.menu_entry = type opaque
define void @menu_add(i8* %0, %struct.menu_entry* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca %struct.menu_entry*
%6 = alloca i32
store i8* %0, i8** %4
store %struct.menu_entry* %1, %struct.menu_entry** %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
%struct.menu_entry = type opaque
define void @menu_add(i8* nocapture %0, %struct.menu_entry* nocapture %1, i32 %2) {
ret void
}
/* Type definitions */
typedef scalar_t__ wchar_t;

/* Variables and functions */
char ft_utf8chrsize(wchar_t c) {
  if ((unsigned int)c < 0xFF)
    return (1);
  else if ((unsigned int)c < 0xFFFF)
    return (2);
  else if ((unsigned int)c < 0xFFFFFF)
    return (3);
  else if ((unsigned int)c < 0xFFFFFFFF)
    return (4);
  else
    return (-1);
}


x86 assembly (clang, -O0):
<ft_utf8chrsize>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    $0xff,%eax
jae    1120 <ft_utf8chrsize+0x20>
movb   $0x1,-0x1(%rbp)
jmp    116a <ft_utf8chrsize+0x6a>
mov    -0x10(%rbp),%rax
cmp    $0xffff,%eax
jae    1138 <ft_utf8chrsize+0x38>
movb   $0x2,-0x1(%rbp)
jmp    116a <ft_utf8chrsize+0x6a>
mov    -0x10(%rbp),%rax
cmp    $0xffffff,%eax
jae    1150 <ft_utf8chrsize+0x50>
movb   $0x3,-0x1(%rbp)
jmp    116a <ft_utf8chrsize+0x6a>
mov    -0x10(%rbp),%rax
cmp    $0xffffffff,%eax
jae    1166 <ft_utf8chrsize+0x66>
movb   $0x4,-0x1(%rbp)
jmp    116a <ft_utf8chrsize+0x6a>
movb   $0xff,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_utf8chrsize>:
mov    $0x1,%al
cmp    $0xff,%edi
jb     112e <ft_utf8chrsize+0x2e>
mov    $0x2,%al
cmp    $0xffff,%edi
jb     112e <ft_utf8chrsize+0x2e>
mov    $0x3,%al
cmp    $0xffffff,%edi
jb     112e <ft_utf8chrsize+0x2e>
cmp    $0xffffffff,%edi
mov    $0xff,%ecx
mov    $0x4,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define signext i8 @ft_utf8chrsize(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = icmp ult i32 %2, 255
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = icmp ult i32 %2, 65535
br i1 %5, label %11, label %6
6: ; preds = %4
%7 = icmp ult i32 %2, 16777215
br i1 %7, label %11, label %8
8: ; preds = %6
%9 = icmp eq i32 %2, -1
%10 = select i1 %9, i8 -1, i8 4
br label %11
11: ; preds = %8, %6, %4, %1
%12 = phi i8 [ 1, %1 ], [ 2, %4 ], [ 3, %6 ], [ %10, %8 ]
ret i8 %12
}
/* Variables and functions */
size_t add(size_t a, size_t b) { return a + b; }


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

x86 assembly (clang, -O2):
<add>:
lea    (%rdi,%rsi,1),%rax
ret

LLVM IR (-O0):
define i64 @add(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = add i64 %5, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @add(i64 %0, i64 %1) {
%3 = add i64 %1, %0
ret i64 %3
}
/* Variables and functions */
char *manipulateName(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char last_name[100];
  printf("Enter your last name: ");
  scanf("%s", last_name);
  printf("\n\nYour updated name %s\n\n", manipulateName(last_name));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xebf(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x70(%rbp),%rdi
call   1050 <manipulateName@plt>
mov    %rax,%rsi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1050 <manipulateName@plt>
lea    0xeb6(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter your last name: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [25 x i8] c"\0A\0AYour updated name %s\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = call i8* @manipulateName(i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Enter your last name: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [25 x i8] c"\0A\0AYour updated name %s\0A\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i8* @manipulateName(i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ funcion1(int, int, int);
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Inicio\n");
  funcion1(3, 3, 3);
  printf("Fin\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x3,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1040 <funcion1@plt>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x3,%edi
mov    $0x3,%esi
mov    $0x3,%edx
call   1040 <funcion1@plt>
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Inicio\0A\00"
@.str.1 = [5 x i8] c"Fin\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @funcion1(i32 3, i32 3, i32 3)
%3 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [7 x i8] c"Inicio\00"
@str.2 = [4 x i8] c"Fin\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @funcion1(i32 3, i32 3, i32 3)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ mergeIntMax(int *, int, int, int);
void mergeSort(int *a, int p, int r) {
  int q;
  if (p < r) {
    mergeSort(a, p, q);
    mergeSort(a, q + 1, r);
    mergeIntMax(a, p, q, r);
  }
}


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

x86 assembly (clang, -O2):
<mergeSort>:
cmp    %edx,%esi
jge    114e <mergeSort+0x2e>
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
call   1030 <mergeSort@plt>
mov    %r14,%rdi
mov    %ebx,%edx
call   1030 <mergeSort@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <mergeIntMax@plt>
ret

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

LLVM IR (-O2):
define void @mergeSort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %6, label %5
5: ; preds = %3, %6
ret void
6: ; preds = %3
tail call void @mergeSort(i32* %0, i32 %1, i32 undef)
tail call void @mergeSort(i32* %0, i32 undef, i32 %2)
%7 = tail call i32 @mergeIntMax(i32* %0, i32 %1, i32 undef, i32 %2)
br label %5
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ errn_exit(int, char *);
int pthread_mutex_unlock(int /*<<< orphan*/ *);
void _unlock(pthread_mutex_t *l) {
  int n = pthread_mutex_unlock(l);
  if (n)
    errn_exit(n, "_unlock");
}


x86 assembly (clang, -O0):
<_unlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <pthread_mutex_unlock@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1151 <_unlock+0x31>
mov    -0xc(%rbp),%edi
lea    0xeb4(%rip),%rsi
call   1030 <errn_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_unlock>:
push   %rax
call   1040 <pthread_mutex_unlock@plt>
test   %eax,%eax
je     1139 <_unlock+0x19>
lea    0xecf(%rip),%rsi
mov    %eax,%edi
pop    %rax
jmp    1030 <errn_exit@plt>
pop    %rax
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"_unlock\00"
define void @_unlock(i32* %0) {
%2 = tail call i32 @pthread_mutex_unlock(i32* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @errn_exit(i32 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret void
}
void Counter_1_SaveConfig(void) {}


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

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

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

LLVM IR (-O2):
define void @Counter_1_SaveConfig() {
ret void
}
/* Variables and functions */
int read_port(unsigned short);
int is_serial_ready_to_write(unsigned short com) {
  return read_port((com + 5)) & 0x20;
}


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

x86 assembly (clang, -O2):
<is_serial_ready_to_write>:
push   %rax
add    $0x5,%edi
movzwl %di,%edi
call   1030 <read_port@plt>
and    $0x20,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @is_serial_ready_to_write(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = add nsw i32 %4, 5
%6 = trunc i32 %5 to i16
%7 = call i32 @read_port(i16 zeroext %6)
%8 = and i32 %7, 32
ret i32 %8
}

LLVM IR (-O2):
define i32 @is_serial_ready_to_write(i16 zeroext %0) {
%2 = add i16 %0, 5
%3 = tail call i32 @read_port(i16 zeroext %2)
%4 = and i32 %3, 32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ op_write1(int);
void op_enc_inc_b(void) { op_write1(0x04); }


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

x86 assembly (clang, -O2):
<op_enc_inc_b>:
mov    $0x4,%edi
jmp    1030 <op_write1@plt>

LLVM IR (-O0):
define void @op_enc_inc_b() {
%1 = call i32 @op_write1(i32 4)
ret void
}

LLVM IR (-O2):
define void @op_enc_inc_b() {
%1 = tail call i32 @op_write1(i32 4)
ret void
}
/* Variables and functions */
float M_PI;
int cos(float);
float cosine_interp(float p1, float p2, float amount) {
  float mu2 = (1 - cos(amount * M_PI)) / 2;
  return (p2 * (1 - mu2) + p1 * mu2);
}


x86 assembly (clang, -O0):
<cosine_interp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
mov    0x2eb5(%rip),%rax
mulss  (%rax),%xmm0
call   1030 <cos@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xe9d(%rip),%xmm2
subss  -0x10(%rbp),%xmm2
movss  -0x4(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cosine_interp>:
push   %rax
movss  %xmm1,0x4(%rsp)
movss  %xmm0,(%rsp)
mov    0x2ec5(%rip),%rax
mulss  (%rax),%xmm2
movaps %xmm2,%xmm0
call   1030 <cos@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
movss  0xeb2(%rip),%xmm0
subss  %xmm1,%xmm0
movss  (%rsp),%xmm2
mulss  %xmm1,%xmm2
mulss  0x4(%rsp),%xmm0
addss  %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@M_PI = global float 0.000000e+00
define float @cosine_interp(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%8 = load float, float* %6
%9 = load float, float* @M_PI
%10 = fmul float %8, %9
%11 = call i32 @cos(float %10)
%12 = sub nsw i32 1, %11
%13 = sdiv i32 %12, 2
%14 = sitofp i32 %13 to float
store float %14, float* %7
%15 = load float, float* %5
%16 = load float, float* %7
%17 = fsub float 1.000000e+00, %16
%18 = load float, float* %4
%19 = load float, float* %7
%20 = fmul float %18, %19
%21 = call float @llvm.fmuladd.f32(float %15, float %17, float %20)
ret float %21
}

LLVM IR (-O2):
@M_PI = global float 0.000000e+00
define float @cosine_interp(float %0, float %1, float %2) {
%4 = load float, float* @M_PI
%5 = fmul float %4, %2
%6 = tail call i32 @cos(float %5)
%7 = sub nsw i32 1, %6
%8 = sdiv i32 %7, 2
%9 = sitofp i32 %8 to float
%10 = fsub float 1.000000e+00, %9
%11 = fmul float %9, %0
%12 = tail call float @llvm.fmuladd.f32(float %1, float %10, float %11)
ret float %12
}
void gdk_x11_get_xatom_name_for_display() {}


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

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

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

LLVM IR (-O2):
define void @gdk_x11_get_xatom_name_for_display() {
ret void
}
int base64_encsize(int size) { return 4 * ((size + 2) / 3); }


x86 assembly (clang, -O0):
<base64_encsize>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
shl    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<base64_encsize>:
add    $0x2,%edi
movslq %edi,%rax
imul   $0x55555556,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
shl    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @base64_encsize(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 2
%5 = sdiv i32 %4, 3
%6 = mul nsw i32 4, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @base64_encsize(i32 %0) {
%2 = add nsw i32 %0, 2
%3 = sdiv i32 %2, 3
%4 = shl nsw i32 %3, 2
ret i32 %4
}
int *carly(int x) {}


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

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

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

LLVM IR (-O2):
define noalias i32* @carly(i32 %0) {
ret i32* undef
}
void unmarkBlock(int *p) { *(p - 1) = (*(p - 1) & ~0x2); }


x86 assembly (clang, -O0):
<unmarkBlock>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x4(%rax),%ecx
and    $0xfffffffd,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,-0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<unmarkBlock>:
andb   $0xfd,-0x4(%rdi)
ret

LLVM IR (-O0):
define void @unmarkBlock(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 -1
%5 = load i32, i32* %4
%6 = and i32 %5, -3
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 -1
store i32 %6, i32* %8
ret void
}

LLVM IR (-O2):
define void @unmarkBlock(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 -1
%3 = load i32, i32* %2
%4 = and i32 %3, -3
store i32 %4, i32* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void copyright_netcdf() {
  fprintf(stderr,
          "The diskio library uses the netcdf-version 3.4 library, "
          "which is provided\n\"as is\" under the terms of distribution "
          "and usage by UCAR/Unidata.\nPlease see "
          "src/diskio/interface/netcdf/netcdf-3.4/copyright.html\n"
          "for the full notice.\n\n");
}


x86 assembly (clang, -O0):
<copyright_netcdf>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<copyright_netcdf>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [229 x i8] c"The diskio library uses the netcdf-version 3.4 library, which is provided\0A\22as is\22 under the terms of distribution and usage by UCAR/Unidata.\0APlease see src/diskio/interface/netcdf/netcdf-3.4/copyright.html\0Afor the full notice.\0A\0A\00"
define void @copyright_netcdf() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([229 x i8], [229 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [229 x i8] c"The diskio library uses the netcdf-version 3.4 library, which is provided\0A\22as is\22 under the terms of distribution and usage by UCAR/Unidata.\0APlease see src/diskio/interface/netcdf/netcdf-3.4/copyright.html\0Afor the full notice.\0A\0A\00"
define void @copyright_netcdf() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([229 x i8], [229 x i8]* @.str, i64 0, i64 0))
ret void
}
int test_imm_45uint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0x45 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_45uint64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x20,%rdx
and    $0x45,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_45uint64_highword_mem>:
testb  $0x45,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_45uint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 32
%6 = and i64 %5, 69
%7 = icmp ne i64 %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_45uint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 296352743424
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
unsigned char *cbor_write_nint(unsigned char *, unsigned int, unsigned int);
unsigned char *cbor_write_pint(unsigned char *, unsigned int, unsigned int);
unsigned char *cbor_write_int(unsigned char *data, unsigned int size,
                              int value) {
  if (value < 0) {
    return cbor_write_nint(data, size, (unsigned int)(-value));
  } else {
    return cbor_write_pint(data, size, (unsigned int)(value));
  }
}


x86 assembly (clang, -O0):
<cbor_write_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1156 <cbor_write_int+0x36>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
xor    %edx,%edx
sub    -0x18(%rbp),%edx
call   1030 <cbor_write_nint@plt>
mov    %rax,-0x8(%rbp)
jmp    1169 <cbor_write_int+0x49>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <cbor_write_pint@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbor_write_int>:
test   %edx,%edx
js     1129 <cbor_write_int+0x9>
jmp    1040 <cbor_write_pint@plt>
neg    %edx
jmp    1030 <cbor_write_nint@plt>

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

LLVM IR (-O2):
define i8* @cbor_write_int(i8* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %2, 0
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = sub nsw i32 0, %2
%7 = tail call i8* @cbor_write_nint(i8* %0, i32 %1, i32 %6)
br label %10
8: ; preds = %3
%9 = tail call i8* @cbor_write_pint(i8* %0, i32 %1, i32 %2)
br label %10
10: ; preds = %8, %5
%11 = phi i8* [ %7, %5 ], [ %9, %8 ]
ret i8* %11
}
/* Variables and functions */
int BIT(int);
int wpa_key_mgmt_sha256(int akm) { return akm == BIT(8) || akm == BIT(7); }


x86 assembly (clang, -O0):
<wpa_key_mgmt_sha256>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x8,%edi
call   1030 <BIT@plt>
mov    -0xc(%rbp),%ecx
mov    %eax,%edx
mov    $0x1,%al
cmp    %edx,%ecx
mov    %al,-0x5(%rbp)
je     115a <wpa_key_mgmt_sha256+0x4a>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x7,%edi
call   1030 <BIT@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wpa_key_mgmt_sha256>:
push   %rbx
mov    %edi,%ebx
mov    $0x8,%edi
call   1030 <BIT@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ebx,%ecx
je     113b <wpa_key_mgmt_sha256+0x2b>
mov    $0x7,%edi
call   1030 <BIT@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ebx,%ecx
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @wpa_key_mgmt_sha256(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @BIT(i32 8)
%5 = icmp eq i32 %3, %4
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @BIT(i32 7)
%9 = icmp eq i32 %7, %8
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @wpa_key_mgmt_sha256(i32 %0) {
%2 = tail call i32 @BIT(i32 8)
%3 = icmp eq i32 %2, %0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @BIT(i32 7)
%6 = icmp eq i32 %5, %0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
int iSub(int a, int b) { return a - b; }


x86 assembly (clang, -O0):
<iSub>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iSub>:
mov    %edi,%eax
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @iSub(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 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @iSub(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
ret i32 %3
}
/* Variables and functions */
unsigned int unpack_int(char **);
float unpack_float(char **cur) {
  union {
    unsigned int n;
    float f;
  } u;
  u.n = unpack_int(cur);
  return u.f;
}


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

x86 assembly (clang, -O2):
<unpack_float>:
push   %rax
call   1030 <unpack_int@plt>
movd   %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
%union.anon = type { i32 }
define float @unpack_float(i8** %0) {
%2 = alloca i8**
%3 = alloca %union.anon
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = call i32 @unpack_int(i8** %4)
%6 = bitcast %union.anon* %3 to i32*
store i32 %5, i32* %6
%7 = bitcast %union.anon* %3 to float*
%8 = load float, float* %7
ret float %8
}

LLVM IR (-O2):
define float @unpack_float(i8** %0) {
%2 = tail call i32 @unpack_int(i8** %0)
%3 = bitcast i32 %2 to float
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int number;
  scanf("%d", &number);
  int i = number;
  do {
    printf("%d ", i);
    i--;
  } while (i > 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
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     1145 <main+0x25>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ebx
lea    0xec3(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    -0x1(%rbx),%eax
cmp    $0x1,%ebx
mov    %eax,%ebx
jg     1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \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 ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
store i32 %5, i32* %3
br label %6
6: ; preds = %11, %0
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %3
%10 = add nsw i32 %9, -1
store i32 %10, i32* %3
br label %11
11: ; preds = %6
%12 = load i32, i32* %3
%13 = icmp sgt i32 %12, 0
br i1 %13, label %6, label %14
14: ; preds = %11
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \00"
define i32 @main() {
%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
br label %5
5: ; preds = %5, %0
%6 = phi i32 [ %4, %0 ], [ %8, %5 ]
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = add nsw i32 %6, -1
%9 = icmp sgt i32 %6, 1
br i1 %9, label %5, label %10
10: ; preds = %5
ret i32 0
}
/* Type definitions */
struct dm_pool {
  int dummy;
};

/* Variables and functions */
char *__strdup(char const *);
char *dm_pool_strdup(struct dm_pool *p, char const *str) {
  char *tmp;
  {
    { tmp = __strdup(str); }
    return (tmp);
  }
}


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

x86 assembly (clang, -O2):
<dm_pool_strdup>:
mov    %rsi,%rdi
jmp    1030 <__strdup@plt>

LLVM IR (-O0):
%struct.dm_pool = type { i32 }
define i8* @dm_pool_strdup(%struct.dm_pool* %0, i8* %1) {
%3 = alloca %struct.dm_pool*
%4 = alloca i8*
%5 = alloca i8*
store %struct.dm_pool* %0, %struct.dm_pool** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i8* @__strdup(i8* %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
ret i8* %8
}

LLVM IR (-O2):
%struct.dm_pool = type { i32 }
define noalias i8* @dm_pool_strdup(%struct.dm_pool* nocapture readnone %0, i8* nocapture %1) {
%3 = tail call i8* @__strdup(i8* %1)
ret i8* %3
}