xunge/DecIR huggingface dataset:
/* Variables and functions */
int my_nrand(int, void *);
int samp_stats_idx(int *pre_nstats, int nstats, void *rand_state) {
  int jstats = -1;
  if (*pre_nstats < 60000) {
    jstats = (*pre_nstats)++;
  } else {
    jstats = my_nrand(++(*pre_nstats), rand_state);
    if (jstats >= 60000) {
      jstats = -1;
    }
  }
  return jstats;
}


x86 assembly (clang, -O0):
<samp_stats_idx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0xea60,(%rax)
jge    114f <samp_stats_idx+0x3f>
mov    -0x8(%rbp),%rcx
mov    (%rcx),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,(%rcx)
mov    %eax,-0x1c(%rbp)
jmp    117f <samp_stats_idx+0x6f>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
add    $0x1,%edi
mov    %edi,(%rax)
mov    -0x18(%rbp),%rsi
call   1030 <my_nrand@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xea60,-0x1c(%rbp)
jl     117a <samp_stats_idx+0x6a>
movl   $0xffffffff,-0x1c(%rbp)
jmp    117f <samp_stats_idx+0x6f>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<samp_stats_idx>:
push   %rax
mov    %rdi,%rcx
mov    (%rdi),%eax
lea    0x1(%rax),%edi
mov    %edi,(%rcx)
cmp    $0xea60,%eax
jl     1139 <samp_stats_idx+0x29>
mov    %rdx,%rsi
call   1030 <my_nrand@plt>
mov    %eax,%ecx
cmp    $0xea60,%eax
mov    $0xffffffff,%eax
cmovl  %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @samp_stats_idx(i32* nocapture %0, i32 %1, i8* %2) {
%4 = load i32, i32* %0
%5 = icmp slt i32 %4, 60000
%6 = add nsw i32 %4, 1
store i32 %6, i32* %0
br i1 %5, label %11, label %7
7: ; preds = %3
%8 = tail call i32 @my_nrand(i32 %6, i8* %2)
%9 = icmp sgt i32 %8, 59999
%10 = select i1 %9, i32 -1, i32 %8
br label %11
11: ; preds = %3, %7
%12 = phi i32 [ %10, %7 ], [ %4, %3 ]
ret i32 %12
}
/* Variables and functions */
char const *keyname(int);
const char *wrap_keyname(int key) { return keyname(key); }


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

x86 assembly (clang, -O2):
<wrap_keyname>:
jmp    1030 <keyname@plt>

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

