xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ EOF;
scalar_t__ getchar();
int /*<<< orphan*/ printf(char *, long);
void charCount() {
  long int nc;
  nc = 0;
  while (getchar() != EOF)
    ++nc;
  printf("%ld\n", nc);
}


x86 assembly (clang, -O0):
<charCount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    0x2eaa(%rip),%rcx
cmp    (%rcx),%rax
je     1158 <charCount+0x38>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1130 <charCount+0x10>
mov    -0x8(%rbp),%rsi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<charCount>:
push   %r14
push   %rbx
push   %rax
mov    $0xffffffffffffffff,%rbx
mov    0x2eb6(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%rbx
cmp    (%r14),%rax
jne    1140 <charCount+0x20>
lea    0xea9(%rip),%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@EOF = global i64 0
@.str = [5 x i8] c"%ld\0A\00"
define void @charCount() {
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ 0, %0 ], [ %6, %1 ]
%3 = tail call i64 (...) @getchar()
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
%6 = add nuw nsw i64 %2, 1
br i1 %5, label %7, label %1
7: ; preds = %1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, unsigned short, char,
                           unsigned short, char, char, char, char, char);
void send_key(FILE *hid_dev, unsigned short key, unsigned short mod) {
  fprintf(hid_dev, "%c%c%c%c%c%c%c%c", mod, '\0', key, '\0', '\0', '\0', '\0',
          '\0');
}


x86 assembly (clang, -O0):
<send_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dx,%ax
mov    %si,%cx
mov    %rdi,-0x8(%rbp)
mov    %cx,-0xa(%rbp)
mov    %ax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ax
lea    0xec7(%rip),%rsi
xor    %r9d,%r9d
movzwl %ax,%edx
mov    %r9d,%ecx
movzwl -0xa(%rbp),%r8d
movl   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0x18(%rsp)
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_key>:
push   %rax
mov    %esi,%r8d
lea    0xee5(%rip),%rsi
xor    %ecx,%ecx
xor    %r9d,%r9d
push   $0x0
push   $0x0
push   $0x0
push   $0x0
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rax
ret

LLVM IR (-O0):
@.str = [17 x i8] c"%c%c%c%c%c%c%c%c\00"
define void @send_key(i32* %0, i16 zeroext %1, i16 zeroext %2) {
%4 = alloca i32*
%5 = alloca i16
%6 = alloca i16
store i32* %0, i32** %4
store i16 %1, i16* %5
store i16 %2, i16* %6
%7 = load i32*, i32** %4
%8 = load i16, i16* %6
%9 = load i16, i16* %5
%10 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i16 zeroext %8, i8 signext 0, i16 zeroext %9, i8 signext 0, i8 signext 0, i8 signext 0, i8 signext 0, i8 signext 0)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"%c%c%c%c%c%c%c%c\00"
define void @send_key(i32* nocapture %0, i16 zeroext %1, i16 zeroext %2) {
%4 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i16 zeroext %2, i8 signext 0, i16 zeroext %1, i8 signext 0, i8 signext 0, i8 signext 0, i8 signext 0, i8 signext 0)
ret void
}
/* Type definitions */
struct mempool {
  int dummy;
};

/* Variables and functions */
int mp_open_fast(struct mempool *, void *);
unsigned mp_open(struct mempool *pool, void *ptr) {
  return mp_open_fast(pool, ptr);
}


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

x86 assembly (clang, -O2):
<mp_open>:
jmp    1030 <mp_open_fast@plt>

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

LLVM IR (-O2):
%struct.mempool = type { i32 }
define i32 @mp_open(%struct.mempool* %0, i8* %1) {
%3 = tail call i32 @mp_open_fast(%struct.mempool* %0, i8* %1)
ret i32 %3
}
unsigned long rdpmc_instructions() {
  unsigned a, d, c;
  c = (1 << 30);
  __asm__ volatile("rdpmc" : "=a"(a), "=d"(d) : "c"(c));
  return ((unsigned long)a) | (((unsigned long)d) << 32);
  ;
}


