xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ Sys_failure(char *);
int on_exit(void (*)(int, void *), void *);
void On_exit(void (*function)(int, void *), void *arg) {
  int retval;
  retval = on_exit(function, arg);
  if (retval != 0)
    Sys_failure("on_exit\n");
}


x86 assembly (clang, -O0):
<On_exit>:
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 <on_exit@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1156 <On_exit+0x36>
lea    0xeaf(%rip),%rdi
call   1040 <Sys_failure@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<On_exit>:
push   %rax
call   1030 <on_exit@plt>
test   %eax,%eax
je     1137 <On_exit+0x17>
lea    0xecf(%rip),%rdi
pop    %rax
jmp    1040 <Sys_failure@plt>
pop    %rax
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"on_exit\0A\00"
define void @On_exit(void (i32, i8*)* %0, i8* %1) {
%3 = tail call i32 @on_exit(void (i32, i8*)* %0, i8* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @Sys_failure(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret void
}
void PWM_Servo_SaveConfig(void) {}


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

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

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

LLVM IR (-O2):
define void @PWM_Servo_SaveConfig() {
ret void
}
/* Variables and functions */
void *dlsym(void *, char const *);
void *g_get_proc_address(long lib, const char *name) {
  if (lib == 0) {
    return 0;
  }
  return dlsym((void *)lib, name);
}


x86 assembly (clang, -O0):
<g_get_proc_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1138 <g_get_proc_address+0x28>
movq   $0x0,-0x8(%rbp)
jmp    1149 <g_get_proc_address+0x39>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <dlsym@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_get_proc_address>:
test   %rdi,%rdi
je     111a <g_get_proc_address+0xa>
jmp    1030 <dlsym@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @g_get_proc_address(i64 %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %4
store i8* %1, i8** %5
%6 = load i64, i64* %4
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store i8* null, i8** %3
br label %14
9: ; preds = %2
%10 = load i64, i64* %4
%11 = inttoptr i64 %10 to i8*
%12 = load i8*, i8** %5
%13 = call i8* @dlsym(i8* %11, i8* %12)
store i8* %13, i8** %3
br label %14
14: ; preds = %9, %8
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
define i8* @g_get_proc_address(i64 %0, i8* %1) {
%3 = icmp eq i64 %0, 0
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = inttoptr i64 %0 to i8*
%6 = tail call i8* @dlsym(i8* %5, i8* %1)
br label %7
7: ; preds = %2, %4
%8 = phi i8* [ %6, %4 ], [ null, %2 ]
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ kputc(unsigned char);
unsigned char sci_recv();
int kgetc(void) {
  unsigned char c = sci_recv();
  c = (c == '\r') ? '\n' : c;
  kputc(c);
  return c;
}


x86 assembly (clang, -O0):
<kgetc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <sci_recv@plt>
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0xd,%eax
jne    114c <kgetc+0x2c>
mov    $0xa,%eax
mov    %eax,-0x8(%rbp)
jmp    1153 <kgetc+0x33>
movzbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
call   1040 <kputc@plt>
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kgetc>:
push   %rbx
xor    %eax,%eax
call   1030 <sci_recv@plt>
cmp    $0xd,%al
movzbl %al,%eax
mov    $0xa,%ecx
cmovne %eax,%ecx
movzbl %cl,%ebx
mov    %ebx,%edi
call   1040 <kputc@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @kgetc() {
%1 = alloca i8
%2 = call zeroext i8 (...) @sci_recv()
store i8 %2, i8* %1
%3 = load i8, i8* %1
%4 = zext i8 %3 to i32
%5 = icmp eq i32 %4, 13
br i1 %5, label %6, label %7
6: ; preds = %0
br label %10
7: ; preds = %0
%8 = load i8, i8* %1
%9 = zext i8 %8 to i32
br label %10
10: ; preds = %7, %6
%11 = phi i32 [ 10, %6 ], [ %9, %7 ]
%12 = trunc i32 %11 to i8
store i8 %12, i8* %1
%13 = load i8, i8* %1
%14 = call i32 @kputc(i8 zeroext %13)
%15 = load i8, i8* %1
%16 = zext i8 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @kgetc() {
%1 = tail call zeroext i8 (...) @sci_recv()
%2 = icmp eq i8 %1, 13
%3 = select i1 %2, i8 10, i8 %1
%4 = tail call i32 @kputc(i8 zeroext %3)
%5 = zext i8 %3 to i32
ret i32 %5
}
/* Variables and functions */
int _get_load(char **, int);
int rfi_load_15min(char **s) { return _get_load(s, 3); }


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

x86 assembly (clang, -O2):
<rfi_load_15min>:
mov    $0x3,%esi
jmp    1030 <_get_load@plt>

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

LLVM IR (-O2):
define i32 @rfi_load_15min(i8** %0) {
%2 = tail call i32 @_get_load(i8** %0, i32 3)
ret i32 %2
}
void read_int_ref(int *p) { int x = *p; }


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

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

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

LLVM IR (-O2):
define void @read_int_ref(i32* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ uart_print_hex(unsigned int);
int /*<<< orphan*/ uart_printf(char *);
int /*<<< orphan*/ uart_puts(char *);
void handle_pabt(unsigned int lr) {
  uart_puts("\nPrefetch Abort");
  uart_printf("PC = 0x");
  uart_print_hex(lr);
  uart_puts("");
  while (1)
    ;
  return;
}


x86 assembly (clang, -O0):
<handle_pabt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1050 <uart_puts@plt>
lea    0xec2(%rip),%rdi
call   1030 <uart_printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <uart_print_hex@plt>
lea    0xead(%rip),%rdi
call   1050 <uart_puts@plt>
jmp    1167 <handle_pabt+0x37>

x86 assembly (clang, -O2):
<handle_pabt>:
push   %rbx
mov    %edi,%ebx
lea    0xec6(%rip),%rdi
call   1050 <uart_puts@plt>
lea    0xeca(%rip),%rdi
call   1030 <uart_printf@plt>
mov    %ebx,%edi
call   1040 <uart_print_hex@plt>
lea    0xeb6(%rip),%rdi
call   1050 <uart_puts@plt>
xchg   %ax,%ax
jmp    1160 <handle_pabt+0x30>

LLVM IR (-O0):
@.str = [16 x i8] c"\0APrefetch Abort\00"
@.str.1 = [8 x i8] c"PC = 0x\00"
@.str.2 = [1 x i8] zeroinitializer
define void @handle_pabt(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @uart_puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @uart_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* %2
%6 = call i32 @uart_print_hex(i32 %5)
%7 = call i32 @uart_puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %8
8: ; preds = %1, %8
br label %8
}

LLVM IR (-O2):
@.str = [16 x i8] c"\0APrefetch Abort\00"
@.str.1 = [8 x i8] c"PC = 0x\00"
@.str.2 = [1 x i8] zeroinitializer
define void @handle_pabt(i32 %0) {
%2 = tail call i32 @uart_puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @uart_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @uart_print_hex(i32 %0)
%5 = tail call i32 @uart_puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %6
6: ; preds = %1, %6
br label %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printbye() { printf("Goodbye\n"); }


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

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

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

LLVM IR (-O2):
@str = [8 x i8] c"Goodbye\00"
define void @printbye() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ appendCODE(int /*<<< orphan*/);
int /*<<< orphan*/ makeCODEinstanceof(char *, int /*<<< orphan*/ *);
void code_instanceof(char *arg) { appendCODE(makeCODEinstanceof(arg, NULL)); }


x86 assembly (clang, -O0):
<code_instanceof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <makeCODEinstanceof@plt>
mov    %eax,%edi
call   1030 <appendCODE@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<code_instanceof>:
push   %rax
xor    %esi,%esi
call   1040 <makeCODEinstanceof@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <appendCODE@plt>

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

LLVM IR (-O2):
define void @code_instanceof(i8* %0) {
%2 = tail call i32 @makeCODEinstanceof(i8* %0, i32* null)
%3 = tail call i32 @appendCODE(i32 %2)
ret void
}
int main(int argc, char **argv, char **envp) {
  extern void dummy();
  dummy();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1030 <dummy@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
tail call void (...) @dummy()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ show_result(char *);
char *skip_csi_2(char const *);
int /*<<< orphan*/ strcmp(char const *, char const *);
void report_ok(const char *ref, const char *tst) {
  if ((tst = skip_csi_2(tst)) == 0)
    tst = "?";
  show_result(!strcmp(ref, tst) ? "ok" : "failed");
}


x86 assembly (clang, -O0):
<report_ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <skip_csi_2@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1162 <report_ok+0x32>
lea    0xea2(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %cl
xor    $0xff,%cl
lea    0xe86(%rip),%rdi
lea    0xe7c(%rip),%rax
test   $0x1,%cl
cmovne %rax,%rdi
call   1040 <show_result@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report_ok>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1050 <skip_csi_2@plt>
test   %rax,%rax
lea    0xeba(%rip),%rsi
cmovne %rax,%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
lea    0xea7(%rip),%rax
lea    0xea3(%rip),%rdi
cmove  %rax,%rdi
pop    %rbx
jmp    1040 <show_result@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"?\00"
@.str.1 = [3 x i8] c"ok\00"
@.str.2 = [7 x i8] c"failed\00"
define void @report_ok(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i8* @skip_csi_2(i8* %5)
store i8* %6, i8** %4
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %9
8: ; preds = %2
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %4
br label %9
9: ; preds = %8, %2
%10 = load i8*, i8** %3
%11 = load i8*, i8** %4
%12 = call i32 @strcmp(i8* %10, i8* %11)
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
%15 = zext i1 %14 to i64
%16 = select i1 %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
%17 = call i32 @show_result(i8* %16)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"?\00"
@.str.1 = [3 x i8] c"ok\00"
@.str.2 = [7 x i8] c"failed\00"
define void @report_ok(i8* nocapture %0, i8* %1) {
%3 = tail call i8* @skip_csi_2(i8* %1)
%4 = icmp eq i8* %3, null
%5 = select i1 %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %3
%6 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %5)
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
%9 = tail call i32 @show_result(i8* %8)
ret void
}
int min0(a, b)
int a, b;
{
  if (a <= b)
    return (a);
  else
    return (b);
}


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

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

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

LLVM IR (-O2):
define i32 @min0(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
int f(int i, int j) {
  int b[2][2];
  if (&b[1][i] == &b[0][j])
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x20(%rbp),%rax
add    $0x8,%rax
movslq -0x8(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
lea    -0x20(%rbp),%rcx
movslq -0xc(%rbp),%rdx
shl    $0x2,%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jne    1141 <f+0x41>
movl   $0x1,-0x4(%rbp)
jmp    1148 <f+0x48>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movslq %edi,%rax
movslq %esi,%rcx
lea    0x8(,%rax,4),%rdx
shl    $0x2,%rcx
xor    %eax,%eax
cmp    %rcx,%rdx
sete   %al
ret

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

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1) {
%3 = sext i32 %0 to i64
%4 = sext i32 %1 to i64
%5 = shl nsw i64 %3, 2
%6 = add nsw i64 %5, 8
%7 = shl nsw i64 %4, 2
%8 = icmp eq i64 %6, %7
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int strcmp(char const *, char const *);
int oscap_strcmp(const char *s1, const char *s2) {
  if (s1 == NULL)
    s1 = "";
  if (s2 == NULL)
    s2 = "";
  return strcmp(s1, s2);
}


x86 assembly (clang, -O0):
<oscap_strcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1136 <oscap_strcmp+0x26>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114c <oscap_strcmp+0x3c>
lea    0xeb8(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oscap_strcmp>:
test   %rdi,%rdi
lea    0xee6(%rip),%rax
cmove  %rax,%rdi
test   %rsi,%rsi
cmove  %rax,%rsi
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @oscap_strcmp(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = select i1 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %0
%5 = icmp eq i8* %1, null
%6 = select i1 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %1
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
ret i32 %7
}
justrite(p, q, limit) char *p;
char *q;
int limit;
{
  int len;
  len = width(p);
  q = &q[limit - len];
  while (*p != '\0')
    *q++ = *p++;
}


x86 assembly (clang, -O0):
<justrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <width@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    -0x20(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     117c <justrite+0x6c>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    1145 <justrite+0x35>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<justrite>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <width@plt>
mov    (%rbx),%cl
test   %cl,%cl
je     1151 <justrite+0x41>
sub    %eax,%ebp
movslq %ebp,%rax
add    %rax,%r14
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %cl,(%r14,%rax,1)
movzbl 0x1(%rbx,%rax,1),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1140 <justrite+0x30>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @justrite(i8* %0, i8* nocapture writeonly %1, i32 %2) {
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @width to i32 (i8*, ...)*)(i8* %0)
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %19, label %7
7: ; preds = %3
%8 = sub nsw i32 %2, %4
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %1, i64 %9
br label %11
11: ; preds = %7, %11
%12 = phi i8 [ %17, %11 ], [ %5, %7 ]
%13 = phi i8* [ %15, %11 ], [ %0, %7 ]
%14 = phi i8* [ %16, %11 ], [ %10, %7 ]
%15 = getelementptr inbounds i8, i8* %13, i64 1
%16 = getelementptr inbounds i8, i8* %14, i64 1
store i8 %12, i8* %14
%17 = load i8, i8* %15
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %11
19: ; preds = %11, %3
ret i32 undef
}
const char *libbootimg_version_str(void) { return "0.2.3"; }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"0.2.3\00"
define i8* @libbootimg_version_str() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"0.2.3\00"
define i8* @libbootimg_version_str() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
int foo(int x) { return ~(x ^ 4); }


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

x86 assembly (clang, -O2):
<foo>:
mov    %edi,%eax
xor    $0xfffffffb,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = xor i32 %0, -5
ret i32 %2
}
/* Variables and functions */
unsigned int const jiffies_to_usecs(unsigned long);
__attribute__((always_)) unsigned long usecs_to_jiffies(const unsigned int u) {
  if (u > jiffies_to_usecs(((~0UL >> 1) - 1)))
    return ((~0UL >> 1) - 1);
  return (u + ((1000000L) / 250) - 1) / ((1000000L) / 250);
}


x86 assembly (clang, -O0):
<usecs_to_jiffies>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movabs $0x7ffffffffffffffe,%rdi
ff ff 7f
call   1030 <jiffies_to_usecs@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jbe    1150 <usecs_to_jiffies+0x40>
movabs $0x7ffffffffffffffe,%rax
ff ff 7f
mov    %rax,-0x8(%rbp)
jmp    116b <usecs_to_jiffies+0x5b>
mov    -0xc(%rbp),%eax
add    $0xfa0,%rax
sub    $0x1,%rax
mov    $0xfa0,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usecs_to_jiffies>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
movabs $0x7ffffffffffffffe,%rbx
ff ff 7f
mov    %rbx,%rdi
call   1030 <jiffies_to_usecs@plt>
cmp    %ebp,%eax
jb     1147 <usecs_to_jiffies+0x37>
mov    %ebp,%eax
add    $0xf9f,%rax
shr    $0x5,%rax
movabs $0x20c49ba5e353f7d,%rcx
49 0c 02
mul    %rcx
mov    %rdx,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i64 @usecs_to_jiffies(i32 %0) {
%2 = alloca i64
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 @jiffies_to_usecs(i64 9223372036854775806)
%6 = icmp ugt i32 %4, %5
br i1 %6, label %7, label %8
7: ; preds = %1
store i64 9223372036854775806, i64* %2
br label %14
8: ; preds = %1
%9 = load i32, i32* %3
%10 = zext i32 %9 to i64
%11 = add nsw i64 %10, 4000
%12 = sub nsw i64 %11, 1
%13 = sdiv i64 %12, 4000
store i64 %13, i64* %2
br label %14
14: ; preds = %8, %7
%15 = load i64, i64* %2
ret i64 %15
}

LLVM IR (-O2):
define i64 @usecs_to_jiffies(i32 %0) {
%2 = tail call i32 @jiffies_to_usecs(i64 9223372036854775806)
%3 = icmp ult i32 %2, %0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = zext i32 %0 to i64
%6 = add nuw nsw i64 %5, 3999
%7 = udiv i64 %6, 4000
br label %8
8: ; preds = %1, %4
%9 = phi i64 [ %7, %4 ], [ 9223372036854775806, %1 ]
ret i64 %9
}
int mult2(int val) { return (val * 2); }


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

x86 assembly (clang, -O2):
<mult2>:
lea    (%rdi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @mult2(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
/* Type definitions */
struct lifo {
  int dummy;
};

/* Variables and functions */
double pop(struct lifo *);
double opr_inv(struct lifo *stack) {
  double op = pop(stack);
  return 1 / op;
}


x86 assembly (clang, -O0):
<opr_inv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <pop@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  0xece(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opr_inv>:
push   %rax
call   1030 <pop@plt>
movsd  0xee2(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
%struct.lifo = type { i32 }
define double @opr_inv(%struct.lifo* %0) {
%2 = alloca %struct.lifo*
%3 = alloca double
store %struct.lifo* %0, %struct.lifo** %2
%4 = load %struct.lifo*, %struct.lifo** %2
%5 = call double @pop(%struct.lifo* %4)
store double %5, double* %3
%6 = load double, double* %3
%7 = fdiv double 1.000000e+00, %6
ret double %7
}

LLVM IR (-O2):
%struct.lifo = type { i32 }
define double @opr_inv(%struct.lifo* %0) {
%2 = tail call double @pop(%struct.lifo* %0)
%3 = fdiv double 1.000000e+00, %2
ret double %3
}
int ti_add_start(double const *options) {
  (void)options;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @ti_add_start(double* nocapture readnone %0) {
ret i32 0
}
int strcspn(s, reject)
register char *s;
register char *reject;
{
  register int count = 0;
  while (*s != '\0')
    if (index(reject, *s++) == 0)
      ++count;
    else
      return count;
  return count;
}


x86 assembly (clang, -O0):
<strcspn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     117a <strcspn+0x6a>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%esi
call   1030 <index@plt>
cmp    $0x0,%rax
jne    116a <strcspn+0x5a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1175 <strcspn+0x65>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1180 <strcspn+0x70>
jmp    1127 <strcspn+0x17>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcspn>:
push   %r15
push   %r14
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1150 <strcspn+0x40>
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <index@plt>
test   %rax,%rax
jne    1152 <strcspn+0x42>
movzbl 0x1(%r15,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <strcspn+0x20>
jmp    1152 <strcspn+0x42>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @strcspn(i8* nocapture %0, i8* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2, %12
%6 = phi i8 [ %15, %12 ], [ %3, %2 ]
%7 = phi i32 [ %14, %12 ], [ 0, %2 ]
%8 = phi i8* [ %13, %12 ], [ %0, %2 ]
%9 = sext i8 %6 to i32
%10 = tail call i8* @index(i8* %1, i32 %9)
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %17
12: ; preds = %5
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = add nuw nsw i32 %7, 1
%15 = load i8, i8* %13
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %5
17: ; preds = %5, %12, %2
%18 = phi i32 [ 0, %2 ], [ %14, %12 ], [ %7, %5 ]
ret i32 %18
}
/* Variables and functions */
unsigned int xatoull(char const *);
__attribute__((always_)) unsigned int xatou(const char *str) {
  return xatoull(str);
}


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

x86 assembly (clang, -O2):
<xatou>:
jmp    1030 <xatoull@plt>

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

LLVM IR (-O2):
define i32 @xatou(i8* %0) {
%2 = tail call i32 @xatoull(i8* %0)
ret i32 %2
}
void upper(char string[], int position) {
  if (string[position] < 'z' && string[position] > 'a') {
    string[position] -= 'a';
    string[position] += 'A';
  }
}


x86 assembly (clang, -O0):
<upper>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7a,%eax
jge    1159 <upper+0x59>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x61,%eax
jle    1159 <upper+0x59>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
sub    $0x61,%edx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
add    $0x41,%edx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<upper>:
movslq %esi,%rax
mov    (%rdi,%rax,1),%cl
lea    -0x62(%rcx),%edx
cmp    $0x17,%dl
ja     1114 <upper+0x14>
add    $0xe0,%cl
mov    %cl,(%rdi,%rax,1)
ret

LLVM IR (-O0):
define void @upper(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 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp slt i32 %10, 122
br i1 %11, label %12, label %37
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp sgt i32 %18, 97
br i1 %19, label %20, label %37
20: ; preds = %12
%21 = load i8*, i8** %3
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = sub nsw i32 %26, 97
%28 = trunc i32 %27 to i8
store i8 %28, i8* %24
%29 = load i8*, i8** %3
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = add nsw i32 %34, 65
%36 = trunc i32 %35 to i8
store i8 %36, i8* %32
br label %37
37: ; preds = %20, %12, %2
ret void
}

LLVM IR (-O2):
define void @upper(i8* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = add i8 %5, -98
%7 = icmp ult i8 %6, 24
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = add nsw i8 %5, -32
store i8 %9, i8* %4
br label %10
10: ; preds = %8, %2
ret void
}
/* Type definitions */
struct aiocb64 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int aio_fsync64(int op, struct aiocb64 *cb) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<aio_fsync64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ed6(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebd(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<aio_fsync64>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.aiocb64 = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @aio_fsync64(i32 %0, %struct.aiocb64* %1) {
%3 = alloca i32
%4 = alloca %struct.aiocb64*
store i32 %0, i32* %3
store %struct.aiocb64* %1, %struct.aiocb64** %4
%5 = load i32, i32* @ENOSYS
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.aiocb64 = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @aio_fsync64(i32 %0, %struct.aiocb64* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret i32 -1
}
int test_imm_14uint8_mem(unsigned char *val) {
  return ((*val) & (-0x14 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_14uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -20
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int fun248() { return 248; }


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

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

LLVM IR (-O0):
define i32 @fun248() {
ret i32 248
}

LLVM IR (-O2):
define i32 @fun248() {
ret i32 248
}
void change(int *a) {
  if (*a == 0)
    *a = 1;
  else
    *a = 0;
}


x86 assembly (clang, -O0):
<change>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1124 <change+0x24>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
jmp    112e <change+0x2e>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<change>:
xor    %eax,%eax
cmpl   $0x0,(%rdi)
sete   %al
mov    %eax,(%rdi)
ret

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

LLVM IR (-O2):
define void @change(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
store i32 %4, i32* %0
ret void
}
int unpacki16(unsigned char *buf) {
  unsigned int i2 = ((unsigned int)buf[0] << 8) | buf[1];
  int i;
  if (i2 <= 0x7fffu) {
    i = i2;
  } else {
    i = -1 - (unsigned int)(0xffffu - i2);
  }
  return i;
}


x86 assembly (clang, -O0):
<unpacki16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x7fff,-0xc(%rbp)
ja     1137 <unpacki16+0x37>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1149 <unpacki16+0x49>
mov    $0xffff,%ecx
sub    -0xc(%rbp),%ecx
mov    $0xffffffff,%eax
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unpacki16>:
movzwl (%rdi),%ecx
shl    $0x10,%ecx
bswap  %ecx
lea    -0x10000(%rcx),%eax
cmp    $0x8000,%ecx
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @unpacki16(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%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** %2
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = or i32 %9, %13
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = icmp ule i32 %15, 32767
br i1 %16, label %17, label %19
17: ; preds = %1
%18 = load i32, i32* %3
store i32 %18, i32* %4
br label %23
19: ; preds = %1
%20 = load i32, i32* %3
%21 = sub i32 65535, %20
%22 = sub i32 -1, %21
store i32 %22, i32* %4
br label %23
23: ; preds = %19, %17
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
define i32 @unpacki16(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
%9 = icmp ult i32 %8, 32768
%10 = or i32 %8, -65536
%11 = select i1 %9, i32 %8, i32 %10
ret i32 %11
}
struct keystate *isakmp_get_keystate(struct message *msg) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.keystate = type opaque
%struct.message = type opaque
define %struct.keystate* @isakmp_get_keystate(%struct.message* %0) {
%2 = alloca %struct.message*
store %struct.message* %0, %struct.message** %2
ret %struct.keystate* null
}

LLVM IR (-O2):
%struct.keystate = type opaque
%struct.message = type opaque
define noalias %struct.keystate* @isakmp_get_keystate(%struct.message* nocapture readnone %0) {
ret %struct.keystate* null
}
/* Variables and functions */
int /*<<< orphan*/ EBADF;
int /*<<< orphan*/ errno;
int isatty(int fd) {
  if (fd < 0) {
    errno = EBADF;
    return -1;
  }
  return fd <= 2;
}


x86 assembly (clang, -O0):
<isatty>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    112f <isatty+0x2f>
mov    0x2ec0(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebf(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    113e <isatty+0x3e>
cmpl   $0x2,-0x8(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isatty>:
test   %edi,%edi
js     110d <isatty+0xd>
xor    %eax,%eax
cmp    $0x3,%edi
setb   %al
ret
mov    0x2ec4(%rip),%rax
mov    (%rax),%eax
mov    0x2ec3(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@EBADF = global i32 0
@errno = global i32 0
define i32 @isatty(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i32, i32* @EBADF
store i32 %7, i32* @errno
store i32 -1, i32* %2
br label %12
8: ; preds = %1
%9 = load i32, i32* %3
%10 = icmp sle i32 %9, 2
%11 = zext i1 %10 to i32
store i32 %11, i32* %2
br label %12
12: ; preds = %8, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@EBADF = global i32 0
@errno = global i32 0
define i32 @isatty(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = load i32, i32* @EBADF
store i32 %4, i32* @errno
br label %8
5: ; preds = %1
%6 = icmp ult i32 %0, 3
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %5, %3
%9 = phi i32 [ -1, %3 ], [ %7, %5 ]
ret i32 %9
}
int test_imm_3Aint64_midword_reg(long long val) {
  return ((val >> 16) & (0x3A << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_3Aint64_midword_reg(i64 %0) {
%2 = and i64 %0, 3801088
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ write(int /*<<< orphan*/, char *, int);
void fini_2(void) { write(STDOUT_FILENO, "DSO fini array 2\n", 17); }


x86 assembly (clang, -O0):
<fini_2>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
mov    $0x11,%edx
call   1030 <write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fini_2>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
mov    $0x11,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@STDOUT_FILENO = global i32 0
@.str = [18 x i8] c"DSO fini array 2\0A\00"
define void @fini_2() {
%1 = load i32, i32* @STDOUT_FILENO
%2 = call i32 @write(i32 %1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 17)
ret void
}

LLVM IR (-O2):
@STDOUT_FILENO = global i32 0
@.str = [18 x i8] c"DSO fini array 2\0A\00"
define void @fini_2() {
%1 = load i32, i32* @STDOUT_FILENO
%2 = tail call i32 @write(i32 %1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 17)
ret void
}
/* Variables and functions */
int arith_div(int, int);
int arith_mod(int x, int y) { return x - arith_div(x, y); }


x86 assembly (clang, -O0):
<arith_mod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <arith_div@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arith_mod>:
push   %rbx
mov    %edi,%ebx
call   1030 <arith_div@plt>
sub    %eax,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @arith_mod(i32 %0, i32 %1) {
%3 = tail call i32 @arith_div(i32 %0, i32 %1)
%4 = sub nsw i32 %0, %3
ret i32 %4
}
main() {
  struct A {
    int i;
    int : 4;
  } a = {1, 59};
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    0xef5(%rip),%rax
mov    %rax,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.A = type { i32, i8 }
@__const.main.a = { i32, [4 x i8] } { i32 1, [4 x i8] undef }
define i32 @main() {
%1 = alloca %struct.A
%2 = bitcast %struct.A* %1 to i8*
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int td4_kad_validation(int encrypt_mode, int ukad, int akad) {
  int count = 0;
  if (ukad > 32 || akad > 12)
    count = 1;
  if (!encrypt_mode && (ukad || akad))
    count = 1;
  return count;
}


x86 assembly (clang, -O0):
<td4_kad_validation>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x20,-0x8(%rbp)
jg     1128 <td4_kad_validation+0x28>
cmpl   $0xc,-0xc(%rbp)
jle    112f <td4_kad_validation+0x2f>
movl   $0x1,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1154 <td4_kad_validation+0x54>
cmpl   $0x0,-0x8(%rbp)
jne    114d <td4_kad_validation+0x4d>
cmpl   $0x0,-0xc(%rbp)
je     1154 <td4_kad_validation+0x54>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<td4_kad_validation>:
cmp    $0x21,%esi
setge  %al
cmp    $0xd,%edx
setge  %cl
or     %al,%cl
test   %edi,%edi
sete   %al
or     %esi,%edx
setne  %dl
and    %al,%dl
or     %cl,%dl
movzbl %dl,%eax
ret

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

LLVM IR (-O2):
define i32 @td4_kad_validation(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 32
%5 = icmp sgt i32 %2, 12
%6 = or i1 %4, %5
%7 = icmp eq i32 %0, 0
%8 = or i32 %2, %1
%9 = icmp ne i32 %8, 0
%10 = and i1 %7, %9
%11 = or i1 %6, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ acos(int /*<<< orphan*/);
double glmDegd(int /*<<< orphan*/);
int /*<<< orphan*/ glmDotProduct2d(double const *, double const *);
double glmComputeNormalizedVectorAngle2dDeg(const double v1[2],
                                            const double v2[2]) {
  return glmDegd(acos(glmDotProduct2d(v1, v2)));
}


x86 assembly (clang, -O0):
<glmComputeNormalizedVectorAngle2dDeg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <glmDotProduct2d@plt>
mov    %eax,%edi
call   1030 <acos@plt>
mov    %eax,%edi
call   1040 <glmDegd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmComputeNormalizedVectorAngle2dDeg>:
push   %rax
call   1050 <glmDotProduct2d@plt>
mov    %eax,%edi
call   1030 <acos@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <glmDegd@plt>

LLVM IR (-O0):
define double @glmComputeNormalizedVectorAngle2dDeg(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %3
%6 = load double*, double** %4
%7 = call i32 @glmDotProduct2d(double* %5, double* %6)
%8 = call i32 @acos(i32 %7)
%9 = call double @glmDegd(i32 %8)
ret double %9
}

LLVM IR (-O2):
define double @glmComputeNormalizedVectorAngle2dDeg(double* %0, double* %1) {
%3 = tail call i32 @glmDotProduct2d(double* %0, double* %1)
%4 = tail call i32 @acos(i32 %3)
%5 = tail call double @glmDegd(i32 %4)
ret double %5
}