LLVM IR (-O2):
define i8* @wrap_keyname(i32 %0) {
%2 = tail call i8* @keyname(i32 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ DMA15_DMA31_DriverIRQHandler();
__attribute__((weak)) void DMA15_DMA31_IRQHandler(void) {
  DMA15_DMA31_DriverIRQHandler();
}


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

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

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

LLVM IR (-O2):
define weak void @DMA15_DMA31_IRQHandler() {
%1 = tail call i32 (...) @DMA15_DMA31_DriverIRQHandler()
ret void
}
void ExttProfileAuxTable(void) {}


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

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

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

LLVM IR (-O2):
define void @ExttProfileAuxTable() {
ret void
}
int int_add_func(int *i1, int *i2) { return (*i1 + *i2); }


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

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

LLVM IR (-O0):
define i32 @int_add_func(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* %5
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = add nsw i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @int_add_func(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = add nsw i32 %4, %3
ret i32 %5
}
void ExttTimeIntervalAuxTable(void) {}


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

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

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

LLVM IR (-O2):
define void @ExttTimeIntervalAuxTable() {
ret void
}
int is_small(int start, int end) { return (end - start <= 3); }


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

x86 assembly (clang, -O2):
<is_small>:
sub    %edi,%esi
xor    %eax,%eax
cmp    $0x4,%esi
setl   %al
ret

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

LLVM IR (-O2):
define i32 @is_small(i32 %0, i32 %1) {
%3 = sub nsw i32 %1, %0
%4 = icmp slt i32 %3, 4
%5 = zext i1 %4 to i32
ret i32 %5
}
int fun1037() { return 1037; }


x86 assembly (clang, -O0):
<fun1037>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40d,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun1037>:
mov    $0x40d,%eax
ret

LLVM IR (-O0):
define i32 @fun1037() {
ret i32 1037
}

LLVM IR (-O2):
define i32 @fun1037() {
ret i32 1037
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcmp(char *, char *);
int main(void) {
  char name_1[6] = "use";
  char name_2[6] = "use";
  if (!strcmp(name_1, name_2)) {
    printf("Equal!\n");
  } else {
    printf("Not equal !\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xec5(%rip),%ax
mov    %ax,-0x6(%rbp)
mov    0xebd(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xeb7(%rip),%ax
mov    %ax,-0xc(%rbp)
lea    -0xa(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    117e <main+0x5e>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
jmp    118a <main+0x6a>
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.name_1 = [6 x i8] c"use\00\00\00"
@__const.main.name_2 = [6 x i8] c"use\00\00\00"
@.str = [8 x i8] c"Equal!\0A\00"
@.str.1 = [13 x i8] c"Not equal !\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8]
%3 = alloca [6 x i8]
store i32 0, i32* %1
%4 = bitcast [6 x i8]* %2 to i8*
%5 = bitcast [6 x i8]* %3 to i8*
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%8 = call i32 @strcmp(i8* %6, i8* %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %14
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %10
ret i32 0
}

LLVM IR (-O2):
@str = [7 x i8] c"Equal!\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))
ret i32 0
}
/* Variables and functions */
int *malloc(int);
void f() { int *ptr = malloc(sizeof(int) * 10); }


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

x86 assembly (clang, -O2):
<f>:
mov    $0x28,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define void @f() {
%1 = alloca i32*
%2 = call i32* @malloc(i32 40)
store i32* %2, i32** %1
ret void
}

LLVM IR (-O2):
define void @f() {
%1 = tail call i32* @malloc(i32 40)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pathtable_get_size_and_entries(void const *, unsigned int *,
                                                  void *);
unsigned int iso9660_pathtable_get_size(const void *pt) {
  unsigned int size = 0;
  pathtable_get_size_and_entries(pt, &size, ((void *)0));
  return size;
}


x86 assembly (clang, -O0):
<iso9660_pathtable_get_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <pathtable_get_size_and_entries@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iso9660_pathtable_get_size>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
xor    %edx,%edx
call   1030 <pathtable_get_size_and_entries@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @iso9660_pathtable_get_size(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = load i8*, i8** %2
%5 = call i32 @pathtable_get_size_and_entries(i8* %4, i32* %3, i8* null)
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @iso9660_pathtable_get_size(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = call i32 @pathtable_get_size_and_entries(i8* %0, i32* %2, i8* null)
%5 = load i32, i32* %2
ret i32 %5
}
unsigned long read_rflags(void) {
  unsigned long f;
  asm volatile("pushf; pop %0\n\t" : "=rm"(f));
  return f;
}


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

x86 assembly (clang, -O2):
<read_rflags>:
pushf
pop    -0x8(%rsp)
mov    -0x8(%rsp),%rax
ret

LLVM IR (-O0):
define i64 @read_rflags() {
%1 = alloca i64
%2 = load i64, i64* %1
ret i64 %2
}

LLVM IR (-O2):
define i64 @read_rflags() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = load i64, i64* %1
ret i64 %3
}
unsigned long long get_timestamp(void) {
  unsigned int __a, __d;
  __asm__ __volatile__("rdtsc" : "=a"(__a), "=d"(__d));
  return ((long long)__a) | (((long long)__d) << 32);
}


x86 assembly (clang, -O0):
<get_timestamp>:
push   %rbp
mov    %rsp,%rbp
rdtsc
mov    %eax,-0x4(%rbp)
mov    %edx,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x20,%rcx
or     %rcx,%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @get_timestamp() {
%1 = tail call { i32, i32 } asm sideeffect "rdtsc", "={ax},={dx},~{dirflag},~{fpsr},~{flags}"()
%2 = extractvalue { i32, i32 } %1, 0
%3 = extractvalue { i32, i32 } %1, 1
%4 = zext i32 %2 to i64
%5 = zext i32 %3 to i64
%6 = shl nuw i64 %5, 32
%7 = or i64 %6, %4
ret i64 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *get_line(char *);
int /*<<< orphan*/ strcmp(char *, char *);
void _ignore_answer(FILE *f) {
  char *l;
  char buf[512];
  while (((l = get_line(buf)))) {
    if (!strcmp(l, "."))
      break;
  }
}


x86 assembly (clang, -O0):
<_ignore_answer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x210(%rbp),%rdi
call   1030 <get_line@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     116c <_ignore_answer+0x4c>
mov    -0x10(%rbp),%rdi
lea    0xeac(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1167 <_ignore_answer+0x47>
jmp    116c <_ignore_answer+0x4c>
jmp    112f <_ignore_answer+0xf>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ignore_answer>:
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %rsp,%rbx
lea    0xecc(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
je     115c <_ignore_answer+0x3c>
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    1140 <_ignore_answer+0x20>
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c".\00"
define void @_ignore_answer(i32* nocapture readnone %0) {
%2 = alloca [512 x i8]
%3 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
br label %4
4: ; preds = %7, %1
%5 = call i8* @get_line(i8* %3)
%6 = icmp eq i8* %5, null
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = call i32 @strcmp(i8* %5, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %4
10: ; preds = %7, %4
ret void
}
/* Type definitions */
typedef scalar_t__ uid_t;

/* Variables and functions */
scalar_t__ atoi(char const *);
int /*<<< orphan*/ usage(char *);
uid_t parse_uid(const char *str) {
  uid_t uid;
  if (!str)
    usage("UID is not set");
  uid = atoi(str);
  if (uid <= 0)
    usage("UID is not a positive number");
  return uid;
}


x86 assembly (clang, -O0):
<parse_uid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1143 <parse_uid+0x23>
lea    0xec2(%rip),%rdi
call   1030 <usage@plt>
mov    -0x8(%rbp),%rdi
call   1040 <atoi@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jg     1167 <parse_uid+0x47>
lea    0xead(%rip),%rdi
call   1030 <usage@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_uid>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
jne    1135 <parse_uid+0x15>
lea    0xed0(%rip),%rdi
call   1030 <usage@plt>
mov    %rbx,%rdi
call   1040 <atoi@plt>
mov    %rax,%rbx
test   %rax,%rax
jg     1151 <parse_uid+0x31>
lea    0xec3(%rip),%rdi
call   1030 <usage@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"UID is not set\00"
@.str.1 = [29 x i8] c"UID is not a positive number\00"
define i64 @parse_uid(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 @usage(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = load i8*, i8** %2
%10 = call i64 @atoi(i8* %9)
store i64 %10, i64* %3
%11 = load i64, i64* %3
%12 = icmp sle i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = call i32 @usage(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %8
%16 = load i64, i64* %3
ret i64 %16
}

LLVM IR (-O2):
@.str = [15 x i8] c"UID is not set\00"
@.str.1 = [29 x i8] c"UID is not a positive number\00"
define i64 @parse_uid(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @usage(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
%6 = tail call i64 @atoi(i8* %0)
%7 = icmp slt i64 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @usage(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
ret i64 %6
}
void *ffoox1f(void) { return (void *)0; }


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

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

LLVM IR (-O0):
define i8* @ffoox1f() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @ffoox1f() {
ret i8* null
}
/* Variables and functions */
int strlen(char *);
void wcsutil_blank_fill(int n, char c[]) {
  int k;
  for (k = strlen(c); k < n; k++) {
    c[k] = ' ';
  }
  return;
}


x86 assembly (clang, -O0):
<wcsutil_blank_fill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1151 <wcsutil_blank_fill+0x41>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112b <wcsutil_blank_fill+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcsutil_blank_fill>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1030 <strlen@plt>
cmp    %ebp,%eax
jge    1152 <wcsutil_blank_fill+0x32>
movslq %eax,%rcx
add    %rcx,%rbx
not    %eax
add    %ebp,%eax
add    $0x1,%rax
mov    %rbx,%rdi
mov    $0x20,%esi
mov    %rax,%rdx
call   1040 <memset@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @wcsutil_blank_fill(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = icmp slt i32 %3, %0
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = sext i32 %3 to i64
%7 = getelementptr i8, i8* %1, i64 %6
%8 = xor i32 %3, -1
%9 = add i32 %8, %0
%10 = zext i32 %9 to i64
%11 = add nuw nsw i64 %10, 1
br label %12
12: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sgg_execcmd0(int, int, int, int, int const, int const, int);
void sgg_wm0s_sendto2_winman0(const int signal, const int param) {
  sgg_execcmd0(0x0020, 0x80000000 + 4, 0x3240 + 3, 0x7f000002, signal, param,
               0x0000);
  return;
}


x86 assembly (clang, -O0):
<sgg_wm0s_sendto2_winman0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%r8d
mov    -0x8(%rbp),%r9d
mov    $0x20,%edi
mov    $0x80000004,%esi
mov    $0x3243,%edx
mov    $0x7f000002,%ecx
xor    %eax,%eax
movl   $0x0,(%rsp)
call   1030 <sgg_execcmd0@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sgg_wm0s_sendto2_winman0>:
push   %rax
mov    %esi,%r9d
mov    %edi,%r8d
movl   $0x0,(%rsp)
mov    $0x20,%edi
mov    $0x80000004,%esi
mov    $0x3243,%edx
mov    $0x7f000002,%ecx
call   1030 <sgg_execcmd0@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @sgg_wm0s_sendto2_winman0(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 = call i32 @sgg_execcmd0(i32 32, i32 -2147483644, i32 12867, i32 2130706434, i32 %5, i32 %6, i32 0)
ret void
}

LLVM IR (-O2):
define void @sgg_wm0s_sendto2_winman0(i32 %0, i32 %1) {
%3 = tail call i32 @sgg_execcmd0(i32 32, i32 -2147483644, i32 12867, i32 2130706434, i32 %0, i32 %1, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __fpurge(int /*<<< orphan*/);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ stdin;
void __pause(void) {
  __fpurge(stdin);
  getchar();
}


x86 assembly (clang, -O0):
<__pause>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
call   1030 <__fpurge@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__pause>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
call   1030 <__fpurge@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <getchar@plt>

LLVM IR (-O0):
@stdin = global i32 0
define void @__pause() {
%1 = load i32, i32* @stdin
%2 = call i32 @__fpurge(i32 %1)
%3 = call i32 (...) @getchar()
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
define void @__pause() {
%1 = load i32, i32* @stdin
%2 = tail call i32 @__fpurge(i32 %1)
%3 = tail call i32 (...) @getchar()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, void *, int);
void get_string(void *from, int len, char *to) {
  if (len > 255)
    len = 255;
  memcpy(to, from, len);
  to[len] = 0;
}


x86 assembly (clang, -O0):
<get_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0xff,-0xc(%rbp)
jle    1137 <get_string+0x27>
movl   $0xff,-0xc(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_string>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rdi,%rax
cmp    $0xff,%esi
mov    $0xff,%ebp
cmovl  %esi,%ebp
mov    %rdx,%rdi
mov    %rax,%rsi
mov    %ebp,%edx
call   1030 <memcpy@plt>
movslq %ebp,%rax
movb   $0x0,(%rbx,%rax,1)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @get_string(i8* %0, i32 %1, i8* %2) {
%4 = icmp slt i32 %1, 255
%5 = select i1 %4, i32 %1, i32 255
%6 = tail call i32 @memcpy(i8* %2, i8* %0, i32 %5)
%7 = sext i32 %5 to i64
%8 = getelementptr inbounds i8, i8* %2, i64 %7
store i8 0, i8* %8
ret void
}
int test_imm_3Euint8_reg(unsigned char val) {
  return ((val) & (0x3E << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_3Euint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0x3e,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_3Euint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 62
%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_3Euint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 62
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
unsigned long int integer_to_i(unsigned long int self) { return self; }


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

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

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

LLVM IR (-O2):
define i64 @integer_to_i(i64 returned %0) {
ret i64 %0
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
scalar_t__ kill(int /*<<< orphan*/ const, int /*<<< orphan*/);
int valid_pid(const pid_t pid) { return kill(pid, 0) == 0 ? 1 : 0; }


x86 assembly (clang, -O0):
<valid_pid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1030 <kill@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_pid>:
push   %rax
xor    %esi,%esi
call   1030 <kill@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @valid_pid(i32 %0) {
%2 = tail call i64 @kill(i32 %0, i32 0)
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void print_usage(int argc, char **argv) {
  fprintf(stderr, "Usage: %s <filepath>\n", argv[0]);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xeca(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"Usage: %s <filepath>\0A\00"
define void @print_usage(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* @stderr
%6 = load i8**, i8*** %4
%7 = getelementptr inbounds i8*, i8** %6, i64 0
%8 = load i8*, i8** %7
%9 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %8)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Usage: %s <filepath>\0A\00"
define void @print_usage(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %1
%5 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ test_create_destroy_works();
int /*<<< orphan*/ test_two_level_stack();
int main(int argc, char *argv[]) {
  if (argc > 1) {
    printf("%s takes no arguments\n", argv[0]);
    return 1;
  }
  test_two_level_stack();
  test_create_destroy_works();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    116f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1184 <main+0x54>
mov    $0x0,%al
call   1050 <test_two_level_stack@plt>
mov    $0x0,%al
call   1040 <test_create_destroy_works@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jl     114c <main+0x1c>
mov    (%rsi),%rsi
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%ebx
jmp    115c <main+0x2c>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <test_two_level_stack@plt>
xor    %eax,%eax
call   1040 <test_create_destroy_works@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"%s takes no arguments\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %11)
store i32 1, i32* %3
br label %16
13: ; preds = %2
%14 = call i32 (...) @test_two_level_stack()
%15 = call i32 (...) @test_create_destroy_works()
store i32 0, i32* %3
br label %16
16: ; preds = %13, %8
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str = [23 x i8] c"%s takes no arguments\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %10
7: ; preds = %2
%8 = tail call i32 (...) @test_two_level_stack()
%9 = tail call i32 (...) @test_create_destroy_works()
br label %10
10: ; preds = %7, %4
%11 = phi i32 [ 1, %4 ], [ 0, %7 ]
ret i32 %11
}
long __syscall5(long __n, long __a1, long __a2, long __a3, long __a4,
                long __a5) {
  unsigned long __ret;
  register long __r10 __asm__("r10") = __a4;
  register long __r8 __asm__("r8") = __a5;
  __asm__ __volatile__("syscall"
                       : "=a"(__ret)
                       : "a"(__n), "D"(__a1), "S"(__a2), "d"(__a3), "r"(__r10),
                         "r"(__r8)
                       : "rcx", "r11", "memory");
  return __ret;
}


x86 assembly (clang, -O0):
<__syscall5>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x40(%rbp),%r10
mov    -0x48(%rbp),%r8
syscall
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__syscall5>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
mov    %r8,%r10
mov    %r9,%r8
syscall
ret

LLVM IR (-O0):
define i64 @__syscall5(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
store i64 %0, i64* %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i64 %3, i64* %10
store i64 %4, i64* %11
store i64 %5, i64* %12
%16 = load i64, i64* %11
store i64 %16, i64* %14
%17 = load i64, i64* %12
store i64 %17, i64* %15
%18 = load i64, i64* %7
%19 = load i64, i64* %8
%20 = load i64, i64* %9
%21 = load i64, i64* %10
%22 = load i64, i64* %14
%23 = load i64, i64* %15
%24 = call i64 asm sideeffect "syscall", "={ax},{ax},{di},{si},{dx},{r10},{r8},~{rcx},~{r11},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %18, i64 %19, i64 %20, i64 %21, i64 %22, i64 %23)
store i64 %24, i64* %13
%25 = load i64, i64* %13
ret i64 %25
}

LLVM IR (-O2):
define i64 @__syscall5(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
%7 = tail call i64 asm sideeffect "syscall", "={ax},{ax},{di},{si},{dx},{r10},{r8},~{rcx},~{r11},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5)
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ foo();
int main() {
  foo();
  return 42;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <foo@plt>
mov    $0x2a,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @foo()
ret i32 42
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo()
ret i32 42
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void label(int l) { printf("L%d:\n", l); }


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

x86 assembly (clang, -O2):
<label>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"L%d:\0A\00"
define void @label(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"L%d:\0A\00"
define void @label(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
int main() {
  asm("push	$"
      "0x12345675"
      ";			push	$"
      "0x12345674"
      ";			push	$"
      "0x12345673"
      ";			push	$"
      "0x12345672"
      ";			push	$"
      "0x12345671"
      ";			push	$"
      "0x12345670"
      ";			jmp	 "
      ""
      "fn");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
push   $0x12345675
push   $0x12345674
push   $0x12345673
push   $0x12345672
push   $0x12345671
push   $0x12345670
jmp    1030 <fn@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   $0x12345675
push   $0x12345674
push   $0x12345673
push   $0x12345672
push   $0x12345671
push   $0x12345670
jmp    1030 <fn@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @main() {
tail call void asm sideeffect "push\09$$0x12345675;\09\09\09push\09$$0x12345674;\09\09\09push\09$$0x12345673;\09\09\09push\09$$0x12345672;\09\09\09push\09$$0x12345671;\09\09\09push\09$$0x12345670;\09\09\09jmp\09 fn", "~{dirflag},~{fpsr},~{flags}"()
ret i32 0
}
void ncr_log(const char *fmt, ...) {}


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

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

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

LLVM IR (-O2):
define void @ncr_log(i8* nocapture %0, ...) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fread(float *, int, int, int /*<<< orphan*/ *);
float lire_reel_binaire(FILE *fichier) {
  float reel;
  fread(&reel, 4, 1, fichier);
  return (reel);
}


x86 assembly (clang, -O0):
<lire_reel_binaire>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0xc(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lire_reel_binaire>:
push   %rax
mov    %rdi,%rcx
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
movss  0x4(%rsp),%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
define float @lire_reel_binaire(i32* nocapture %0) {
%2 = alloca float
%3 = bitcast float* %2 to i8*
%4 = call i32 @fread(float* %2, i32 4, i32 1, i32* %0)
%5 = load float, float* %2
ret float %5
}
struct foo {
  int X, Y, Z;
} f3() {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
jmp    1104 <f3+0x4>

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

LLVM IR (-O0):
define { i64, i32 } @f3() {
%1 = alloca { i64, i32 }
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
define { i64, i32 } @f3() {
br label %1
1: ; preds = %0, %1
br label %1
}
int flush_dry_bio_endio(struct bio *bio, unsigned int bytes, int error) {
  int a;
  return a;
}


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

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

LLVM IR (-O0):
%struct.bio = type opaque
define i32 @flush_dry_bio_endio(%struct.bio* %0, i32 %1, i32 %2) {
%4 = alloca %struct.bio*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store %struct.bio* %0, %struct.bio** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %7
ret i32 %8
}

LLVM IR (-O2):
%struct.bio = type opaque
define i32 @flush_dry_bio_endio(%struct.bio* nocapture readnone %0, i32 %1, i32 %2) {
ret i32 undef
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int crc8_table_get(int);
uint8_t crc8_calc(uint8_t crc, uint8_t data) {
  return crc8_table_get(crc ^ data);
}


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

x86 assembly (clang, -O2):
<crc8_calc>:
xor    %esi,%edi
jmp    1030 <crc8_table_get@plt>

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

LLVM IR (-O2):
define i32 @crc8_calc(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
%4 = tail call i32 @crc8_table_get(i32 %3)
ret i32 %4
}
/* Variables and functions */
unsigned short size2hash(size_t size) {
  if (size <= (16 * 128))
    return (unsigned short)(size + 16 - 1) / 16;
  if (size <= (16 * 128) + (64 * 736))
    return (unsigned short)(size - (16 * 128) + 64 - 1) / 64 + 128;
  return 0xffff;
}


x86 assembly (clang, -O0):
<size2hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x800,-0x10(%rbp)
ja     1136 <size2hash+0x36>
mov    -0x10(%rbp),%rax
add    $0x10,%rax
sub    $0x1,%rax
movzwl %ax,%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %ax,-0x2(%rbp)
jmp    1175 <size2hash+0x75>
cmpq   $0xc000,-0x10(%rbp)
ja     116f <size2hash+0x6f>
mov    -0x10(%rbp),%rax
sub    $0x800,%rax
add    $0x40,%rax
sub    $0x1,%rax
movzwl %ax,%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
add    $0x80,%eax
mov    %ax,-0x2(%rbp)
jmp    1175 <size2hash+0x75>
movw   $0xffff,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<size2hash>:
cmp    $0x800,%rdi
ja     1113 <size2hash+0x13>
add    $0xf,%edi
movzwl %di,%eax
shr    $0x4,%eax
ret
mov    $0xffff,%ax
cmp    $0xc000,%rdi
ja     112f <size2hash+0x2f>
add    $0xfffff83f,%edi
movzwl %di,%eax
shr    $0x6,%eax
sub    $0xffffff80,%eax
ret

LLVM IR (-O0):
define zeroext i16 @size2hash(i64 %0) {
%2 = alloca i16
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp ule i64 %4, 2048
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = load i64, i64* %3
%8 = add i64 %7, 16
%9 = sub i64 %8, 1
%10 = trunc i64 %9 to i16
%11 = zext i16 %10 to i32
%12 = sdiv i32 %11, 16
%13 = trunc i32 %12 to i16
store i16 %13, i16* %2
br label %28
14: ; preds = %1
%15 = load i64, i64* %3
%16 = icmp ule i64 %15, 49152
br i1 %16, label %17, label %27
17: ; preds = %14
%18 = load i64, i64* %3
%19 = sub i64 %18, 2048
%20 = add i64 %19, 64
%21 = sub i64 %20, 1
%22 = trunc i64 %21 to i16
%23 = zext i16 %22 to i32
%24 = sdiv i32 %23, 64
%25 = add nsw i32 %24, 128
%26 = trunc i32 %25 to i16
store i16 %26, i16* %2
br label %28
27: ; preds = %14
store i16 -1, i16* %2
br label %28
28: ; preds = %27, %17, %6
%29 = load i16, i16* %2
ret i16 %29
}

LLVM IR (-O2):
define zeroext i16 @size2hash(i64 %0) {
%2 = icmp ult i64 %0, 2049
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = trunc i64 %0 to i16
%5 = add nuw nsw i16 %4, 15
%6 = lshr i16 %5, 4
br label %14
7: ; preds = %1
%8 = icmp ult i64 %0, 49153
br i1 %8, label %9, label %14
9: ; preds = %7
%10 = trunc i64 %0 to i16
%11 = add i16 %10, -1985
%12 = lshr i16 %11, 6
%13 = add nuw nsw i16 %12, 128
br label %14
14: ; preds = %7, %9, %3
%15 = phi i16 [ %6, %3 ], [ %13, %9 ], [ -1, %7 ]
ret i16 %15
}
signed int be_read16(const void *p) {
  unsigned char *i = (unsigned char *)p;
  return i[0] << 8 | i[1];
}


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

x86 assembly (clang, -O2):
<be_read16>:
movzwl (%rdi),%eax
shl    $0x10,%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @be_read16(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = shl i32 %8, 8
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = or i32 %9, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @be_read16(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = or i32 %4, %7
ret i32 %8
}
int lsame2(const char c1[], const char c2[]) {
  if (c1[0] == c2[0])
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<lsame2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    112e <lsame2+0x2e>
movl   $0x1,-0x4(%rbp)
jmp    1135 <lsame2+0x35>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lsame2>:
mov    (%rdi),%cl
xor    %eax,%eax
cmp    (%rsi),%cl
sete   %al
ret

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

LLVM IR (-O2):
define i32 @lsame2(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp eq i8 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
struct lf_hashtbl {
  int dummy;
};

/* Variables and functions */
void *lf_hashtbl_cond_update(struct lf_hashtbl *, int /*<<< orphan*/ *, void *);
void *lf_hashtbl_add(struct lf_hashtbl *tbl, void *elm) {
  return lf_hashtbl_cond_update(tbl, NULL, elm);
}


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

x86 assembly (clang, -O2):
<lf_hashtbl_add>:
mov    %rsi,%rdx
xor    %esi,%esi
jmp    1030 <lf_hashtbl_cond_update@plt>

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

LLVM IR (-O2):
%struct.lf_hashtbl = type { i32 }
define i8* @lf_hashtbl_add(%struct.lf_hashtbl* %0, i8* %1) {
%3 = tail call i8* @lf_hashtbl_cond_update(%struct.lf_hashtbl* %0, i32* null, i8* %1)
ret i8* %3
}
int find_slash(char c) { return (c == '/') ? 1 : 0; }


x86 assembly (clang, -O0):
<find_slash>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x2f,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_slash>:
xor    %eax,%eax
cmp    $0x2f,%dil
sete   %al
ret

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

LLVM IR (-O2):
define i32 @find_slash(i8 signext %0) {
%2 = icmp eq i8 %0, 47
%3 = zext i1 %2 to i32
ret i32 %3
}
int PortAddress(unsigned int channel, unsigned char reg) {
  unsigned int channelOffset = 0x20;
  unsigned int regDelta = 4;
  return (0xbd000000 + (channel * channelOffset) + (reg * regDelta));
}


x86 assembly (clang, -O0):
<PortAddress>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
movl   $0x20,-0xc(%rbp)
movl   $0x4,-0x10(%rbp)
mov    -0x4(%rbp),%eax
imul   -0xc(%rbp),%eax
add    $0xbd000000,%eax
movzbl -0x5(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<PortAddress>:
shl    $0x5,%edi
lea    (%rdi,%rsi,4),%eax
add    $0xbd000000,%eax
ret

LLVM IR (-O0):
define i32 @PortAddress(i32 %0, i8 zeroext %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8 %1, i8* %4
store i32 32, i32* %5
store i32 4, i32* %6
%7 = load i32, i32* %3
%8 = load i32, i32* %5
%9 = mul i32 %7, %8
%10 = add i32 -1124073472, %9
%11 = load i8, i8* %4
%12 = zext i8 %11 to i32
%13 = load i32, i32* %6
%14 = mul i32 %12, %13
%15 = add i32 %10, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @PortAddress(i32 %0, i8 zeroext %1) {
%3 = shl i32 %0, 5
%4 = add i32 %3, -1124073472
%5 = zext i8 %1 to i32
%6 = shl nuw nsw i32 %5, 2
%7 = add i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ glFlush();
void glFinish() { glFlush(); }


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

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

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

LLVM IR (-O2):
define void @glFinish() {
%1 = tail call i32 (...) @glFlush()
ret void
}