x86 assembly (clang, -O0):
<rdpmc_instructions>:
push   %rbp
mov    %rsp,%rbp
movl   $0x40000000,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
rdpmc
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):
<rdpmc_instructions>:
mov    $0x40000000,%ecx
rdpmc
mov    %eax,%eax
shl    $0x20,%rdx
or     %rdx,%rax
ret

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

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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int getpid();
int /*<<< orphan*/ sync();
void create_pid_file(void) {
  FILE *fp;
  fp = fopen("/var/run/rasp4you.pid", "w");
  fprintf(fp, "%u\n", getpid());
  fclose(fp);
  sync();
}


x86 assembly (clang, -O0):
<create_pid_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
lea    0xeb0(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%edx
lea    0xe8d(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
mov    $0x0,%al
call   1060 <sync@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_pid_file>:
push   %rbx
lea    0xea8(%rip),%rdi
lea    0xeb7(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xea3(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
call   1050 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
pop    %rbx
jmp    1060 <sync@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"/var/run/rasp4you.pid\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [4 x i8] c"%u\0A\00"
define void @create_pid_file() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = call i32 (...) @getpid()
%5 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%6 = load i32*, i32** %1
%7 = call i32 @fclose(i32* %6)
%8 = call i32 (...) @sync()
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"/var/run/rasp4you.pid\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [4 x i8] c"%u\0A\00"
define void @create_pid_file() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %2)
%4 = tail call i32 @fclose(i32* %1)
%5 = tail call i32 (...) @sync()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set_ioprio_rt();
void pcap_rw_init_once(void) { set_ioprio_rt(); }


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

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

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

LLVM IR (-O2):
define void @pcap_rw_init_once() {
%1 = tail call i32 (...) @set_ioprio_rt()
ret void
}
void fatal(pat, arg1, arg2, arg3) char *pat;
long arg1, arg2, arg3;
{
  say(pat, arg1, arg2, arg3);
  my_exit(1);
}


x86 assembly (clang, -O0):
<fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x0,%al
call   1040 <say@plt>
mov    $0x1,%edi
mov    $0x0,%al
call   1030 <my_exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fatal>:
push   %rax
xor    %eax,%eax
call   1040 <say@plt>
mov    $0x1,%edi
xor    %eax,%eax
pop    %rcx
jmp    1030 <my_exit@plt>

LLVM IR (-O0):
define void @fatal(i8* %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i64, i64* %7
%12 = load i64, i64* %8
%13 = call i32 (i8*, i64, i64, i64, ...) bitcast (i32 (...)* @say to i32 (i8*, i64, i64, i64, ...)*)(i8* %9, i64 %10, i64 %11, i64 %12)
%14 = call i32 (i32, ...) bitcast (i32 (...)* @my_exit to i32 (i32, ...)*)(i32 1)
ret void
}

LLVM IR (-O2):
define void @fatal(i8* %0, i64 %1, i64 %2, i64 %3) {
%5 = tail call i32 (i8*, i64, i64, i64, ...) bitcast (i32 (...)* @say to i32 (i8*, i64, i64, i64, ...)*)(i8* %0, i64 %1, i64 %2, i64 %3)
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @my_exit to i32 (i32, ...)*)(i32 1)
ret void
}
int test_imm_5Cuint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x5C << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_5Cuint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = and i64 %4, 92
%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_5Cuint64_midword_reg(i64 %0) {
%2 = and i64 %0, 6029312
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ tests_insert();
int main(int argc, char *argv[]) {
  tests_insert();
  printf("-----------------\n");
  printf("All Tests Passed!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <tests_insert@plt>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [19 x i8] c"-----------------\0A\00"
@.str.1 = [19 x i8] c"All Tests Passed!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @tests_insert()
%7 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [18 x i8] c"-----------------\00"
@str.2 = [18 x i8] c"All Tests Passed!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @tests_insert()
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
void Cyc_RemoveAggrs_massage_toplevel_aggr(struct Cyc_Absyn_Exp *e) {
  if (e == 0)
    return;
}


x86 assembly (clang, -O0):
<Cyc_RemoveAggrs_massage_toplevel_aggr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1118 <Cyc_RemoveAggrs_massage_toplevel_aggr+0x18>
jmp    1118 <Cyc_RemoveAggrs_massage_toplevel_aggr+0x18>
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.Cyc_Absyn_Exp = type opaque
define void @Cyc_RemoveAggrs_massage_toplevel_aggr(%struct.Cyc_Absyn_Exp* %0) {
%2 = alloca %struct.Cyc_Absyn_Exp*
store %struct.Cyc_Absyn_Exp* %0, %struct.Cyc_Absyn_Exp** %2
%3 = load %struct.Cyc_Absyn_Exp*, %struct.Cyc_Absyn_Exp** %2
%4 = icmp eq %struct.Cyc_Absyn_Exp* %3, null
br i1 %4, label %5, label %6
5: ; preds = %1
br label %6
6: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
%struct.Cyc_Absyn_Exp = type opaque
define void @Cyc_RemoveAggrs_massage_toplevel_aggr(%struct.Cyc_Absyn_Exp* nocapture %0) {
ret void
}
XFreeFontPath() {}


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

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

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

LLVM IR (-O2):
define i32 @XFreeFontPath() {
ret i32 undef
}
void pinconf_show_setting(struct seq_file *s,
                          struct pinctrl_setting const *setting) {}


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

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

LLVM IR (-O0):
%struct.seq_file = type opaque
%struct.pinctrl_setting = type opaque
define void @pinconf_show_setting(%struct.seq_file* %0, %struct.pinctrl_setting* %1) {
%3 = alloca %struct.seq_file*
%4 = alloca %struct.pinctrl_setting*
store %struct.seq_file* %0, %struct.seq_file** %3
store %struct.pinctrl_setting* %1, %struct.pinctrl_setting** %4
ret void
}

LLVM IR (-O2):
%struct.seq_file = type opaque
%struct.pinctrl_setting = type opaque
define void @pinconf_show_setting(%struct.seq_file* nocapture %0, %struct.pinctrl_setting* nocapture %1) {
ret void
}
int ds1672_remove(struct i2c_client *client) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.i2c_client = type opaque
define i32 @ds1672_remove(%struct.i2c_client* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
char toupper(char);
void ST_toupper(char *s) {
  while (*s) {
    *s = toupper(*s);
    s++;
  }
}


x86 assembly (clang, -O0):
<ST_toupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114e <ST_toupper+0x3e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <ST_toupper+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ST_toupper>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1136 <ST_toupper+0x26>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <ST_toupper+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @ST_toupper(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call signext i8 @toupper(i8 signext %5)
store i8 %7, i8* %6
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
int get_ticks() {
  unsigned int n1, n2;
  n1 = *(volatile unsigned long *)((void *)0xfffffd20 + 0x08);
  while ((n2 = *(volatile unsigned long *)((void *)0xfffffd20 + 0x08)) != n1) {
    n1 = n2;
  }
  return (int)n1;
}


x86 assembly (clang, -O0):
<get_ticks>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffffd20,%eax
mov    0x8(%rax),%rax
mov    %eax,-0x4(%rbp)
mov    $0xfffffd20,%eax
mov    0x8(%rax),%rax
mov    %eax,-0x8(%rbp)
cmp    -0x4(%rbp),%eax
je     1130 <get_ticks+0x30>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1110 <get_ticks+0x10>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ticks>:
mov    $0xfffffd28,%ecx
mov    (%rcx),%rdx
nopl   0x0(%rax,%rax,1)
mov    %edx,%eax
mov    (%rcx),%rdx
cmp    %edx,%eax
jne    1110 <get_ticks+0x10>
ret

LLVM IR (-O0):
define i32 @get_ticks() {
%1 = alloca i32
%2 = alloca i32
%3 = load volatile i64, i64* bitcast (i8* getelementptr (i8, i8* inttoptr (i64 4294966560 to i8*), i64 8) to i64*)
%4 = trunc i64 %3 to i32
store i32 %4, i32* %1
br label %5
5: ; preds = %10, %0
%6 = load volatile i64, i64* bitcast (i8* getelementptr (i8, i8* inttoptr (i64 4294966560 to i8*), i64 8) to i64*)
%7 = trunc i64 %6 to i32
store i32 %7, i32* %2
%8 = load i32, i32* %1
%9 = icmp ne i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %5
%11 = load i32, i32* %2
store i32 %11, i32* %1
br label %5
12: ; preds = %5
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
define i32 @get_ticks() {
%1 = load volatile i64, i64* inttoptr (i64 4294966568 to i64*)
%2 = trunc i64 %1 to i32
br label %3
3: ; preds = %3, %0
%4 = phi i32 [ %2, %0 ], [ %6, %3 ]
%5 = load volatile i64, i64* inttoptr (i64 4294966568 to i64*)
%6 = trunc i64 %5 to i32
%7 = icmp eq i32 %4, %6
br i1 %7, label %8, label %3
8: ; preds = %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() { printf("Hello"); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"Hello\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ find_start();
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main() { printf("%p\n", find_start()); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%p\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @find_start()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ RunTests();
int /*<<< orphan*/ RunUI();
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main() {
  setbuf(stdout, NULL);
  setbuf(stderr, NULL);
  RunTests();
  RunUI();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <setbuf@plt>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <setbuf@plt>
mov    $0x0,%al
call   1050 <RunTests@plt>
mov    $0x0,%al
call   1040 <RunUI@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1030 <setbuf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1030 <setbuf@plt>
xor    %eax,%eax
call   1050 <RunTests@plt>
xor    %eax,%eax
call   1040 <RunUI@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@stderr = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @stdout
%3 = call i32 @setbuf(i32 %2, i32* null)
%4 = load i32, i32* @stderr
%5 = call i32 @setbuf(i32 %4, i32* null)
%6 = call i32 (...) @RunTests()
%7 = call i32 (...) @RunUI()
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@stderr = global i32 0
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @setbuf(i32 %1, i32* null)
%3 = load i32, i32* @stderr
%4 = tail call i32 @setbuf(i32 %3, i32* null)
%5 = tail call i32 (...) @RunTests()
%6 = tail call i32 (...) @RunUI()
ret i32 0
}
void select_chip() { *((unsigned volatile long *)0x70200004) &= ~(1 << 1); }


x86 assembly (clang, -O0):
<select_chip>:
push   %rbp
mov    %rsp,%rbp
mov    $0x70200004,%eax
mov    (%rax),%rcx
and    $0xfffffffffffffffd,%rcx
mov    $0x70200004,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<select_chip>:
andq   $0xfffffffffffffffd,0x70200004
70 fd
ret

LLVM IR (-O0):
define void @select_chip() {
%1 = load volatile i64, i64* inttoptr (i64 1881145348 to i64*)
%2 = and i64 %1, -3
store volatile i64 %2, i64* inttoptr (i64 1881145348 to i64*)
ret void
}

LLVM IR (-O2):
define void @select_chip() {
%1 = load volatile i64, i64* inttoptr (i64 1881145348 to i64*)
%2 = and i64 %1, -3
store volatile i64 %2, i64* inttoptr (i64 1881145348 to i64*)
ret void
}
int f(int i, int j) {
  unsigned int c = 0;
  if (i < j) {
    unsigned int n = j - i;
    unsigned int i;
    for (i = 0; i < n; i++)
      c++;
  }
  return c;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1155 <f+0x55>
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    1150 <f+0x50>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <f+0x2d>
jmp    1155 <f+0x55>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
xor    %eax,%eax
sub    %edi,%esi
cmovg  %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, %0
%4 = sub i32 %1, %0
%5 = select i1 %3, i32 %4, i32 0
ret i32 %5
}
void sys_unbashfilename(const char *from, char *to) {
  char c;
  while (c = *from++) {
    *to++ = c;
  }
  *to = 0;
}


x86 assembly (clang, -O0):
<sys_unbashfilename>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
cmp    $0x0,%al
je     1141 <sys_unbashfilename+0x41>
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    110c <sys_unbashfilename+0xc>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_unbashfilename>:
mov    (%rdi),%al
test   %al,%al
je     1121 <sys_unbashfilename+0x21>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
mov    %al,(%rsi)
add    $0x1,%rsi
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <sys_unbashfilename+0x10>
movb   $0x0,(%rsi)
ret

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

LLVM IR (-O2):
define void @sys_unbashfilename(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %0, %2 ]
%8 = phi i8* [ %10, %5 ], [ %1, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %6, i8* %8
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %1, %2 ], [ %10, %5 ]
store i8 0, i8* %14
ret void
}
/* Variables and functions */
int bar(int);
int /*<<< orphan*/ printf(char *, int);
void foo() {
  long long b = 1;
  int Y = bar(4);
  printf("%d\n", Y);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x1,-0x8(%rbp)
mov    $0x4,%edi
call   1030 <bar@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
mov    $0x4,%edi
call   1030 <bar@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @foo() {
%1 = tail call i32 @bar(i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
int Max(int x, int y, int z) {
  if (x > y && x > z)
    return 0;
  else if (y > z)
    return 1;
  else
    return 2;
}


x86 assembly (clang, -O0):
<Max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1131 <Max+0x31>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1131 <Max+0x31>
movl   $0x0,-0x4(%rbp)
jmp    1150 <Max+0x50>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1149 <Max+0x49>
movl   $0x1,-0x4(%rbp)
jmp    1150 <Max+0x50>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Max>:
xor    %eax,%eax
cmp    %edx,%esi
setg   %al
mov    $0x2,%ecx
sub    %eax,%ecx
xor    %eax,%eax
cmp    %edx,%edi
cmovle %ecx,%eax
cmp    %esi,%edi
cmovle %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @Max(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, %1
%5 = icmp sgt i32 %0, %2
%6 = and i1 %4, %5
%7 = icmp sgt i32 %1, %2
%8 = select i1 %7, i32 1, i32 2
%9 = select i1 %6, i32 0, i32 %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int g(int b, int c) { printf("%d %d\n", b, c); }


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @g(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 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @g(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret i32 undef
}
/* Type definitions */
struct archive {
  int dummy;
};

/* Variables and functions */
int archive_read_free(struct archive *);
int _alpm_archive_read_free(struct archive *archive) {
  return archive_read_free(archive);
}


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

x86 assembly (clang, -O2):
<_alpm_archive_read_free>:
jmp    1030 <archive_read_free@plt>

LLVM IR (-O0):
%struct.archive = type { i32 }
define i32 @_alpm_archive_read_free(%struct.archive* %0) {
%2 = alloca %struct.archive*
store %struct.archive* %0, %struct.archive** %2
%3 = load %struct.archive*, %struct.archive** %2
%4 = call i32 @archive_read_free(%struct.archive* %3)
ret i32 %4
}

LLVM IR (-O2):
%struct.archive = type { i32 }
define i32 @_alpm_archive_read_free(%struct.archive* %0) {
%2 = tail call i32 @archive_read_free(%struct.archive* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, double, int);
int fatbox(int p) {
  extern double Fatshift;
  int yyval;
  yyval = p;
  printf(".ds %d \\*(%d\\h'-\\w'\\*(%d'u+%gm'\\*(%d\n", p, p, p, Fatshift, p);
  return yyval;
}


x86 assembly (clang, -O0):
<fatbox>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x4(%rbp),%ecx
mov    0x2ebf(%rip),%rax
movsd  (%rax),%xmm0
mov    -0x4(%rbp),%r8d
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fatbox>:
push   %rbx
mov    %edi,%ebx
mov    0x2ed6(%rip),%rax
movsd  (%rax),%xmm0
lea    0xedb(%rip),%rdi
mov    %ebx,%esi
mov    %ebx,%edx
mov    %ebx,%ecx
mov    %ebx,%r8d
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c".ds %d \\*(%d\\h'-\\w'\\*(%d'u+%gm'\\*(%d\0A\00"
@Fatshift = external global double
define i32 @fatbox(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
store i32 %4, i32* %3
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = load i32, i32* %2
%8 = load double, double* @Fatshift
%9 = load i32, i32* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6, i32 %7, double %8, i32 %9)
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
@.str = [38 x i8] c".ds %d \\*(%d\\h'-\\w'\\*(%d'u+%gm'\\*(%d\0A\00"
@Fatshift = external global double
define i32 @fatbox(i32 returned %0) {
%2 = load double, double* @Fatshift
%3 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %0, i32 %0, double %2, i32 %0)
ret i32 %0
}
int f4(int a) { return a == 511; }


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x1ff,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4>:
xor    %eax,%eax
cmp    $0x1ff,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @f4(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 511
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @f4(i32 %0) {
%2 = icmp eq i32 %0, 511
%3 = zext i1 %2 to i32
ret i32 %3
}
char *findfont(char *name) { return 0; }


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

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

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

LLVM IR (-O2):
define noalias i8* @findfont(i8* nocapture readnone %0) {
ret i8* null
}
/* Variables and functions */
char *BGBCP_EatWhiteOnly2(char *);
char *BGBCC_SHXA_EatWhiteOnlyNoLinebreak(char *cs) {
  return (BGBCP_EatWhiteOnly2(cs));
}


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

x86 assembly (clang, -O2):
<BGBCC_SHXA_EatWhiteOnlyNoLinebreak>:
jmp    1030 <BGBCP_EatWhiteOnly2@plt>

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

LLVM IR (-O2):
define i8* @BGBCC_SHXA_EatWhiteOnlyNoLinebreak(i8* %0) {
%2 = tail call i8* @BGBCP_EatWhiteOnly2(i8* %0)
ret i8* %2
}
/* Variables and functions */
char **generateParenthesis(int, int *);
int main(void) {
  int n;
  char **res;
  res = generateParenthesis(1, &n);
  return (0);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rsi
mov    $0x1,%edi
call   1030 <generateParenthesis@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i8** @generateParenthesis(i32 1, i32* %1)
ret i32 0
}
void negotiate(struct battle_char *origin, struct battle_char *target) {}


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

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

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

LLVM IR (-O2):
%struct.battle_char = type opaque
define void @negotiate(%struct.battle_char* nocapture %0, %struct.battle_char* nocapture %1) {
ret void
}
int test_imm_94int64_highword_reg(long long val) {
  return ((val >> 32) & (0x94 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_94int64_highword_reg>:
movabs $0x9400000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_94int64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 32
%5 = and i64 %4, 148
%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_94int64_highword_reg(i64 %0) {
%2 = and i64 %0, 635655159808
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ rand_s(unsigned int *);
unsigned int random_gen() {
  unsigned int Num = 0;
  rand_s(&Num);
  return Num;
}


x86 assembly (clang, -O0):
<random_gen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <rand_s@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_gen>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <rand_s@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @random_gen() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @rand_s(i32* %1)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @random_gen() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @rand_s(i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}
int print_aux_limits() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @print_aux_limits() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assem_debug(char *);
int /*<<< orphan*/ output_byte(int);
void emit_pusha(void) {
  assem_debug("pusha");
  output_byte(0x60);
}


x86 assembly (clang, -O0):
<emit_pusha>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <assem_debug@plt>
mov    $0x60,%edi
call   1040 <output_byte@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_pusha>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <assem_debug@plt>
mov    $0x60,%edi
pop    %rax
jmp    1040 <output_byte@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"pusha\00"
define void @emit_pusha() {
%1 = call i32 @assem_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @output_byte(i32 96)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"pusha\00"
define void @emit_pusha() {
%1 = tail call i32 @assem_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @output_byte(i32 96)
ret void
}
void USBHostAddrSet(unsigned long ulBase, unsigned long ulEndpoint,
                    unsigned long ulAddr, unsigned long ulFlags) {
  ;

  ;
  if (ulFlags & 0x00002000) {
    (*((volatile unsigned char *)(ulBase + 0x00000080 + (ulEndpoint >> 1)))) =
        ulAddr;
  } else {
    (*((volatile unsigned char *)(ulBase + 0x00000080 + 4 +
                                  (ulEndpoint >> 1)))) = ulAddr;
  }
}


x86 assembly (clang, -O0):
<USBHostAddrSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
and    $0x2000,%rax
cmp    $0x0,%rax
je     114a <USBHostAddrSet+0x4a>
mov    -0x18(%rbp),%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
add    $0x80,%rax
mov    -0x10(%rbp),%rdx
shr    $0x1,%rdx
add    %rdx,%rax
mov    %cl,(%rax)
jmp    116b <USBHostAddrSet+0x6b>
mov    -0x18(%rbp),%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
add    $0x80,%rax
add    $0x4,%rax
mov    -0x10(%rbp),%rdx
shr    $0x1,%rdx
add    %rdx,%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBHostAddrSet>:
xor    %eax,%eax
test   $0x2000,%ecx
sete   %al
lea    (%rdi,%rax,4),%rax
shr    %rsi
mov    %dl,0x80(%rsi,%rax,1)
ret

LLVM IR (-O0):
define void @USBHostAddrSet(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load i64, i64* %8
%10 = and i64 %9, 8192
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %21
12: ; preds = %4
%13 = load i64, i64* %7
%14 = trunc i64 %13 to i8
%15 = load i64, i64* %5
%16 = add i64 %15, 128
%17 = load i64, i64* %6
%18 = lshr i64 %17, 1
%19 = add i64 %16, %18
%20 = inttoptr i64 %19 to i8*
store volatile i8 %14, i8* %20
br label %31
21: ; preds = %4
%22 = load i64, i64* %7
%23 = trunc i64 %22 to i8
%24 = load i64, i64* %5
%25 = add i64 %24, 128
%26 = add i64 %25, 4
%27 = load i64, i64* %6
%28 = lshr i64 %27, 1
%29 = add i64 %26, %28
%30 = inttoptr i64 %29 to i8*
store volatile i8 %23, i8* %30
br label %31
31: ; preds = %21, %12
ret void
}

LLVM IR (-O2):
define void @USBHostAddrSet(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = and i64 %3, 8192
%6 = icmp eq i64 %5, 0
%7 = trunc i64 %2 to i8
%8 = select i1 %6, i64 132, i64 128
%9 = add i64 %8, %0
%10 = lshr i64 %1, 1
%11 = add i64 %9, %10
%12 = inttoptr i64 %11 to i8*
store volatile i8 %7, i8* %12
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage() {
  printf("Usage: dynamic <model> <params> [<file>]\n"
         "if file is not given, output to stdout\n"
         "Available models and mandatory parameters:\n"
         "   SI:   <n> <alfa>\n"
         "   SIS:  <n> <alfa> <beta>\n"
         "   SIR:  <n> <alfa> <beta>\n"
         "   SEIR: <n> <alfa> <beta> <gamma>\n"
         "   DK:   <n> <alfa> <beta>\n");
}


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

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

LLVM IR (-O0):
@.str = [260 x i8] c"Usage: dynamic <model> <params> [<file>]\0Aif file is not given, output to stdout\0AAvailable models and mandatory parameters:\0A SI: <n> <alfa>\0A SIS: <n> <alfa> <beta>\0A SIR: <n> <alfa> <beta>\0A SEIR: <n> <alfa> <beta> <gamma>\0A DK: <n> <alfa> <beta>\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([260 x i8], [260 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [259 x i8] c"Usage: dynamic <model> <params> [<file>]\0Aif file is not given, output to stdout\0AAvailable models and mandatory parameters:\0A SI: <n> <alfa>\0A SIS: <n> <alfa> <beta>\0A SIR: <n> <alfa> <beta>\0A SEIR: <n> <alfa> <beta> <gamma>\0A DK: <n> <alfa> <beta>\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([259 x i8], [259 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct option {
  int dummy;
};

/* Variables and functions */
int _getopt_internal(int, char *const *, char const *, struct option const *,
                     int *, int /*<<< orphan*/);
int getopt_long(int argc, char *const *argv, const char *options,
                const struct option *long_options, int *opt_index) {
  return _getopt_internal(argc, argv, options, long_options, opt_index, 0);
}


x86 assembly (clang, -O0):
<getopt_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
xor    %r9d,%r9d
call   1030 <_getopt_internal@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getopt_long>:
xor    %r9d,%r9d
jmp    1030 <_getopt_internal@plt>

LLVM IR (-O0):
%struct.option = type { i32 }
define i32 @getopt_long(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca %struct.option*
%10 = alloca i32*
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i8* %2, i8** %8
store %struct.option* %3, %struct.option** %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = load i8**, i8*** %7
%13 = load i8*, i8** %8
%14 = load %struct.option*, %struct.option** %9
%15 = load i32*, i32** %10
%16 = call i32 @_getopt_internal(i32 %11, i8** %12, i8* %13, %struct.option* %14, i32* %15, i32 0)
ret i32 %16
}

LLVM IR (-O2):
%struct.option = type { i32 }
define i32 @getopt_long(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = tail call i32 @_getopt_internal(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4, i32 0)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ panic(char *, char *, int /*<<< orphan*/);
void int_17(void) { panic("Alignment Check", "#AC", 0); }


x86 assembly (clang, -O0):
<int_17>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xeee(%rip),%rsi
xor    %edx,%edx
call   1030 <panic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_17>:
lea    0xee9(%rip),%rdi
lea    0xef2(%rip),%rsi
xor    %edx,%edx
jmp    1030 <panic@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Alignment Check\00"
@.str.1 = [4 x i8] c"#AC\00"
define void @int_17() {
%1 = call i32 @panic(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"Alignment Check\00"
@.str.1 = [4 x i8] c"#AC\00"
define void @int_17() {
%1 = tail call i32 @panic(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}