xunge/DecIR huggingface dataset:
const char *get_asm_reg(int size) {
  switch (size) {
  case 1:
    return "al";
  case 2:
    return "ax";
  case 4:
    return "eax";
  default:
    return "xxx";
  }
}


x86 assembly (clang, -O0):
<get_asm_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     113d <get_asm_reg+0x3d>
jmp    111b <get_asm_reg+0x1b>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     114d <get_asm_reg+0x4d>
jmp    112c <get_asm_reg+0x2c>
mov    -0x10(%rbp),%eax
sub    $0x4,%eax
je     115d <get_asm_reg+0x5d>
jmp    116d <get_asm_reg+0x6d>
lea    0xebc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <get_asm_reg+0x78>
lea    0xeb0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <get_asm_reg+0x78>
lea    0xe9f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <get_asm_reg+0x78>
lea    0xe93(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_asm_reg>:
add    $0xffffffff,%edi
cmp    $0x3,%edi
ja     111a <get_asm_reg+0x1a>
movslq %edi,%rax
lea    0xefa(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0xee6(%rip),%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"al\00"
@.str.1 = [3 x i8] c"ax\00"
@.str.2 = [4 x i8] c"eax\00"
@.str.3 = [4 x i8] c"xxx\00"
define i8* @get_asm_reg(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 1, label %5
i32 2, label %6
i32 4, label %7
]
5: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2
br label %9
6: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %9
7: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %9
8: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %9
9: ; preds = %8, %7, %6, %5
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [3 x i8] c"al\00"
@.str.1 = [3 x i8] c"ax\00"
@.str.2 = [4 x i8] c"eax\00"
@.str.3 = [4 x i8] c"xxx\00"
@reltable.get_asm_reg = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str to i64), i64 ptrtoint ([4 x i32]* @reltable.get_asm_reg to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.get_asm_reg to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.get_asm_reg to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.get_asm_reg to i64)) to i32)]
define i8* @get_asm_reg(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 4
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.get_asm_reg to i8*), i64 %6)
br label %8
8: ; preds = %1, %4
%9 = phi i8* [ %7, %4 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), %1 ]
ret i8* %9
}
/* Type definitions */
typedef int /*<<< orphan*/ SSL_METHOD;

/* Variables and functions */
int /*<<< orphan*/ const *SSLv23_method();
const SSL_METHOD *TLS_method() { return SSLv23_method(); }


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

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

LLVM IR (-O0):
define i32* @TLS_method() {
%1 = call i32* (...) @SSLv23_method()
ret i32* %1
}

LLVM IR (-O2):
define i32* @TLS_method() {
%1 = tail call i32* (...) @SSLv23_method()
ret i32* %1
}
unsigned char STPV2_IsErrorResponse(unsigned short code) {
  return (((code & 0xF0) == 0x80) || ((code & 0xF0) == 0x90));
}


x86 assembly (clang, -O0):
<STPV2_IsErrorResponse>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%ecx
and    $0xf0,%ecx
mov    $0x1,%al
cmp    $0x80,%ecx
mov    %al,-0x3(%rbp)
je     113a <STPV2_IsErrorResponse+0x3a>
movzwl -0x2(%rbp),%eax
and    $0xf0,%eax
cmp    $0x90,%eax
sete   %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<STPV2_IsErrorResponse>:
and    $0xe0,%edi
cmp    $0x80,%edi
sete   %al
ret

LLVM IR (-O0):
define zeroext i8 @STPV2_IsErrorResponse(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 240
%6 = icmp eq i32 %5, 128
br i1 %6, label %12, label %7
7: ; preds = %1
%8 = load i16, i16* %2
%9 = zext i16 %8 to i32
%10 = and i32 %9, 240
%11 = icmp eq i32 %10, 144
br label %12
12: ; preds = %7, %1
%13 = phi i1 [ true, %1 ], [ %11, %7 ]
%14 = zext i1 %13 to i32
%15 = trunc i32 %14 to i8
ret i8 %15
}

