xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int c;

/* Variables and functions */
scalar_t__ islower(int);
int toupper(int c) { return islower(c) ? (c) - 'a' + 'A' : c; }


x86 assembly (clang, -O0):
<toupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     113e <toupper+0x2e>
mov    -0x4(%rbp),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <toupper+0x34>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toupper>:
push   %rbx
mov    %edi,%ebx
call   1030 <islower@plt>
lea    -0x20(%rbx),%ecx
test   %rax,%rax
cmove  %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @toupper(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @islower(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %2
%8 = sub nsw i32 %7, 97
%9 = add nsw i32 %8, 65
br label %12
10: ; preds = %1
%11 = load i32, i32* %2
br label %12
12: ; preds = %10, %6
%13 = phi i32 [ %9, %6 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @toupper(i32 %0) {
%2 = tail call i64 @islower(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = add nsw i32 %0, -32
%5 = select i1 %3, i32 %0, i32 %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ int8_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ ReadUint8Le(void const *, int /*<<< orphan*/ *);
int32_t ReadInt8Le(const void *in, int8_t *value) {
  return ReadUint8Le(in, (uint8_t *)value);
}


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

x86 assembly (clang, -O2):
<ReadInt8Le>:
jmp    1030 <ReadUint8Le@plt>

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

LLVM IR (-O2):
define i32 @ReadInt8Le(i8* %0, i32* %1) {
%3 = tail call i32 @ReadUint8Le(i8* %0, i32* %1)
ret i32 %3
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  unsigned long parent;
};
struct TYPE_4__ {
  TYPE_1__ xconfigurerequest;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xconfigurerequest_parent(void *_p, unsigned long _v) {
  ((XEvent *)_p)->xconfigurerequest.parent = (unsigned long)_v;
}


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

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

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64 }
define void @set_XEvent_xconfigurerequest_parent(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i64 %5, i64* %9
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xconfigurerequest_parent(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
/* Type definitions */
typedef char *uint32_t;

/* Variables and functions */
uint32_t ckAsmGetCr0(void) {
  uint32_t ret;
  __asm__ __volatile__("mov %%cr0, %0" : "=r"(ret));
  return ret;
}


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

x86 assembly (clang, -O2):
<ckAsmGetCr0>:
mov    %cr0,%rax
ret

LLVM IR (-O0):
define i8* @ckAsmGetCr0() {
%1 = alloca i8*
%2 = call i8* asm sideeffect "mov %cr0, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
store i8* %2, i8** %1
%3 = load i8*, i8** %1
ret i8* %3
}

LLVM IR (-O2):
define i8* @ckAsmGetCr0() {
%1 = tail call i8* asm sideeffect "mov %cr0, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
void *Prompt(char *question, char *result) {
  printf("%s\n", question);
  fgets(result, 100, stdin);
}


x86 assembly (clang, -O0):
<Prompt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    0x2e9d(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1040 <fgets@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Prompt>:
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eae(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x64,%esi
pop    %rbx
jmp    1040 <fgets@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@stdin = global i32 0
define i8* @Prompt(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %5
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %8, i32 100, i32 %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@stdin = global i32 0
define noalias i8* @Prompt(i8* %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stdin
%5 = tail call i32 @fgets(i8* %1, i32 100, i32 %4)
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("\033[31musage:\033[0m\n");
  printf(
      "\033[31margv[1]: filename :: the file which need to be read.\033[0m\n");
  printf("\033[31margv[2]: offset   :: the number of bytes off "
         "file'head.\033[0m\n");
  printf("\033[31margv[3]: number   :: the number of bytes that wanted to be "
         "read.\033[0m\n\n");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1e(%rip),%rdi
call   1030 <puts@plt>
lea    0xf53(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"\1B[31musage:\1B[0m\0A\00"
@.str.1 = [63 x i8] c"\1B[31margv[1]: filename :: the file which need to be read.\1B[0m\0A\00"
@.str.2 = [66 x i8] c"\1B[31margv[2]: offset :: the number of bytes off file'head.\1B[0m\0A\00"
@.str.3 = [76 x i8] c"\1B[31margv[3]: number :: the number of bytes that wanted to be read.\1B[0m\0A\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [16 x i8] c"\1B[31musage:\1B[0m\00"
@str.4 = [62 x i8] c"\1B[31margv[1]: filename :: the file which need to be read.\1B[0m\00"
@str.5 = [65 x i8] c"\1B[31margv[2]: offset :: the number of bytes off file'head.\1B[0m\00"
@str.6 = [75 x i8] c"\1B[31margv[3]: number :: the number of bytes that wanted to be read.\1B[0m\0A\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str.6, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(int);
void dev_putch(int c) {
  if (c > 0)
    putchar((char)c);
  else
    printf("\033[2J\033[1;1H");
  if (c == 8) {
    putchar(32);
    putchar(8);
  }
}


x86 assembly (clang, -O0):
<dev_putch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1145 <dev_putch+0x25>
mov    -0x4(%rbp),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    1151 <dev_putch+0x31>
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x8,-0x4(%rbp)
jne    116f <dev_putch+0x4f>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dev_putch>:
push   %rbx
test   %edi,%edi
jle    1149 <dev_putch+0x29>
mov    %edi,%ebx
movsbl %bl,%edi
call   1030 <putchar@plt>
cmp    $0x8,%ebx
jne    1156 <dev_putch+0x36>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
pop    %rbx
jmp    1030 <putchar@plt>
lea    0xeb0(%rip),%rdi
pop    %rbx
jmp    1040 <printf@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"\1B[2J\1B[1;1H\00"
define void @dev_putch(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load i32, i32* %2
%7 = trunc i32 %6 to i8
%8 = sext i8 %7 to i32
%9 = call i32 @putchar(i32 %8)
br label %12
10: ; preds = %1
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %5
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 8
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = call i32 @putchar(i32 32)
%17 = call i32 @putchar(i32 8)
br label %18
18: ; preds = %15, %12
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"\1B[2J\1B[1;1H\00"
define void @dev_putch(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %13
5: ; preds = %1
%6 = shl i32 %0, 24
%7 = ashr exact i32 %6, 24
%8 = tail call i32 @putchar(i32 %7)
%9 = icmp eq i32 %0, 8
br i1 %9, label %10, label %13
10: ; preds = %5
%11 = tail call i32 @putchar(i32 32)
%12 = tail call i32 @putchar(i32 8)
br label %13
13: ; preds = %3, %10, %5
ret void
}
int sec(int in) { return in + 2; }


x86 assembly (clang, -O0):
<sec>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sec>:
lea    0x2(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @sec(i32 %0) {
%2 = add nsw i32 %0, 2
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ dotvv(float const *, float const *);
scalar_t__ sqrt(int /*<<< orphan*/);
float lengthv(const float *v) { return (float)sqrt(dotvv(v, v)); }


x86 assembly (clang, -O0):
<lengthv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <dotvv@plt>
mov    %eax,%edi
call   1040 <sqrt@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lengthv>:
push   %rax
mov    %rdi,%rsi
call   1030 <dotvv@plt>
mov    %eax,%edi
call   1040 <sqrt@plt>
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @lengthv(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = load float*, float** %2
%5 = call i32 @dotvv(float* %3, float* %4)
%6 = call i64 @sqrt(i32 %5)
%7 = sitofp i64 %6 to float
ret float %7
}

LLVM IR (-O2):
define float @lengthv(float* %0) {
%2 = tail call i32 @dotvv(float* %0, float* %0)
%3 = tail call i64 @sqrt(i32 %2)
%4 = sitofp i64 %3 to float
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ a_base_encoders_reset();
void pre_auton() { a_base_encoders_reset(); }


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

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

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

LLVM IR (-O2):
define void @pre_auton() {
%1 = tail call i32 (...) @a_base_encoders_reset()
ret void
}
int max2(int a, int b) {
  if (a >= b)
    return a;
  else
    return b;
}


x86 assembly (clang, -O0):
<max2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1121 <max2+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <max2+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max2>:
mov    %edi,%eax
cmp    %esi,%edi
cmovl  %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @max2(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ switch_off_bits(unsigned char *, int);
void CTRL_REGSC_BITSET_BW_no_filter(unsigned char *data) {
  switch_off_bits(data, (0x80 | 0x40 | 0x20));
}


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

x86 assembly (clang, -O2):
<CTRL_REGSC_BITSET_BW_no_filter>:
mov    $0xe0,%esi
jmp    1030 <switch_off_bits@plt>

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

LLVM IR (-O2):
define void @CTRL_REGSC_BITSET_BW_no_filter(i8* %0) {
%2 = tail call i32 @switch_off_bits(i8* %0, i32 224)
ret void
}
unsigned long spl_debug_get_subsys(void) { return (0); }


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

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

LLVM IR (-O0):
define i64 @spl_debug_get_subsys() {
ret i64 0
}

LLVM IR (-O2):
define i64 @spl_debug_get_subsys() {
ret i64 0
}
int roadmap_softkeys_orientation() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @roadmap_softkeys_orientation() {
ret i32 0
}
unsigned long long foo() {
  unsigned long long h, l;
  asm volatile("rdtsc" : "=a"(l), "=d"(h));
  return l | (h << 32);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
rdtsc
mov    %rax,-0x10(%rbp)
mov    %rdx,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
shl    $0x20,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
rdtsc
shl    $0x20,%rdx
or     %rdx,%rax
ret

LLVM IR (-O0):
define i64 @foo() {
%1 = alloca i64
%2 = alloca i64
%3 = call { i64, i64 } asm sideeffect "rdtsc", "={ax},={dx},~{dirflag},~{fpsr},~{flags}"()
%4 = extractvalue { i64, i64 } %3, 0
%5 = extractvalue { i64, i64 } %3, 1
store i64 %4, i64* %2
store i64 %5, i64* %1
%6 = load i64, i64* %2
%7 = load i64, i64* %1
%8 = shl i64 %7, 32
%9 = or i64 %6, %8
ret i64 %9
}

LLVM IR (-O2):
define i64 @foo() {
%1 = tail call { i64, i64 } asm sideeffect "rdtsc", "={ax},={dx},~{dirflag},~{fpsr},~{flags}"()
%2 = extractvalue { i64, i64 } %1, 0
%3 = extractvalue { i64, i64 } %1, 1
%4 = shl i64 %3, 32
%5 = or i64 %4, %2
ret i64 %5
}
double pow4(double x) {
  double y = x * x;
  y *= y;
  return y;
}


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

x86 assembly (clang, -O2):
<pow4>:
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
ret

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

LLVM IR (-O2):
define double @pow4(double %0) {
%2 = fmul double %0, %0
%3 = fmul double %2, %2
ret double %3
}
void bindingerror(s) char *s;
{
  char buffer[300];
  sprintf(buffer, "unbound atom [%s]", s);
  gerror(buffer);
}


x86 assembly (clang, -O0):
<bindingerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x140(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xebf(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x140(%rbp),%rdi
mov    $0x0,%al
call   1030 <gerror@plt>
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bindingerror>:
push   %rbx
sub    $0x130,%rsp
mov    %rdi,%rdx
lea    0xece(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <gerror@plt>
add    $0x130,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"unbound atom [%s]\00"
define void @bindingerror(i8* %0) {
%2 = alloca i8*
%3 = alloca [300 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 (i8*, i8*, ...) @sprintf(i8* %4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @gerror to i32 (i8*, ...)*)(i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"unbound atom [%s]\00"
define void @bindingerror(i8* %0) {
%2 = alloca [300 x i8]
%3 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 0
%4 = call i32 (i8*, i8*, ...) @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @gerror to i32 (i8*, ...)*)(i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ getchar();
int *malloc(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int x;
  int *p;
  p = &x;
  scanf("%d", &x);
  printf("%d\n", *p);
  getchar();
  int *ptr = malloc(sizeof(int));
  free(ptr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0xe99(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\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
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = call i32 (...) @getchar()
%7 = call i32* @malloc(i32 4)
%8 = call i32 @free(i32* %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ mbus_remote_register_write(int, int, int);
int /*<<< orphan*/ set_pmu_sar_override(int);
void set_pmu_motion(void) {
  mbus_remote_register_write(0x8, 0x1A,
                             ((0 << 13) | (8 << 9) | (4 << 5) | (16)));
  delay(200);
  mbus_remote_register_write(0x8, 0x16,
                             ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) |
                              (0 << 13) | (5 << 9) | (5 << 5) | (22)));
  delay(200);
  set_pmu_sar_override(47);
}


x86 assembly (clang, -O0):
<set_pmu_motion>:
push   %rbp
mov    %rsp,%rbp
mov    $0x8,%edi
mov    $0x1a,%esi
mov    $0x1090,%edx
call   1050 <mbus_remote_register_write@plt>
mov    $0xc8,%edi
call   1040 <delay@plt>
mov    $0x8,%edi
mov    $0x16,%esi
mov    $0xcab6,%edx
call   1050 <mbus_remote_register_write@plt>
mov    $0xc8,%edi
call   1040 <delay@plt>
mov    $0x2f,%edi
call   1030 <set_pmu_sar_override@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_pmu_motion>:
push   %rax
mov    $0x8,%edi
mov    $0x1a,%esi
mov    $0x1090,%edx
call   1050 <mbus_remote_register_write@plt>
mov    $0xc8,%edi
call   1040 <delay@plt>
mov    $0x8,%edi
mov    $0x16,%esi
mov    $0xcab6,%edx
call   1050 <mbus_remote_register_write@plt>
mov    $0xc8,%edi
call   1040 <delay@plt>
mov    $0x2f,%edi
pop    %rax
jmp    1030 <set_pmu_sar_override@plt>

LLVM IR (-O0):
define void @set_pmu_motion() {
%1 = call i32 @mbus_remote_register_write(i32 8, i32 26, i32 4240)
%2 = call i32 @delay(i32 200)
%3 = call i32 @mbus_remote_register_write(i32 8, i32 22, i32 51894)
%4 = call i32 @delay(i32 200)
%5 = call i32 @set_pmu_sar_override(i32 47)
ret void
}

LLVM IR (-O2):
define void @set_pmu_motion() {
%1 = tail call i32 @mbus_remote_register_write(i32 8, i32 26, i32 4240)
%2 = tail call i32 @delay(i32 200)
%3 = tail call i32 @mbus_remote_register_write(i32 8, i32 22, i32 51894)
%4 = tail call i32 @delay(i32 200)
%5 = tail call i32 @set_pmu_sar_override(i32 47)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float a;
  scanf("%f", &a);
  if (a == -12) {
    printf("%.4f is negative", a);
  } else {
    printf("%.4f is zero", a);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xece(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
movss  0xeb4(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1171 <main+0x51>
jp     1171 <main+0x51>
movss  -0x8(%rbp),%xmm0
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
jmp    1182 <main+0x62>
movss  -0x8(%rbp),%xmm0
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
ucomiss 0xec1(%rip),%xmm0
jne    1154 <main+0x34>
jp     1154 <main+0x34>
lea    0xebd(%rip),%rdi
movss  0xeae(%rip),%xmm0
jmp    115b <main+0x3b>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [17 x i8] c"%.4f is negative\00"
@.str.2 = [13 x i8] c"%.4f is zero\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %2)
%4 = load float, float* %2
%5 = fcmp oeq float %4, -1.200000e+01
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = load float, float* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), float %7)
br label %12
9: ; preds = %0
%10 = load float, float* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), float %10)
br label %12
12: ; preds = %9, %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [17 x i8] c"%.4f is negative\00"
@.str.2 = [13 x i8] c"%.4f is zero\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 = fcmp oeq float %4, -1.200000e+01
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), float -1.200000e+01)
br label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), float %4)
br label %10
10: ; preds = %8, %6
ret i32 0
}
/* Variables and functions */
int eul04();
int /*<<< orphan*/ printf(char *, int);
int main(void) { printf("%u\n", eul04()); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <eul04@plt>
mov    %eax,%esi
lea    0xecc(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <eul04@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%u\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @eul04()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
size_t calendar_digits(int index) { return index == 5 ? 4 : 2; }


x86 assembly (clang, -O0):
<calendar_digits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x2,%eax
mov    $0x4,%ecx
cmp    $0x5,%edx
cmove  %ecx,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<calendar_digits>:
xor    %eax,%eax
cmp    $0x5,%edi
sete   %al
add    %rax,%rax
add    $0x2,%rax
ret

LLVM IR (-O0):
define i64 @calendar_digits(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 5
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 4, i32 2
%7 = sext i32 %6 to i64
ret i64 %7
}

LLVM IR (-O2):
define i64 @calendar_digits(i32 %0) {
%2 = icmp eq i32 %0, 5
%3 = select i1 %2, i64 4, i64 2
ret i64 %3
}
void kbase_ipa_model_use_configured_locked(struct kbase_device *kbdev) {}


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

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

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

LLVM IR (-O2):
%struct.kbase_device = type opaque
define void @kbase_ipa_model_use_configured_locked(%struct.kbase_device* nocapture %0) {
ret void
}
double f4_cb_send_pre_double_double_double_double_short(
    double (*cb)(double, double, double, double, short)) {
  short r = -22;
  return cb(8.25, 9.25, 10.25, 11.25, r) + 1.0;
}


x86 assembly (clang, -O0):
<f4_cb_send_pre_double_double_double_double_short>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movw   $0xffea,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xeea(%rip),%xmm0
movsd  0xeea(%rip),%xmm1
movsd  0xeea(%rip),%xmm2
movsd  0xeea(%rip),%xmm3
movswl -0xa(%rbp),%edi
call   *%rax
movsd  0xebc(%rip),%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4_cb_send_pre_double_double_double_double_short>:
push   %rax
mov    %rdi,%rax
movsd  0xef4(%rip),%xmm0
movsd  0xef4(%rip),%xmm1
movsd  0xef4(%rip),%xmm2
movsd  0xef4(%rip),%xmm3
mov    $0xffffffea,%edi
call   *%rax
addsd  0xeed(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @f4_cb_send_pre_double_double_double_double_short(double (double, double, double, double, i16)* %0) {
%2 = alloca double (double, double, double, double, i16)*
%3 = alloca i16
store double (double, double, double, double, i16)* %0, double (double, double, double, double, i16)** %2
store i16 -22, i16* %3
%4 = load double (double, double, double, double, i16)*, double (double, double, double, double, i16)** %2
%5 = load i16, i16* %3
%6 = call double %4(double 8.250000e+00, double 9.250000e+00, double 1.025000e+01, double 1.125000e+01, i16 signext %5)
%7 = fadd double %6, 1.000000e+00
ret double %7
}

LLVM IR (-O2):
define double @f4_cb_send_pre_double_double_double_double_short(double (double, double, double, double, i16)* nocapture %0) {
%2 = tail call double %0(double 8.250000e+00, double 9.250000e+00, double 1.025000e+01, double 1.125000e+01, i16 signext -22)
%3 = fadd double %2, 1.000000e+00
ret double %3
}
int isletter(char c) {
  return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
}


x86 assembly (clang, -O0):
<isletter>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1129 <isletter+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x7a,%ecx
mov    %al,-0x2(%rbp)
jle    114e <isletter+0x4e>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x41,%ecx
mov    %al,-0x3(%rbp)
jl     1148 <isletter+0x48>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isletter>:
and    $0xdf,%dil
add    $0xbf,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @isletter(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 97
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 122
br i1 %9, label %20, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 65
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 90
br label %18
18: ; preds = %14, %10
%19 = phi i1 [ false, %10 ], [ %17, %14 ]
br label %20
20: ; preds = %18, %6
%21 = phi i1 [ true, %6 ], [ %19, %18 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @isletter(i8 signext %0) {
%2 = and i8 %0, -33
%3 = add i8 %2, -65
%4 = icmp ult i8 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
void nvic_enable_irqs() {}


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

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

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

LLVM IR (-O2):
define void @nvic_enable_irqs() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fail(char *, unsigned long, char *);
void *malloc(size_t);
void *xmalloc(size_t size) {
  void *vp;
  if (size == 0)
    return NULL;
  vp = malloc(size);
  if (!vp)
    fail("xmalloc(%lu): %s", (unsigned long)size, "virtual memory exhausted");
  return vp;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1144 <xmalloc+0x24>
movq   $0x0,-0x8(%rbp)
jmp    117b <xmalloc+0x5b>
mov    -0x10(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1173 <xmalloc+0x53>
mov    -0x10(%rbp),%rsi
lea    0xe99(%rip),%rdi
lea    0xea3(%rip),%rdx
call   1030 <fail@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
test   %rdi,%rdi
je     114b <xmalloc+0x2b>
mov    %rdi,%rbx
call   1040 <malloc@plt>
test   %rax,%rax
je     1135 <xmalloc+0x15>
pop    %rbx
ret
lea    0xec4(%rip),%rdi
lea    0xece(%rip),%rdx
mov    %rbx,%rsi
call   1030 <fail@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"xmalloc(%lu): %s\00"
@.str.1 = [25 x i8] c"virtual memory exhausted\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %3
%5 = load i64, i64* %3
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* null, i8** %2
br label %18
8: ; preds = %1
%9 = load i64, i64* %3
%10 = call i8* @malloc(i64 %9)
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = icmp ne i8* %11, null
br i1 %12, label %16, label %13
13: ; preds = %8
%14 = load i64, i64* %3
%15 = call i32 @fail(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %14, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %13, %8
%17 = load i8*, i8** %4
store i8* %17, i8** %2
br label %18
18: ; preds = %16, %7
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
@.str = [17 x i8] c"xmalloc(%lu): %s\00"
@.str.1 = [25 x i8] c"virtual memory exhausted\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = tail call i8* @malloc(i64 %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @fail(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %3, %6, %1
%9 = phi i8* [ null, %1 ], [ null, %6 ], [ %4, %3 ]
ret i8* %9
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
scalar_t__ nrf_802154_pib_channel_get();
int /*<<< orphan*/ nrf_802154_pib_channel_set(scalar_t__);
int /*<<< orphan*/ nrf_802154_request_channel_update();
void nrf_802154_channel_set(uint8_t channel) {
  bool changed = nrf_802154_pib_channel_get() != channel;
  nrf_802154_pib_channel_set(channel);
  if (changed) {
    nrf_802154_request_channel_update();
  }
}


x86 assembly (clang, -O0):
<nrf_802154_channel_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <nrf_802154_pib_channel_get@plt>
cmp    -0x8(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <nrf_802154_pib_channel_set@plt>
cmpl   $0x0,-0xc(%rbp)
je     116c <nrf_802154_channel_set+0x3c>
mov    $0x0,%al
call   1040 <nrf_802154_request_channel_update@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nrf_802154_channel_set>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <nrf_802154_pib_channel_get@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1050 <nrf_802154_pib_channel_set@plt>
cmp    %rbx,%r14
jne    1156 <nrf_802154_channel_set+0x26>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <nrf_802154_request_channel_update@plt>

LLVM IR (-O0):
define void @nrf_802154_channel_set(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
%4 = call i64 (...) @nrf_802154_pib_channel_get()
%5 = load i64, i64* %2
%6 = icmp ne i64 %4, %5
%7 = zext i1 %6 to i32
store i32 %7, i32* %3
%8 = load i64, i64* %2
%9 = call i32 @nrf_802154_pib_channel_set(i64 %8)
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = call i32 (...) @nrf_802154_request_channel_update()
br label %14
14: ; preds = %12, %1
ret void
}

LLVM IR (-O2):
define void @nrf_802154_channel_set(i64 %0) {
%2 = tail call i64 (...) @nrf_802154_pib_channel_get()
%3 = icmp eq i64 %2, %0
%4 = tail call i32 @nrf_802154_pib_channel_set(i64 %0)
br i1 %3, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @nrf_802154_request_channel_update()
br label %7
7: ; preds = %5, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ft_itoa_sub(int, int, int, char **);
char *ft_itoa(int n) {
  char *str;
  if (n < 0) {
    ft_itoa_sub(-n, 2, 1, &str);
    if (str)
      str[0] = '-';
  } else
    ft_itoa_sub(n, 1, 0, &str);
  return (str);
}


x86 assembly (clang, -O0):
<ft_itoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1154 <ft_itoa+0x44>
xor    %edi,%edi
sub    -0x4(%rbp),%edi
mov    $0x2,%esi
mov    $0x1,%edx
lea    -0x10(%rbp),%rcx
call   1030 <ft_itoa_sub@plt>
cmpq   $0x0,-0x10(%rbp)
je     114f <ft_itoa+0x3f>
mov    -0x10(%rbp),%rax
movb   $0x2d,(%rax)
jmp    1167 <ft_itoa+0x57>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
xor    %edx,%edx
lea    -0x10(%rbp),%rcx
call   1030 <ft_itoa_sub@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_itoa>:
push   %rax
test   %edi,%edi
js     1126 <ft_itoa+0x16>
mov    %rsp,%rcx
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <ft_itoa_sub@plt>
jmp    1146 <ft_itoa+0x36>
neg    %edi
mov    %rsp,%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <ft_itoa_sub@plt>
mov    (%rsp),%rax
test   %rax,%rax
je     1146 <ft_itoa+0x36>
movb   $0x2d,(%rax)
mov    (%rsp),%rax
pop    %rcx
ret

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

LLVM IR (-O2):
define i8* @ft_itoa(i32 %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = icmp slt i32 %0, 0
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = sub nsw i32 0, %0
%7 = call i32 @ft_itoa_sub(i32 %6, i32 2, i32 1, i8** %2)
%8 = load i8*, i8** %2
%9 = icmp eq i8* %8, null
br i1 %9, label %13, label %10
10: ; preds = %5
store i8 45, i8* %8
br label %13
11: ; preds = %1
%12 = call i32 @ft_itoa_sub(i32 %0, i32 1, i32 0, i8** %2)
br label %13
13: ; preds = %5, %10, %11
%14 = load i8*, i8** %2
ret i8* %14
}
/* Variables and functions */
char *calloc(int, int);
int /*<<< orphan*/ free(char *);
char callocZeroesBad() {
  char *buf = calloc(2, 2);
  char result = buf[3];
  if (buf[1] != 0) {
    free(buf);
  }
  return result;
}


x86 assembly (clang, -O0):
<callocZeroesBad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x2,%esi
mov    %esi,%edi
call   1040 <calloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     115c <callocZeroesBad+0x3c>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
movsbl -0x9(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define signext i8 @callocZeroesBad() {
ret i8 0
}
const char *read_constant_string() { return "Hello from C"; }


x86 assembly (clang, -O0):
<read_constant_string>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_constant_string>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello from C\00"
define i8* @read_constant_string() {
ret i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello from C\00"
define i8* @read_constant_string() {
ret i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
affichage_recursif() {
  printf("Salut c'est cool\n");
  affichage_recursif();
}


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

x86 assembly (clang, -O2):
<affichage_recursif>:
push   %rbx
lea    0xee8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <puts@plt>
jmp    1120 <affichage_recursif+0x10>

LLVM IR (-O0):
@.str = [18 x i8] c"Salut c'est cool\0A\00"
define i32 @affichage_recursif() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @affichage_recursif()
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@str = [17 x i8] c"Salut c'est cool\00"
define i32 @affichage_recursif() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %1
}
void headids_init(void) {}


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

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

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

LLVM IR (-O2):
define void @headids_init() {
ret void
}
int test_00(int tab[], int index) { return tab[index + 1]; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
movslq %esi,%rax
mov    0x4(%rdi,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @test_00(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 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %5, i64 %8
%10 = load i32, i32* %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @test_00(i32* nocapture %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ regex_t;

/* Variables and functions */
int /*<<< orphan*/ EBADR;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ regcomp(int /*<<< orphan*/ *, char const *, int);
int /*<<< orphan*/ stderr;
void xregcomp(regex_t *preg, const char *regex, int cflags) {
  if (regcomp(preg, regex, cflags)) {
    fprintf(stderr, "Error: Regex compilation error\n");
    exit(EBADR);
  }
}


x86 assembly (clang, -O0):
<xregcomp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <regcomp@plt>
cmp    $0x0,%rax
je     1180 <xregcomp+0x50>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
lea    0xe93(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xregcomp>:
push   %rax
call   1030 <regcomp@plt>
test   %rax,%rax
jne    113d <xregcomp+0xd>
pop    %rax
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"Error: Regex compilation error\0A\00"
@EBADR = global i32 0
define void @xregcomp(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i64 @regcomp(i32* %7, i8* %8, i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %3
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @EBADR
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %3
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"Error: Regex compilation error\0A\00"
@EBADR = global i32 0
define void @xregcomp(i32* %0, i8* %1, i32 %2) {
%4 = tail call i64 @regcomp(i32* %0, i8* %1, i32 %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @EBADR
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %3
ret void
}
void comma() {
  int a;
  int *b;
  (b++, a++) * 3;
}


x86 assembly (clang, -O0):
<comma>:
push   %rbp
mov    %rsp,%rbp
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @comma() {
%1 = alloca i32
%2 = alloca i32*
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i32 1
store i32* %4, i32** %2
%5 = load i32, i32* %1
%6 = add nsw i32 %5, 1
store i32 %6, i32* %1
%7 = mul nsw i32 %5, 3
ret void
}

LLVM IR (-O2):
define void @comma() {
ret void
}