xunge/DecIR huggingface dataset:
/* Variables and functions */
int flac_min(unsigned int, unsigned int);
unsigned
FLAC__format_get_max_rice_partition_order_from_blocksize(unsigned blocksize) {
  unsigned max_rice_partition_order = 0;
  while (!(blocksize & 1)) {
    max_rice_partition_order++;
    blocksize >>= 1;
  }
  return flac_min((15u), max_rice_partition_order);
}


x86 assembly (clang, -O0):
<FLAC__format_get_max_rice_partition_order_from_blocksize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    113d <FLAC__format_get_max_rice_partition_order_from_blocksize+0x2d>
jmp    1154 <FLAC__format_get_max_rice_partition_order_from_blocksize+0x44>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1122 <FLAC__format_get_max_rice_partition_order_from_blocksize+0x12>
mov    -0x8(%rbp),%esi
mov    $0xf,%edi
call   1030 <flac_min@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FLAC__format_get_max_rice_partition_order_from_blocksize>:
xor    %esi,%esi
test   $0x1,%dil
jne    112d <FLAC__format_get_max_rice_partition_order_from_blocksize+0x1d>
xor    %esi,%esi
mov    %edi,%eax
nopl   0x0(%rax)
add    $0x1,%esi
shr    %eax
test   $0x2,%dil
mov    %eax,%edi
je     1120 <FLAC__format_get_max_rice_partition_order_from_blocksize+0x10>
mov    $0xf,%edi
jmp    1030 <flac_min@plt>