LLVM IR (-O2):
define zeroext i8 @STPV2_IsErrorResponse(i16 zeroext %0) {
%2 = and i16 %0, 224
%3 = icmp eq i16 %2, 128
%4 = zext i1 %3 to i8
ret i8 %4
}
int exynos_tmu_add_notifier(struct notifier_block *n) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.notifier_block = type opaque
define i32 @exynos_tmu_add_notifier(%struct.notifier_block* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ f();
int main(void) {
  while (1)
    f();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <f@plt>
jmp    111f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <f@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %2
%3 = call i32 (...) @f()
br label %2
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 (...) @f()
br label %1
}
char *md_rep_ext(int term) {
  switch (term) {
  case 0:
    return ("txt");
    break;
  case 1:
    return ("html");
    break;
  case 2:
    return ("tex");
    break;
  }
  return ("txt");
}


x86 assembly (clang, -O0):
<md_rep_ext>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     113c <md_rep_ext+0x3c>
jmp    111a <md_rep_ext+0x1a>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     114c <md_rep_ext+0x4c>
jmp    112b <md_rep_ext+0x2b>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     115c <md_rep_ext+0x5c>
jmp    116c <md_rep_ext+0x6c>
lea    0xebd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1177 <md_rep_ext+0x77>
lea    0xeb1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1177 <md_rep_ext+0x77>
lea    0xea6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1177 <md_rep_ext+0x77>
lea    0xe8d(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<md_rep_ext>:
cmp    $0x1,%edi
lea    0xefa(%rip),%rax
lea    0xeef(%rip),%rcx
cmove  %rax,%rcx
cmp    $0x2,%edi
lea    0xeea(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"txt\00"
@.str.1 = [5 x i8] c"html\00"
@.str.2 = [4 x i8] c"tex\00"
define i8* @md_rep_ext(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
]
5: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2
br label %9
6: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %9
7: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %9
8: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2
br label %9
9: ; preds = %8, %7, %6, %5
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [4 x i8] c"txt\00"
@.str.1 = [5 x i8] c"html\00"
@.str.2 = [4 x i8] c"tex\00"
define i8* @md_rep_ext(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
%4 = icmp eq i32 %0, 2
%5 = select i1 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %3
ret i8* %5
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ die_out_of_memory();
void *xcalloc(size_t nmemb, size_t size) {
  void *p = calloc(nmemb, size);
  if (!p)
    die_out_of_memory();
  return p;
}


x86 assembly (clang, -O0):
<xcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1153 <xcalloc+0x33>
mov    $0x0,%al
call   1040 <die_out_of_memory@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcalloc>:
push   %rbx
call   1030 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <xcalloc+0x15>
xor    %eax,%eax
call   1040 <die_out_of_memory@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @xcalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i8* @calloc(i64 %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = call i32 (...) @die_out_of_memory()
br label %13
13: ; preds = %11, %2
%14 = load i8*, i8** %5
ret i8* %14
}

LLVM IR (-O2):
define noalias i8* @xcalloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @die_out_of_memory()
br label %7
7: ; preds = %5, %2
ret i8* %3
}
void gtk_button_new_from_stock() {}


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

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

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

LLVM IR (-O2):
define void @gtk_button_new_from_stock() {
ret void
}
/* Variables and functions */
char *inventory_id_get(unsigned int);
char *xiag_module_inventory_id(void *handle, unsigned int item) {
  (void)handle;
  return inventory_id_get(item);
}


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

x86 assembly (clang, -O2):
<xiag_module_inventory_id>:
mov    %esi,%edi
jmp    1030 <inventory_id_get@plt>

LLVM IR (-O0):
define i8* @xiag_module_inventory_id(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 i8* @inventory_id_get(i32 %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @xiag_module_inventory_id(i8* nocapture readnone %0, i32 %1) {
%3 = tail call i8* @inventory_id_get(i32 %1)
ret i8* %3
}
/* Variables and functions */
long double log(long double);
long double fun_log(long double a) { return log(a); }


x86 assembly (clang, -O0):
<fun_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <log@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun_log>:
jmp    1030 <log@plt>

LLVM IR (-O0):
define x86_fp80 @fun_log(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call x86_fp80 @log(x86_fp80 %3)
ret x86_fp80 %4
}

LLVM IR (-O2):
define x86_fp80 @fun_log(x86_fp80 %0) {
%2 = tail call x86_fp80 @log(x86_fp80 %0)
ret x86_fp80 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(double *, int /*<<< orphan*/ *, int);
double copy_di(uint64_t x) {
  double f;
  memcpy(&f, &x, 8);
  return f;
}


x86 assembly (clang, -O0):
<copy_di>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x8,%edx
call   1030 <memcpy@plt>
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_di>:
sub    $0x18,%rsp
mov    %edi,0xc(%rsp)
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
mov    $0x8,%edx
call   1030 <memcpy@plt>
movsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @copy_di(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
%4 = call i32 @memcpy(double* %3, i32* %2, i32 8)
%5 = load double, double* %3
ret double %5
}

LLVM IR (-O2):
define double @copy_di(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
%4 = bitcast double* %3 to i8*
%5 = call i32 @memcpy(double* %3, i32* %2, i32 8)
%6 = load double, double* %3
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ modprobe(char const *);
void load_modules(const char *module_list[]) {
  int i;
  for (i = 0; module_list[i]; i++)
    modprobe(module_list[i]);
}


x86 assembly (clang, -O0):
<load_modules>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1155 <load_modules+0x45>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <modprobe@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <load_modules+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_modules>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1131 <load_modules+0x21>
add    $0x8,%rbx
call   1030 <modprobe@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1120 <load_modules+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @load_modules(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %10, %4 ], [ %2, %1 ]
%7 = tail call i32 @modprobe(i8* %6)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds i8*, i8** %0, i64 %8
%10 = load i8*, i8** %9
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int i;
  for (i = 0; i <= 255; i++) {
    printf("%d -> %c\n", i, i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xff,-0x8(%rbp)
jg     1153 <main+0x43>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xee3(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x100,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"%d -> %c\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 256
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
/* Variables and functions */
scalar_t__ getchar();
int /*<<< orphan*/ printf(char *);
void fun() {
  printf("fun() starts \n");
  printf("Press enter to stop fun \n");
  while (1) {
    if (getchar())
      break;
  }
  printf("fun() ends \n");
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
cmp    $0x0,%rax
je     1152 <fun+0x32>
jmp    1157 <fun+0x37>
jmp    113c <fun+0x1c>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
test   %rax,%rax
je     1140 <fun+0x20>
lea    0xed4(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"fun() starts \0A\00"
@.str.1 = [26 x i8] c"Press enter to stop fun \0A\00"
@.str.2 = [13 x i8] c"fun() ends \0A\00"
define void @fun() {
%1 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %3
3: ; preds = %0, %7
%4 = call i64 (...) @getchar()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %3
br label %8
7: ; preds = %3
br label %3
8: ; preds = %6
%9 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [14 x i8] c"fun() starts \00"
@str.3 = [25 x i8] c"Press enter to stop fun \00"
@str.4 = [12 x i8] c"fun() ends \00"
define void @fun() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.3, i64 0, i64 0))
br label %3
3: ; preds = %3, %0
%4 = tail call i64 (...) @getchar()
%5 = icmp eq i64 %4, 0
br i1 %5, label %3, label %6
6: ; preds = %3
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
bool IsUpperLimitSwitchOpen(void) { return true; }


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

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

LLVM IR (-O0):
define i32 @IsUpperLimitSwitchOpen() {
ret i32 1
}

LLVM IR (-O2):
define i32 @IsUpperLimitSwitchOpen() {
ret i32 1
}
int fun184() { return 184; }


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

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

LLVM IR (-O0):
define i32 @fun184() {
ret i32 184
}

LLVM IR (-O2):
define i32 @fun184() {
ret i32 184
}
/* Variables and functions */
int /*<<< orphan*/ SIGABRT;
int /*<<< orphan*/ fork();
int /*<<< orphan*/ raise(int /*<<< orphan*/);
void dump_core(void) {
  if (!fork()) {
    raise(SIGABRT);
  }
}


x86 assembly (clang, -O0):
<dump_core>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <fork@plt>
cmp    $0x0,%eax
jne    1142 <dump_core+0x22>
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_core>:
push   %rax
xor    %eax,%eax
call   1040 <fork@plt>
test   %eax,%eax
je     112e <dump_core+0xe>
pop    %rax
ret
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1030 <raise@plt>

LLVM IR (-O0):
@SIGABRT = global i32 0
define void @dump_core() {
%1 = call i32 (...) @fork()
%2 = icmp ne i32 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = load i32, i32* @SIGABRT
%5 = call i32 @raise(i32 %4)
br label %6
6: ; preds = %3, %0
ret void
}

LLVM IR (-O2):
@SIGABRT = global i32 0
define void @dump_core() {
%1 = tail call i32 (...) @fork()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = load i32, i32* @SIGABRT
%5 = tail call i32 @raise(i32 %4)
br label %6
6: ; preds = %3, %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ SPI_IOC_WR_MODE;
scalar_t__ ioctl(int, int /*<<< orphan*/, int /*<<< orphan*/ *);
int SPI_setMode(int spidev_fd, uint8_t mode) {
  if (ioctl(spidev_fd, SPI_IOC_WR_MODE, &mode) < 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<SPI_setMode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rdx
call   1030 <ioctl@plt>
cmp    $0x0,%rax
jge    1149 <SPI_setMode+0x39>
movl   $0xffffffff,-0x4(%rbp)
jmp    1150 <SPI_setMode+0x40>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SPI_setMode>:
push   %rax
mov    %esi,0x4(%rsp)
mov    0x2ec4(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rdx
call   1030 <ioctl@plt>
sar    $0x3f,%rax
pop    %rcx
ret

LLVM IR (-O0):
@SPI_IOC_WR_MODE = global i32 0
define i32 @SPI_setMode(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* @SPI_IOC_WR_MODE
%8 = call i64 @ioctl(i32 %6, i32 %7, i32* %5)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 -1, i32* %3
br label %12
11: ; preds = %2
store i32 0, i32* %3
br label %12
12: ; preds = %11, %10
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@SPI_IOC_WR_MODE = global i32 0
define i32 @SPI_setMode(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = load i32, i32* @SPI_IOC_WR_MODE
%5 = call i64 @ioctl(i32 %0, i32 %4, i32* %3)
%6 = ashr i64 %5, 63
%7 = trunc i64 %6 to i32
ret i32 %7
}
/* Type definitions */
typedef int nitems;

/* Variables and functions */
int /*<<< orphan*/ repairheap(void *, size_t, size_t, size_t,
                              int (*)(void const *, void const *));
void heapify(void *base, size_t nitems, size_t size,
             int (*compar)(const void *, const void *)) {
  size_t i = (((nitems)-2) / 2) + 1;
  for (; i > 0; i--) {
    repairheap(base, nitems, size, i - 1, compar);
  }
}


x86 assembly (clang, -O0):
<heapify>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
sub    $0x2,%rax
shr    $0x1,%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jbe    1175 <heapify+0x65>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x28(%rbp),%rcx
sub    $0x1,%rcx
mov    -0x20(%rbp),%r8
call   1030 <repairheap@plt>
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
jmp    113c <heapify+0x2c>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<heapify>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r13
mov    %rdi,%r12
lea    -0x2(%rsi),%rbx
shr    %rbx
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
mov    %rbx,%rcx
mov    %r14,%r8
call   1030 <repairheap@plt>
add    $0xffffffffffffffff,%rbx
jb     1130 <heapify+0x20>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @heapify(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*)* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32 (i8*, i8*)*
%9 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i32 (i8*, i8*)* %3, i32 (i8*, i8*)** %8
%10 = load i64, i64* %6
%11 = sub i64 %10, 2
%12 = udiv i64 %11, 2
%13 = add i64 %12, 1
store i64 %13, i64* %9
br label %14
14: ; preds = %25, %4
%15 = load i64, i64* %9
%16 = icmp ugt i64 %15, 0
br i1 %16, label %17, label %28
17: ; preds = %14
%18 = load i8*, i8** %5
%19 = load i64, i64* %6
%20 = load i64, i64* %7
%21 = load i64, i64* %9
%22 = sub i64 %21, 1
%23 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %8
%24 = call i32 @repairheap(i8* %18, i64 %19, i64 %20, i64 %22, i32 (i8*, i8*)* %23)
br label %25
25: ; preds = %17
%26 = load i64, i64* %9
%27 = add i64 %26, -1
store i64 %27, i64* %9
br label %14
28: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @heapify(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*)* %3) {
%5 = add i64 %1, -2
%6 = lshr i64 %5, 1
%7 = add nuw i64 %6, 1
br label %8
8: ; preds = %4, %8
%9 = phi i64 [ %7, %4 ], [ %10, %8 ]
%10 = add i64 %9, -1
%11 = tail call i32 @repairheap(i8* %0, i64 %1, i64 %2, i64 %10, i32 (i8*, i8*)* %3)
%12 = icmp eq i64 %10, 0
br i1 %12, label %13, label %8
13: ; preds = %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
char *replace_p(char *, char *, char *);
int main() {
  char *result = replace_p("this is a simple program!", "simple", "sample");
  printf("result:%s\n", result);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    0xee4(%rip),%rsi
lea    0xee4(%rip),%rdx
call   1030 <replace_p@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed7(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xeeb(%rip),%rsi
lea    0xeeb(%rip),%rdx
call   1030 <replace_p@plt>
lea    0xee6(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"this is a simple program!\00"
@.str.1 = [7 x i8] c"simple\00"
@.str.2 = [7 x i8] c"sample\00"
@.str.3 = [11 x i8] c"result:%s\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = call i8* @replace_p(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"this is a simple program!\00"
@.str.1 = [7 x i8] c"simple\00"
@.str.2 = [7 x i8] c"sample\00"
@.str.3 = [11 x i8] c"result:%s\0A\00"
define i32 @main() {
%1 = tail call i8* @replace_p(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ DATA_draw();
int /*<<< orphan*/ LibraryHeader(char *, char *);
int /*<<< orphan*/ STARTUP_draw();
LIBRARY_draw() {
  LibraryHeader("draw", "Sat Feb  1 10:41:40 2014 ");
  DATA_draw();
  STARTUP_draw();
}


x86 assembly (clang, -O0):
<LIBRARY_draw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xebf(%rip),%rsi
call   1040 <LibraryHeader@plt>
mov    $0x0,%al
call   1050 <DATA_draw@plt>
mov    $0x0,%al
call   1030 <STARTUP_draw@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LIBRARY_draw>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xec6(%rip),%rsi
call   1040 <LibraryHeader@plt>
xor    %eax,%eax
call   1050 <DATA_draw@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <STARTUP_draw@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"draw\00"
@.str.1 = [26 x i8] c"Sat Feb 1 10:41:40 2014 \00"
define i32 @LIBRARY_draw() {
%1 = alloca i32
%2 = call i32 @LibraryHeader(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (...) @DATA_draw()
%4 = call i32 (...) @STARTUP_draw()
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
@.str = [5 x i8] c"draw\00"
@.str.1 = [26 x i8] c"Sat Feb 1 10:41:40 2014 \00"
define i32 @LIBRARY_draw() {
%1 = tail call i32 @LibraryHeader(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (...) @DATA_draw()
%3 = tail call i32 (...) @STARTUP_draw()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() { printf("Hello,World!\n"); }


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

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

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

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


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

x86 assembly (clang, -O2):
<tcp_tx_reset>:
push   %rax
xor    %eax,%eax
call   1040 <tcp_fix_endian@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <ip_mirror@plt>

LLVM IR (-O0):
define void @tcp_tx_reset() {
%1 = call i32 (...) @tcp_fix_endian()
%2 = call i32 (...) @ip_mirror()
ret void
}

LLVM IR (-O2):
define void @tcp_tx_reset() {
%1 = tail call i32 (...) @tcp_fix_endian()
%2 = tail call i32 (...) @ip_mirror()
ret void
}
/* Variables and functions */
int scanf(char *, int *, int *);
int get_coordinates(int *x, int *y) { return scanf(" %d %d", x, y); }


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

x86 assembly (clang, -O2):
<get_coordinates>:
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
jmp    1030 <scanf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c" %d %d\00"
define i32 @get_coordinates(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 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %5, i32* %6)
ret i32 %7
}

LLVM IR (-O2):
@.str = [7 x i8] c" %d %d\00"
define i32 @get_coordinates(i32* %0, i32* %1) {
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %0, i32* %1)
ret i32 %3
}
/* Variables and functions */
int roi_get_sensor_response_bump_l(char *);
int roi_get_stream_response_bump_l(char *buff) {
  if (buff[2] == 0) {
    return roi_get_sensor_response_bump_l(&buff[3]);
  }
  if (buff[2] == 6) {
    return roi_get_sensor_response_bump_l(&buff[3]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<roi_get_stream_response_bump_l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x0,%eax
jne    1142 <roi_get_stream_response_bump_l+0x32>
mov    -0x10(%rbp),%rdi
add    $0x3,%rdi
call   1030 <roi_get_sensor_response_bump_l@plt>
mov    %eax,-0x4(%rbp)
jmp    116f <roi_get_stream_response_bump_l+0x5f>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x6,%eax
jne    1168 <roi_get_stream_response_bump_l+0x58>
mov    -0x10(%rbp),%rdi
add    $0x3,%rdi
call   1030 <roi_get_sensor_response_bump_l@plt>
mov    %eax,-0x4(%rbp)
jmp    116f <roi_get_stream_response_bump_l+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roi_get_stream_response_bump_l>:
mov    0x2(%rdi),%al
cmp    $0x6,%al
je     111b <roi_get_stream_response_bump_l+0xb>
test   %al,%al
jne    1124 <roi_get_stream_response_bump_l+0x14>
add    $0x3,%rdi
jmp    1030 <roi_get_sensor_response_bump_l@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @roi_get_stream_response_bump_l(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 2
%3 = load i8, i8* %2
switch i8 %3, label %7 [
i8 0, label %4
i8 6, label %4
]
4: ; preds = %1, %1
%5 = getelementptr inbounds i8, i8* %0, i64 3
%6 = tail call i32 @roi_get_sensor_response_bump_l(i8* %5)
br label %7
7: ; preds = %4, %1
%8 = phi i32 [ 0, %1 ], [ %6, %4 ]
ret i32 %8
}
/* Variables and functions */
char *corta_string(char *);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
int main(void) {
  int len = 0;
  char *s = "Campos Verdes";
  len = strlen(s);
  if (len > 0) {
    s = corta_string(s);
    printf("%s\n", s);
  } else
    printf("El String debe tener mas de un caracter\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeb3(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    118b <main+0x5b>
mov    -0x10(%rbp),%rdi
call   1050 <corta_string@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1199 <main+0x69>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1152 <main+0x22>
lea    0xeb8(%rip),%rdi
call   1050 <corta_string@plt>
mov    %rax,%rdi
jmp    1159 <main+0x29>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Campos Verdes\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [41 x i8] c"El String debe tener mas de un caracter\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 0, i32* %1
store i32 0, i32* %2
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @strlen(i8* %4)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %0
%9 = load i8*, i8** %3
%10 = call i8* @corta_string(i8* %9)
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %11)
br label %15
13: ; preds = %0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Campos Verdes\00"
@str = [40 x i8] c"El String debe tener mas de un caracter\00"
define i32 @main() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = icmp sgt i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i8* @corta_string(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %0, %3
%6 = phi i8* [ %4, %3 ], [ getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0), %0 ]
%7 = tail call i32 @puts(i8* dereferenceable(1) %6)
ret i32 0
}
/* Variables and functions */
char tolower(char);
void s_tolower(char *upper, unsigned int len) {
  unsigned int i;
  for (i = 0; i < len; i++) {
    upper[i] = tolower(upper[i]);
  }
}


x86 assembly (clang, -O0):
<s_tolower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    115c <s_tolower+0x4c>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   1030 <tolower@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <s_tolower+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_tolower>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
je     1147 <s_tolower+0x37>
mov    %rdi,%r15
mov    %esi,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%edi
call   1030 <tolower@plt>
mov    %al,(%r15,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1130 <s_tolower+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @s_tolower(i8* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = tail call signext i8 @tolower(i8 signext %9)
store i8 %10, i8* %8
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
void init_buzzer(void) {
  (*(volatile unsigned int *)(0x7F0080A0)) &= ~(3 << 30);
  (*(volatile unsigned int *)(0x7F0080A0)) |= (1 << 30);
  (*(volatile unsigned int *)(0x7F0080A8)) &= ~(3 << 30);
  return;
}


x86 assembly (clang, -O0):
<init_buzzer>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7f0080a0,%eax
mov    (%rax),%ecx
and    $0x3fffffff,%ecx
mov    $0x7f0080a0,%eax
mov    %ecx,(%rax)
mov    $0x7f0080a0,%eax
mov    (%rax),%ecx
or     $0x40000000,%ecx
mov    $0x7f0080a0,%eax
mov    %ecx,(%rax)
mov    $0x7f0080a8,%eax
mov    (%rax),%ecx
and    $0x3fffffff,%ecx
mov    $0x7f0080a8,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_buzzer>:
andl   $0x3fffffff,0x7f0080a0
ff ff ff 3f
orl    $0x40000000,0x7f0080a0
andl   $0x3fffffff,0x7f0080a8
ff ff ff 3f
ret

LLVM IR (-O0):
define void @init_buzzer() {
%1 = load volatile i32, i32* inttoptr (i64 2130739360 to i32*)
%2 = and i32 %1, 1073741823
store volatile i32 %2, i32* inttoptr (i64 2130739360 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 2130739360 to i32*)
%4 = or i32 %3, 1073741824
store volatile i32 %4, i32* inttoptr (i64 2130739360 to i32*)
%5 = load volatile i32, i32* inttoptr (i64 2130739368 to i32*)
%6 = and i32 %5, 1073741823
store volatile i32 %6, i32* inttoptr (i64 2130739368 to i32*)
ret void
}

LLVM IR (-O2):
define void @init_buzzer() {
%1 = load volatile i32, i32* inttoptr (i64 2130739360 to i32*)
%2 = and i32 %1, 1073741823
store volatile i32 %2, i32* inttoptr (i64 2130739360 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 2130739360 to i32*)
%4 = or i32 %3, 1073741824
store volatile i32 %4, i32* inttoptr (i64 2130739360 to i32*)
%5 = load volatile i32, i32* inttoptr (i64 2130739368 to i32*)
%6 = and i32 %5, 1073741823
store volatile i32 %6, i32* inttoptr (i64 2130739368 to i32*)
ret void
}
/* Variables and functions */
int powf(float, float);
int gamma_correct(int v, float gamma) {
  v = (int)(powf((float)v / 255.0f, gamma) * 255);
  if (v > 255)
    v = 255;
  return (v);
}


x86 assembly (clang, -O0):
<gamma_correct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xed3(%rip),%xmm1
divss  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <powf@plt>
imul   $0xff,%eax,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0xff,-0x4(%rbp)
jle    1158 <gamma_correct+0x48>
movl   $0xff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gamma_correct>:
push   %rax
cvtsi2ss %edi,%xmm1
movaps %xmm0,%xmm2
divss  0xee0(%rip),%xmm1
movaps %xmm1,%xmm0
movaps %xmm2,%xmm1
call   1030 <powf@plt>
mov    %eax,%ecx
shl    $0x8,%ecx
sub    %eax,%ecx
cmp    $0xff,%ecx
mov    $0xff,%eax
cmovl  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @gamma_correct(i32 %0, float %1) {
%3 = alloca i32
%4 = alloca float
store i32 %0, i32* %3
store float %1, float* %4
%5 = load i32, i32* %3
%6 = sitofp i32 %5 to float
%7 = fdiv float %6, 2.550000e+02
%8 = load float, float* %4
%9 = call i32 @powf(float %7, float %8)
%10 = mul nsw i32 %9, 255
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 255
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 255, i32* %3
br label %14
14: ; preds = %13, %2
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @gamma_correct(i32 %0, float %1) {
%3 = sitofp i32 %0 to float
%4 = fdiv float %3, 2.550000e+02
%5 = tail call i32 @powf(float %4, float %1)
%6 = mul nsw i32 %5, 255
%7 = icmp slt i32 %6, 255
%8 = select i1 %7, i32 %6, i32 255
ret i32 %8
}
/* Variables and functions */
void *cabs(long);
long double cabsl(long double);
void tst_notcomplex(int *pi, long *pl, long double *pld) {
  *pi = cabs(*pi);
  *pl = cabs(*pl);
  *pld = cabsl(*pld);
}


x86 assembly (clang, -O0):
<tst_notcomplex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq (%rax),%rdi
call   1030 <cabs@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <cabs@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
fldt   (%rax)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <cabsl@plt>
mov    -0x18(%rbp),%rax
fstpt  (%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tst_notcomplex>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movslq (%rdi),%rdi
call   1030 <cabs@plt>
mov    %eax,(%rbx)
mov    (%r15),%rdi
call   1030 <cabs@plt>
mov    %rax,(%r15)
fldt   (%r14)
fstpt  (%rsp)
call   1040 <cabsl@plt>
fstpt  (%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @tst_notcomplex(i32* %0, i64* %1, x86_fp80* %2) {
%4 = alloca i32*
%5 = alloca i64*
%6 = alloca x86_fp80*
store i32* %0, i32** %4
store i64* %1, i64** %5
store x86_fp80* %2, x86_fp80** %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = sext i32 %8 to i64
%10 = call i8* @cabs(i64 %9)
%11 = ptrtoint i8* %10 to i32
%12 = load i32*, i32** %4
store i32 %11, i32* %12
%13 = load i64*, i64** %5
%14 = load i64, i64* %13
%15 = call i8* @cabs(i64 %14)
%16 = ptrtoint i8* %15 to i64
%17 = load i64*, i64** %5
store i64 %16, i64* %17
%18 = load x86_fp80*, x86_fp80** %6
%19 = load x86_fp80, x86_fp80* %18
%20 = call x86_fp80 @cabsl(x86_fp80 %19)
%21 = load x86_fp80*, x86_fp80** %6
store x86_fp80 %20, x86_fp80* %21
ret void
}

LLVM IR (-O2):
define void @tst_notcomplex(i32* nocapture %0, i64* nocapture %1, x86_fp80* nocapture %2) {
%4 = load i32, i32* %0
%5 = sext i32 %4 to i64
%6 = tail call i8* @cabs(i64 %5)
%7 = ptrtoint i8* %6 to i64
%8 = trunc i64 %7 to i32
store i32 %8, i32* %0
%9 = load i64, i64* %1
%10 = tail call i8* @cabs(i64 %9)
%11 = ptrtoint i8* %10 to i64
store i64 %11, i64* %1
%12 = load x86_fp80, x86_fp80* %2
%13 = tail call x86_fp80 @cabsl(x86_fp80 %12)
store x86_fp80 %13, x86_fp80* %2
ret void
}
int fn3(int x, int y) { return x | ~(y | x); }


x86 assembly (clang, -O0):
<fn3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
or     -0x4(%rbp),%ecx
xor    $0xffffffff,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn3>:
mov    %esi,%eax
not    %eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @fn3(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 = load i32, i32* %3
%8 = or i32 %6, %7
%9 = xor i32 %8, -1
%10 = or i32 %5, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @fn3(i32 %0, i32 %1) {
%3 = xor i32 %1, -1
%4 = or i32 %3, %0
ret i32 %4
}