LLVM IR (-O0):
define i32 @FLAC__format_get_max_rice_partition_order_from_blocksize(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %9, %1
%5 = load i32, i32* %2
%6 = and i32 %5, 1
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = load i32, i32* %3
%11 = add i32 %10, 1
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = lshr i32 %12, 1
store i32 %13, i32* %2
br label %4
14: ; preds = %4
%15 = load i32, i32* %3
%16 = call i32 @flac_min(i32 15, i32 %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @FLAC__format_get_max_rice_partition_order_from_blocksize(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %11
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = phi i32 [ %8, %4 ], [ %0, %1 ]
%7 = add i32 %5, 1
%8 = lshr i32 %6, 1
%9 = and i32 %6, 2
%10 = icmp eq i32 %9, 0
br i1 %10, label %4, label %11
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %7, %4 ]
%13 = tail call i32 @flac_min(i32 15, i32 %12)
ret i32 %13
}
/* Variables and functions */
char *trim_any_str(char const *, char *);
char *trim_str(const char *s) { return trim_any_str(s, " \t\r\n"); }


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

x86 assembly (clang, -O2):
<trim_str>:
lea    0xee9(%rip),%rsi
jmp    1030 <trim_any_str@plt>

LLVM IR (-O0):
@.str = [5 x i8] c" \09\0D\0A\00"
define i8* @trim_str(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @trim_any_str(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %4
}

LLVM IR (-O2):
@.str = [5 x i8] c" \09\0D\0A\00"
define i8* @trim_str(i8* %0) {
%2 = tail call i8* @trim_any_str(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %2
}
unsigned long setbit(unsigned long x, int n) {
  return x | (((unsigned long)1) << n);
}


x86 assembly (clang, -O0):
<setbit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%rdx
mov    %rdx,%rcx
or     %rcx,%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @setbit(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = load i32, i32* %4
%7 = zext i32 %6 to i64
%8 = shl i64 1, %7
%9 = or i64 %5, %8
ret i64 %9
}

LLVM IR (-O2):
define i64 @setbit(i64 %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = shl nuw i64 1, %3
%5 = or i64 %4, %0
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ memmove(int *, int *, int);
void memmove_bad1() {
  int arr1[10];
  int arr2[20];
  memmove(arr1, arr2, 44);
}


x86 assembly (clang, -O0):
<memmove_bad1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x30(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    $0x2c,%edx
call   1030 <memmove@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memmove_bad1>:
sub    $0x88,%rsp
mov    %rsp,%rdi
lea    0x30(%rsp),%rsi
mov    $0x2c,%edx
call   1030 <memmove@plt>
add    $0x88,%rsp
ret

LLVM IR (-O0):
define void @memmove_bad1() {
%1 = alloca [10 x i32]
%2 = alloca [20 x i32]
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%5 = call i32 @memmove(i32* %3, i32* %4, i32 44)
ret void
}

LLVM IR (-O2):
define void @memmove_bad1() {
%1 = alloca [10 x i32]
%2 = alloca [20 x i32]
%3 = bitcast [10 x i32]* %1 to i8*
%4 = bitcast [20 x i32]* %2 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%7 = call i32 @memmove(i32* %5, i32* %6, i32 44)
ret void
}
unsigned long get_cycle_count(void) {
  unsigned int lower, upper;
  asm volatile("rdtsc" : "=a"(lower), "=d"(upper));
  return lower | ((unsigned long)upper << 32);
}


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

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

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

LLVM IR (-O2):
define i64 @get_cycle_count() {
%1 = tail call { i32, i32 } asm sideeffect "rdtsc", "={ax},={dx},~{dirflag},~{fpsr},~{flags}"()
%2 = extractvalue { i32, i32 } %1, 0
%3 = extractvalue { i32, i32 } %1, 1
%4 = zext i32 %2 to i64
%5 = zext i32 %3 to i64
%6 = shl nuw i64 %5, 32
%7 = or i64 %6, %4
ret i64 %7
}
int vga_conflicts(struct pci_dev *p1, struct pci_dev *p2) { return 1; }


x86 assembly (clang, -O0):
<vga_conflicts>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.pci_dev = type opaque
define i32 @vga_conflicts(%struct.pci_dev* %0, %struct.pci_dev* %1) {
%3 = alloca %struct.pci_dev*
%4 = alloca %struct.pci_dev*
store %struct.pci_dev* %0, %struct.pci_dev** %3
store %struct.pci_dev* %1, %struct.pci_dev** %4
ret i32 1
}

LLVM IR (-O2):
%struct.pci_dev = type opaque
define i32 @vga_conflicts(%struct.pci_dev* nocapture readnone %0, %struct.pci_dev* nocapture readnone %1) {
ret i32 1
}
void tick_oneshot_notify(void) {}


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

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

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

LLVM IR (-O2):
define void @tick_oneshot_notify() {
ret void
}
/* Variables and functions */
int get_mdterm();
void md_draw_string(int x, int y, char *str) {
  switch (get_mdterm()) {}
}


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

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

LLVM IR (-O0):
define void @md_draw_string(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = call i32 (...) @get_mdterm()
switch i32 %7, label %8 [
]
8: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @md_draw_string(i32 %0, i32 %1, i8* nocapture readnone %2) {
%4 = tail call i32 (...) @get_mdterm()
ret void
}
void glGenTextures(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glGenTextures() {
ret void
}
/* Variables and functions */
scalar_t__ isalpha(int);
int tolower(int c) {
  if (isalpha(c)) {
    return c | 0x20;
  }
  return c;
}


x86 assembly (clang, -O0):
<tolower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <isalpha@plt>
cmp    $0x0,%rax
je     113b <tolower+0x2b>
mov    -0x8(%rbp),%eax
or     $0x20,%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <tolower+0x31>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @tolower(i32 %0) {
%2 = tail call i64 @isalpha(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = or i32 %0, 32
%5 = select i1 %3, i32 %0, i32 %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_sys_reset_usage(void) {
  printf("\nUsage : sys_reset\n");
  return;
}


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

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

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

LLVM IR (-O2):
@str = [19 x i8] c"\0AUsage : sys_reset\00"
define void @print_sys_reset_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int rf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int main(void) {
  char buffer[1024];
  fgets(buffer, (sizeof(buffer) / sizeof((buffer)[0])), stdin);
  printf("%c", rf(buffer, '0'));
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
mov    0x2e98(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1040 <fgets@plt>
lea    -0x410(%rbp),%rdi
mov    $0x30,%esi
call   1050 <rf@plt>
mov    %eax,%esi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e56(%rip),%rax
mov    (%rax),%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1040 <fgets@plt>
mov    %rbx,%rdi
mov    $0x30,%esi
call   1050 <rf@plt>
lea    0xe9b(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%eax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c"%c\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %3, i32 1024, i32 %4)
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%7 = call i32 @rf(i8* %6, i32 48)
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @EXIT_SUCCESS
ret i32 %9
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%c\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 1024, i32 %3)
%5 = call i32 @rf(i8* %2, i32 48)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}
OP(fd, e4) { op_e4(); }


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

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @op_e4()
ret i32 undef
}
void __libc_init(int argc, char **argv, char **envp) {}


x86 assembly (clang, -O0):
<__libc_init>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @__libc_init(i32 %0, i8** nocapture %1, i8** nocapture %2) {
ret void
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
int32_t min_s32(int32_t a, int32_t b) { return a < b ? a : b; }


x86 assembly (clang, -O0):
<min_s32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1127 <min_s32+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <min_s32+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min_s32>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovl  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @min_s32(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp slt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @min_s32(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
void lock_flash(void) {}


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

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

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

LLVM IR (-O2):
define void @lock_flash() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EBADF;
#define STDERR_FILENO 129
#define STDOUT_FILENO 128
int /*<<< orphan*/ errno;
int _write(int file, char *ptr, int len) {
  ptr = ptr;
  len = len;
  switch (file) {
  case STDOUT_FILENO:
    break;
  case STDERR_FILENO:
    break;
  default:
    errno = EBADF;
    return -1;
  }
  return len;
}


x86 assembly (clang, -O0):
<_write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x80,%eax
je     1137 <_write+0x37>
jmp    1124 <_write+0x24>
mov    -0x18(%rbp),%eax
sub    $0x81,%eax
je     113c <_write+0x3c>
jmp    1141 <_write+0x41>
jmp    115f <_write+0x5f>
jmp    115f <_write+0x5f>
mov    0x2e90(%rip),%rax
mov    (%rax),%ecx
mov    0x2e8f(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    1165 <_write+0x65>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_write>:
mov    %edx,%eax
and    $0xfffffffe,%edi
cmp    $0x80,%edi
je     1124 <_write+0x24>
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 @_write(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%8 = load i8*, i8** %6
store i8* %8, i8** %6
%9 = load i32, i32* %7
store i32 %9, i32* %7
%10 = load i32, i32* %5
switch i32 %10, label %13 [
i32 128, label %11
i32 129, label %12
]
11: ; preds = %3
br label %15
12: ; preds = %3
br label %15
13: ; preds = %3
%14 = load i32, i32* @EBADF
store i32 %14, i32* @errno
store i32 -1, i32* %4
br label %17
15: ; preds = %12, %11
%16 = load i32, i32* %7
store i32 %16, i32* %4
br label %17
17: ; preds = %15, %13
%18 = load i32, i32* %4
ret i32 %18
}

LLVM IR (-O2):
@EBADF = global i32 0
@errno = global i32 0
define i32 @_write(i32 %0, i8* nocapture readnone %1, i32 %2) {
%4 = and i32 %0, -2
%5 = icmp eq i32 %4, 128
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = load i32, i32* @EBADF
store i32 %7, i32* @errno
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ -1, %6 ], [ %2, %3 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(void) {
  int i;
  double d;
  fprintf(stdout, "intput i,d:");
  fprintf(stderr, "hello, hanmeimei");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
lea    0xed8(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
lea    0xed6(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [12 x i8] c"intput i,d:\00"
@stderr = global i32 0
@.str.1 = [17 x i8] c"hello, hanmeimei\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = load i32, i32* @stdout
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [12 x i8] c"intput i,d:\00"
@stderr = global i32 0
@.str.1 = [17 x i8] c"hello, hanmeimei\00"
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
main() {
  char buf[80];
  printf("please enter your name: ");
  gets(buf);
  printf("hello, %s, welcome to the growing community of Aztec C users\n", buf);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x50(%rbp),%rdi
call   1040 <gets@plt>
lea    -0x50(%rbp),%rsi
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <gets@plt>
lea    0xed4(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"please enter your name: \00"
@.str.1 = [62 x i8] c"hello, %s, welcome to the growing community of Aztec C users\0A\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = call i32 @gets(i8* %3)
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0), i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"please enter your name: \00"
@.str.1 = [62 x i8] c"hello, %s, welcome to the growing community of Aztec C users\0A\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int indexOf(char **, char const *);
char *getParam(char *argv[], const char *arg) {
  int index = indexOf(argv, arg);
  if (index == -1)
    return NULL;
  else
    return argv[index + 1];
}


x86 assembly (clang, -O0):
<getParam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <indexOf@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1147 <getParam+0x37>
movq   $0x0,-0x8(%rbp)
jmp    115c <getParam+0x4c>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getParam>:
push   %rbx
mov    %rdi,%rbx
call   1030 <indexOf@plt>
cmp    $0xffffffff,%eax
je     1127 <getParam+0x17>
cltq
mov    0x8(%rbx,%rax,8),%rax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @getParam(i8** %0, i8* %1) {
%3 = tail call i32 @indexOf(i8** %0, i8* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = add nuw nsw i32 %3, 1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
br label %10
10: ; preds = %2, %5
%11 = phi i8* [ %9, %5 ], [ null, %2 ]
ret i8* %11
}
unsigned int hash_str_hash(void *key) {
  const signed char *p;
  unsigned int hash = 5381;
  for (p = key; *p; p += 1) {
    hash = (hash << 5) + hash + *p;
  }
  return hash;
}


x86 assembly (clang, -O0):
<hash_str_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1505,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114a <hash_str_hash+0x4a>
mov    -0x14(%rbp),%eax
shl    $0x5,%eax
add    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1117 <hash_str_hash+0x17>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_str_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <hash_str_hash+0x28>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
mov    %eax,%edx
shl    $0x5,%edx
add    %eax,%edx
movsbl %cl,%eax
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash_str_hash+0x10>
ret
mov    $0x1505,%eax
ret

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

LLVM IR (-O2):
define i32 @hash_str_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 5381, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = mul i32 %6, 33
%9 = sext i8 %5 to i32
%10 = add i32 %8, %9
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 5381, %1 ], [ %10, %4 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ putchar(int);
void my_putc(int ch) { putchar(ch); }


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

x86 assembly (clang, -O2):
<my_putc>:
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @my_putc(i32 %0) {
%2 = tail call i32 @putchar(i32 %0)
ret void
}
unsigned long strlen(const char *str) {
  unsigned long i;
  for (i = 0; str[i]; i++)
    ;
  return i;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1138 <strlen+0x38>
jmp    1127 <strlen+0x27>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %7, %2 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i64 %3
}
void XkbAllocGeomOverlays() {}


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

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

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

LLVM IR (-O2):
define void @XkbAllocGeomOverlays() {
ret void
}
/* Variables and functions */
int htoi(char *);
int /*<<< orphan*/ printf(char *, char *, int);
void main() {
  char *hexadecimal = "0x820";
  int result;
  result = htoi(hexadecimal);
  printf("hexadecimal=%s \tdecimal=%d\n", hexadecimal, result);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
call   1040 <htoi@plt>
lea    0xecf(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"0x820\00"
@.str.1 = [28 x i8] c"hexadecimal=%s \09decimal=%d\0A\00"
define void @main() {
%1 = alloca i8*
%2 = alloca i32
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @htoi(i8* %3)
store i32 %4, i32* %2
%5 = load i8*, i8** %1
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"0x820\00"
@.str.1 = [28 x i8] c"hexadecimal=%s \09decimal=%d\0A\00"
define void @main() {
%1 = tail call i32 @htoi(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void i2cCleanUp(int i2cDev) { close(i2cDev); }


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

x86 assembly (clang, -O2):
<i2cCleanUp>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @i2cCleanUp(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
void dot() {}


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

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

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

LLVM IR (-O2):
define void @dot() {
ret void
}
void os_close_on_exec(fd, name, what, dir) int fd;
char *name, *what, *dir;
{}


x86 assembly (clang, -O0):
<os_close_on_exec>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @os_close_on_exec(i32 %0, i8* nocapture %1, i8* nocapture %2, i8* nocapture %3) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ wprintf(char *);
void print(void) { wprintf(L"你好世界 !\n"); }


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

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

LLVM IR (-O0):
@.str = [8 x i32] [i32 20320, i32 22909, i32 19990, i32 30028, i32 32, i32 33, i32 10, i32 0]
define void @print() {
%1 = call i32 @wprintf(i8* bitcast ([8 x i32]* @.str to i8*))
ret void
}

LLVM IR (-O2):
@.str = [8 x i32] [i32 20320, i32 22909, i32 19990, i32 30028, i32 32, i32 33, i32 10, i32 0]
define void @print() {
%1 = tail call i32 @wprintf(i8* bitcast ([8 x i32]* @.str to i8*))
ret void
}
/* Variables and functions */
char *FindLast(char *, char, int);
int /*<<< orphan*/ _snprintf(char *, int, char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
void Test() {
  char buf[256 + 1];
  char *ptr;
  memset(buf, 0, sizeof(char) * (256 + 1));
  _snprintf(buf, 256, "Test message/foom/blah/testname.old.pgm");
  ptr = FindLast(buf, '.', -1);
  return;
}


x86 assembly (clang, -O0):
<Test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x101,%edx
call   1030 <memset@plt>
lea    -0x110(%rbp),%rdi
mov    $0x100,%esi
lea    0xe9f(%rip),%rdx
call   1050 <_snprintf@plt>
lea    -0x110(%rbp),%rdi
mov    $0x2e,%esi
mov    $0xffffffff,%edx
call   1040 <FindLast@plt>
mov    %rax,-0x118(%rbp)
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Test>:
push   %rbx
sub    $0x110,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x101,%edx
call   1030 <memset@plt>
lea    0xeaf(%rip),%rdx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1050 <_snprintf@plt>
mov    %rbx,%rdi
mov    $0x2e,%esi
mov    $0xffffffff,%edx
call   1040 <FindLast@plt>
add    $0x110,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Test message/foom/blah/testname.old.pgm\00"
define void @Test() {
%1 = alloca [257 x i8]
%2 = alloca i8*
%3 = getelementptr inbounds [257 x i8], [257 x i8]* %1, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i32 0, i32 257)
%5 = getelementptr inbounds [257 x i8], [257 x i8]* %1, i64 0, i64 0
%6 = call i32 @_snprintf(i8* %5, i32 256, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [257 x i8], [257 x i8]* %1, i64 0, i64 0
%8 = call i8* @FindLast(i8* %7, i8 signext 46, i32 -1)
store i8* %8, i8** %2
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"Test message/foom/blah/testname.old.pgm\00"
define void @Test() {
%1 = alloca [257 x i8]
%2 = getelementptr inbounds [257 x i8], [257 x i8]* %1, i64 0, i64 0
%3 = call i32 @memset(i8* %2, i32 0, i32 257)
%4 = call i32 @_snprintf(i8* %2, i32 256, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%5 = call i8* @FindLast(i8* %2, i8 signext 46, i32 -1)
ret void
}
int isPalindrome(n) {
  int copy = n;
  int complement = 0;
  while (copy > 0) {
    complement = complement * 10 + copy % 10;
    copy /= 10;
  }
  if (complement == n)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isPalindrome>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    114b <isPalindrome+0x4b>
imul   $0xa,-0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    1114 <isPalindrome+0x14>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1163 <isPalindrome+0x63>
movl   $0x1,-0x4(%rbp)
jmp    116a <isPalindrome+0x6a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPalindrome>:
xor    %edx,%edx
test   %edi,%edi
jle    1133 <isPalindrome+0x33>
mov    $0xcccccccd,%r8d
mov    %edi,%ecx
xchg   %ax,%ax
lea    (%rdx,%rdx,4),%r9d
mov    %ecx,%esi
imul   %r8,%rsi
shr    $0x23,%rsi
lea    (%rsi,%rsi,1),%eax
lea    (%rax,%rax,4),%eax
mov    %ecx,%edx
sub    %eax,%edx
lea    (%rdx,%r9,2),%edx
cmp    $0x9,%ecx
mov    %esi,%ecx
ja     1110 <isPalindrome+0x10>
xor    %eax,%eax
cmp    %edi,%edx
sete   %al
ret

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

LLVM IR (-O2):
define i32 @isPalindrome(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %11
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = phi i32 [ %9, %3 ], [ %0, %1 ]
%6 = mul nsw i32 %4, 10
%7 = urem i32 %5, 10
%8 = add nsw i32 %6, %7
%9 = udiv i32 %5, 10
%10 = icmp ult i32 %5, 10
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %8, %3 ]
%13 = icmp eq i32 %12, %0
%14 = zext i1 %13 to i32
ret i32 %14
}
double scale_dh21(double x, double y, double z) { return 0.0; }


x86 assembly (clang, -O0):
<scale_dh21>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
xorps  %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<scale_dh21>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @scale_dh21(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @scale_dh21(double %0, double %1, double %2) {
ret double 0.000000e+00
}
/* Variables and functions */
int calc(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int a = 100;
  int b = 50;
  int c = calc(a, b);
  printf("%d\n", c);
  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)
movl   $0x64,-0x14(%rbp)
movl   $0x32,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <calc@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @calc(i32 100, i32 50)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
_Bool Long_safe_MINUS_mul(long x, long y, long *res) {
  return __builtin_smull_overflow(x, y, res);
}


x86 assembly (clang, -O0):
<Long_safe_MINUS_mul>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
imul   %rax,%rdx
seto   %al
mov    %rdx,(%rcx)
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Long_safe_MINUS_mul>:
imul   %rsi,%rdi
seto   %al
mov    %rdi,(%rdx)
ret

LLVM IR (-O0):
define zeroext i1 @Long_safe_MINUS_mul(i64 %0, i64 %1, i64* %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64*
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64* %2, i64** %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = load i64*, i64** %6
%10 = call { i64, i1 } @llvm.smul.with.overflow.i64(i64 %7, i64 %8)
%11 = extractvalue { i64, i1 } %10, 1
%12 = extractvalue { i64, i1 } %10, 0
store i64 %12, i64* %9
ret i1 %11
}

LLVM IR (-O2):
define zeroext i1 @Long_safe_MINUS_mul(i64 %0, i64 %1, i64* nocapture writeonly %2) {
%4 = tail call { i64, i1 } @llvm.smul.with.overflow.i64(i64 %0, i64 %1)
%5 = extractvalue { i64, i1 } %4, 1
%6 = extractvalue { i64, i1 } %4, 0
store i64 %6, i64* %2
ret i1 %5
}
/* Variables and functions */
int /*<<< orphan*/ UARTPuts(char *, int);
int CmdLineNewline(unsigned int lines) {
  int i;
  for (i = 0; i < lines; i++) {
    UARTPuts("\r\n", -1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<CmdLineNewline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    114d <CmdLineNewline+0x3d>
lea    0xecb(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <UARTPuts@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <CmdLineNewline+0x12>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CmdLineNewline>:
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
je     1142 <CmdLineNewline+0x32>
mov    %edi,%ebx
lea    0xedf(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0xffffffff,%esi
call   1030 <UARTPuts@plt>
add    $0xffffffff,%ebx
jne    1130 <CmdLineNewline+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"\0D\0A\00"
define i32 @CmdLineNewline(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 @UARTPuts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 -1)
%6 = add nuw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ handle_SAK(int /*<<< orphan*/);
int gen_SAK(void) {
  handle_SAK(0);
  return 0;
}


x86 assembly (clang, -O0):
<gen_SAK>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <handle_SAK@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @gen_SAK() {
%1 = call i32 @handle_SAK(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @gen_SAK() {
%1 = tail call i32 @handle_SAK(i32 0)
ret i32 0
}
/* Variables and functions */
int is_dashdash(const char *arg) {
  return arg != NULL && arg[0] == '-' && arg[1] == '-' && arg[2] == '\0';
}


x86 assembly (clang, -O0):
<is_dashdash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     1154 <is_dashdash+0x54>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2d,%ecx
mov    %al,-0x9(%rbp)
jne    1154 <is_dashdash+0x54>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%ecx
xor    %eax,%eax
cmp    $0x2d,%ecx
mov    %al,-0x9(%rbp)
jne    1154 <is_dashdash+0x54>
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_dashdash>:
xor    %eax,%eax
test   %rdi,%rdi
je     111b <is_dashdash+0x1b>
cmpb   $0x2d,(%rdi)
jne    111b <is_dashdash+0x1b>
cmpb   $0x2d,0x1(%rdi)
jne    111b <is_dashdash+0x1b>
xor    %eax,%eax
cmpb   $0x0,0x2(%rdi)
sete   %al
ret

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

LLVM IR (-O2):
define i32 @is_dashdash(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %15, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 45
br i1 %5, label %6, label %15
6: ; preds = %3
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 45
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = getelementptr inbounds i8, i8* %0, i64 2
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %10, %6, %3, %1
%16 = phi i32 [ 0, %6 ], [ 0, %3 ], [ 0, %1 ], [ %14, %10 ]
ret i32 %16
}
void check_stacks(void) {}


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

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

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

LLVM IR (-O2):
define void @check_stacks() {
ret void
}
/* Variables and functions */
int EOF;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int zzerr_in() {
  fprintf(stderr, "No input stream, function, or string\n");
  return EOF;
}


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

x86 assembly (clang, -O2):
<zzerr_in>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ebb(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"No input stream, function, or string\0A\00"
@EOF = global i32 0
define i32 @zzerr_in() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EOF
ret i32 %3
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"No input stream, function, or string\0A\00"
@EOF = global i32 0
define i32 @zzerr_in() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EOF
ret i32 %3
}