xunge/DecIR huggingface dataset:
int test_008(int a, int b, int c) {
  int x = a > 1;
  int y = b - x;
  return c + y;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x1,-0x4(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
xor    %eax,%eax
cmp    $0x2,%edi
setge  %al
sub    %eax,%esi
lea    (%rsi,%rdx,1),%eax
ret

LLVM IR (-O0):
define i32 @test_008(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 1
%11 = zext i1 %10 to i32
store i32 %11, i32* %7
%12 = load i32, i32* %5
%13 = load i32, i32* %7
%14 = sub nsw i32 %12, %13
store i32 %14, i32* %8
%15 = load i32, i32* %6
%16 = load i32, i32* %8
%17 = add nsw i32 %15, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @test_008(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, 1
%5 = sext i1 %4 to i32
%6 = add i32 %5, %1
%7 = add nsw i32 %6, %2
ret i32 %7
}
/* Variables and functions */
int strlen(char *s) {
  int i;
  while (*s++) {
    ++i;
  }
  return i;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     112e <strlen+0x2e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1108 <strlen+0x8>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111d <strlen+0x1d>
add    $0x1,%rdi
nopl   0x0(%rax)
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <strlen+0x10>
ret
ret

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

LLVM IR (-O2):
define i32 @strlen(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 i32 [ %8, %4 ], [ undef, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add nsw i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ undef, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ BNCIO(int);
int BNCDigitDown() {
  int ii, stat = 99;
  char com1, data;
  BNCIO(43);
  return (stat);
}


x86 assembly (clang, -O0):
<BNCDigitDown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x63,-0x8(%rbp)
mov    $0x2b,%edi
call   1030 <BNCIO@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BNCDigitDown>:
push   %rax
mov    $0x2b,%edi
call   1030 <BNCIO@plt>
mov    $0x63,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @BNCDigitDown() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = alloca i8
store i32 99, i32* %2
%5 = call i32 @BNCIO(i32 43)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
define i32 @BNCDigitDown() {
%1 = tail call i32 @BNCIO(i32 43)
ret i32 99
}
/* Variables and functions */
int /*<<< orphan*/ Permute(char *);
int main() {
  char s[] = "ABCD";
  Permute(s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xee2(%rip),%eax
mov    %eax,-0x5(%rbp)
mov    0xedd(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0x5(%rbp),%rdi
call   1030 <Permute@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movb   $0x0,0x4(%rsp)
movl   $0x44434241,(%rsp)
mov    %rsp,%rdi
call   1030 <Permute@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.s = [5 x i8] c"ABCD\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = bitcast [5 x i8]* %1 to i8*
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = call i32 @Permute(i8* %3)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [5 x i8] c"ABCD\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%3 = call i32 @Permute(i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ HelloWorld(char *);
int main() {
  HelloWorld("Hello world");
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"Hello world\00"
define i32 @main() {
%1 = tail call i32 @HelloWorld(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
short A7board_available() { return 1; }


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

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

LLVM IR (-O0):
define signext i16 @A7board_available() {
ret i16 1
}

LLVM IR (-O2):
define signext i16 @A7board_available() {
ret i16 1
}
/* Type definitions */
struct str {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ str_append_string(struct str *, char *);
extern void str_append_int(struct str *str, int i) {
  char s[30];
  sprintf(s, "%d", i);
  str_append_string(str, s);
}


x86 assembly (clang, -O0):
<str_append_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xec3(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <str_append_string@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_append_int>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %esi,%edx
mov    %rdi,%rbx
lea    0xecd(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <str_append_string@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.str = type { i32 }
@.str = [3 x i8] c"%d\00"
define void @str_append_int(%struct.str* %0, i32 %1) {
%3 = alloca %struct.str*
%4 = alloca i32
%5 = alloca [30 x i8]
store %struct.str* %0, %struct.str** %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%7 = load i32, i32* %4
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load %struct.str*, %struct.str** %3
%10 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%11 = call i32 @str_append_string(%struct.str* %9, i8* %10)
ret void
}

LLVM IR (-O2):
%struct.str = type { i32 }
@.str = [3 x i8] c"%d\00"
define void @str_append_int(%struct.str* %0, i32 %1) {
%3 = alloca [30 x i8]
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
%6 = call i32 @str_append_string(%struct.str* %0, i8* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __cpuid_count(int, int /*<<< orphan*/, unsigned int,
                                 unsigned int, unsigned int, unsigned int);
int __get_cpuid_max(int /*<<< orphan*/, int /*<<< orphan*/ *);
int cpu_has_hle(void) {
  if (__get_cpuid_max(0, NULL) >= 7) {
    unsigned a, b, c, d;
    __cpuid_count(7, 0, a, b, c, d);
    return !!(b & (1 << 4));
  }
  return 0;
}


x86 assembly (clang, -O0):
<cpu_has_hle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <__get_cpuid_max@plt>
cmp    $0x7,%eax
jl     1173 <cpu_has_hle+0x53>
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    $0x7,%edi
xor    %esi,%esi
call   1040 <__cpuid_count@plt>
mov    -0xc(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    117a <cpu_has_hle+0x5a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_has_hle>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
call   1030 <__get_cpuid_max@plt>
cmp    $0x7,%eax
jl     113b <cpu_has_hle+0x1b>
mov    $0x7,%edi
xor    %esi,%esi
call   1040 <__cpuid_count@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @cpu_has_hle() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = call i32 @__get_cpuid_max(i32 0, i32* null)
%7 = icmp sge i32 %6, 7
br i1 %7, label %8, label %20
8: ; preds = %0
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = call i32 @__cpuid_count(i32 7, i32 0, i32 %9, i32 %10, i32 %11, i32 %12)
%14 = load i32, i32* %3
%15 = and i32 %14, 16
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
%18 = xor i1 %17, true
%19 = zext i1 %18 to i32
store i32 %19, i32* %1
br label %21
20: ; preds = %0
store i32 0, i32* %1
br label %21
21: ; preds = %20, %8
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
define i32 @cpu_has_hle() {
%1 = tail call i32 @__get_cpuid_max(i32 0, i32* null)
%2 = icmp sgt i32 %1, 6
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @__cpuid_count(i32 7, i32 0, i32 undef, i32 undef, i32 undef, i32 undef)
br label %5
5: ; preds = %0, %3
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  (void)fprintf(stderr, "Usage: unlink"
                        " oldpath newpath\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"Usage: unlink oldpath newpath\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"Usage: unlink oldpath newpath\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ appuyezEntree(char *);
int /*<<< orphan*/ lireEtAfficher(char *);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ titre(char *, int);
void afficherTexteNouvellePartie(void) {
  system("clear");
  titre("Rhyddid", 32);
  lireEtAfficher("Histoire_Rhyddid/Texte_Debut_Nouvelle_Partie.txt");
  appuyezEntree("Appuyez sur ENTREE pour accepter la mission...");
}


x86 assembly (clang, -O0):
<afficherTexteNouvellePartie>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
call   1030 <system@plt>
lea    0xeaf(%rip),%rdi
mov    $0x20,%esi
call   1050 <titre@plt>
lea    0xea6(%rip),%rdi
call   1040 <lireEtAfficher@plt>
lea    0xecb(%rip),%rdi
call   1060 <appuyezEntree@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<afficherTexteNouvellePartie>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1030 <system@plt>
lea    0xeb2(%rip),%rdi
mov    $0x20,%esi
call   1050 <titre@plt>
lea    0xea9(%rip),%rdi
call   1040 <lireEtAfficher@plt>
lea    0xece(%rip),%rdi
pop    %rax
jmp    1060 <appuyezEntree@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [8 x i8] c"Rhyddid\00"
@.str.2 = [49 x i8] c"Histoire_Rhyddid/Texte_Debut_Nouvelle_Partie.txt\00"
@.str.3 = [47 x i8] c"Appuyez sur ENTREE pour accepter la mission...\00"
define void @afficherTexteNouvellePartie() {
%1 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @titre(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 32)
%3 = call i32 @lireEtAfficher(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @appuyezEntree(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [8 x i8] c"Rhyddid\00"
@.str.2 = [49 x i8] c"Histoire_Rhyddid/Texte_Debut_Nouvelle_Partie.txt\00"
@.str.3 = [47 x i8] c"Appuyez sur ENTREE pour accepter la mission...\00"
define void @afficherTexteNouvellePartie() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @titre(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 32)
%3 = tail call i32 @lireEtAfficher(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @appuyezEntree(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0))
ret void
}
void glBlendEquation(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glBlendEquation() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ SIGUSR1;
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
void tell_child(pid_t pid) { kill(pid, SIGUSR1); }


x86 assembly (clang, -O0):
<tell_child>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
call   1030 <kill@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tell_child>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
jmp    1030 <kill@plt>

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

LLVM IR (-O2):
@SIGUSR1 = global i32 0
define void @tell_child(i32 %0) {
%2 = load i32, i32* @SIGUSR1
%3 = tail call i32 @kill(i32 %0, i32 %2)
ret void
}
void glEnable(int a) {}


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

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

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

LLVM IR (-O2):
define void @glEnable(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ printf(char *);
long double strtold(const char *s, char **endp) {
  printf("strtold NYI\n");
  abort();
}


x86 assembly (clang, -O0):
<strtold>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<strtold>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"strtold NYI\0A\00"
define x86_fp80 @strtold(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
store i8* %0, i8** %3
store i8** %1, i8*** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@str = [12 x i8] c"strtold NYI\00"
define x86_fp80 @strtold(i8* nocapture readnone %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @abort()
unreachable
}
cbuf1(f, n) int f, n;
{ cbuf(f, n, 1); }


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

x86 assembly (clang, -O2):
<cbuf1>:
mov    $0x1,%edx
xor    %eax,%eax
jmp    1030 <cbuf@plt>

LLVM IR (-O0):
define i32 @cbuf1(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 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %6, i32 %7, i32 1)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @cbuf1(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %0, i32 %1, i32 1)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
main() {
  int a[8] = {1};
  int i;
  for (i = 1; i < 8; i++)
    if (a[i] != 0)
      abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x1,-0x34(%rbp)
cmpl   $0x8,-0x34(%rbp)
jge    1195 <main+0x75>
movslq -0x34(%rbp),%rax
cmpl   $0x0,-0x30(%rbp,%rax,4)
je     1182 <main+0x62>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1187 <main+0x67>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1162 <main+0x42>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@__const.main.a = [8 x i32] [i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0]
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [8 x i32]* %2 to i8*
store i32 1, i32* %3
br label %5
5: ; preds = %17, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 8
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %8
br label %17
17: ; preds = %16
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %5
20: ; preds = %5
%21 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
int foo(int *p, int v) {
  if (p == 0) {
    return v + 1;
  } else {
    return v - 1;
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1124 <foo+0x24>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112d <foo+0x2d>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
neg    %rdi
sbb    %eax,%eax
or     $0x1,%eax
add    %esi,%eax
ret

LLVM IR (-O0):
define i32 @foo(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 = icmp eq i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* %5
%10 = add nsw i32 %9, 1
store i32 %10, i32* %3
br label %14
11: ; preds = %2
%12 = load i32, i32* %5
%13 = sub nsw i32 %12, 1
store i32 %13, i32* %3
br label %14
14: ; preds = %11, %8
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @foo(i32* readnone %0, i32 %1) {
%3 = icmp eq i32* %0, null
%4 = select i1 %3, i32 1, i32 -1
%5 = add nsw i32 %4, %1
ret i32 %5
}
int inNashset(int x, int ne, int ns[ne]) {
  int i;
  int ret = 0;
  for (i = 0; i < ne; i++)
    if (x == ns[i]) {
      ret = 1;
      break;
    }
  return ret;
}


x86 assembly (clang, -O0):
<inNashset>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    115b <inNashset+0x5b>
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    1148 <inNashset+0x48>
movl   $0x1,-0x18(%rbp)
jmp    115b <inNashset+0x5b>
jmp    114d <inNashset+0x4d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111c <inNashset+0x1c>
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inNashset>:
test   %esi,%esi
jle    111e <inNashset+0x1e>
mov    %esi,%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmp    %edi,(%rdx,%rcx,4)
je     1121 <inNashset+0x21>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1110 <inNashset+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @inNashset(i32 %0, i32 %1, i32* nocapture %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %15
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %14, %6
br i1 %8, label %15, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %14, %7 ]
%11 = getelementptr inbounds i32, i32* %2, i64 %10
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, %0
%14 = add nuw nsw i64 %10, 1
br i1 %13, label %15, label %7
15: ; preds = %7, %9, %3
%16 = phi i32 [ 0, %3 ], [ 1, %9 ], [ 0, %7 ]
ret i32 %16
}
__attribute__((no, noclone)) unsigned __int128 t120_3mul(signed __int128 y) {
  unsigned __int128 r;
  if (__builtin_mul_overflow((signed __int128)(-1), y, &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t120_3mul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rdi
mov    %rdi,%rsi
sar    $0x3f,%rsi
xor    %eax,%eax
neg    %rdx
mov    %rax,%rcx
sbb    %rdi,%rcx
sbb    %rsi,%rax
and    $0x1,%al
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x38(%rbp)
test   $0x1,%al
jne    1164 <t120_3mul+0x54>
jmp    116b <t120_3mul+0x5b>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t120_3mul>:
push   %r14
push   %rbx
push   %rax
xor    %r14d,%r14d
mov    %rdi,%rbx
neg    %rbx
sbb    %rsi,%r14
cmp    $0x1,%rdi
sbb    $0x0,%rsi
jl     1131 <t120_3mul+0x21>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %rbx,%rax
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t120_3mul(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = alloca i128
%7 = bitcast i128* %4 to { i64, i64 }*
%8 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 0
store i64 %0, i64* %8
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 1
store i64 %1, i64* %9
%10 = load i128, i128* %4
store i128 %10, i128* %5
%11 = load i128, i128* %5
%12 = sext i128 %11 to i129
%13 = call { i129, i1 } @llvm.smul.with.overflow.i129(i129 -1, i129 %12)
%14 = extractvalue { i129, i1 } %13, 1
%15 = extractvalue { i129, i1 } %13, 0
%16 = trunc i129 %15 to i128
%17 = zext i128 %16 to i129
%18 = icmp ne i129 %15, %17
%19 = or i1 %14, %18
store i128 %16, i128* %6
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 (...) @bar()
br label %22
22: ; preds = %20, %2
%23 = load i128, i128* %6
store i128 %23, i128* %3
%24 = bitcast i128* %3 to { i64, i64 }*
%25 = load { i64, i64 }, { i64, i64 }* %24
ret { i64, i64 } %25
}

LLVM IR (-O2):
define { i64, i64 } @t120_3mul(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = zext i128 %6 to i129
%8 = sub nsw i129 0, %7
%9 = icmp sgt i128 %6, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (...) @bar()
br label %12
12: ; preds = %10, %2
%13 = trunc i129 %8 to i64
%14 = lshr i129 %8, 64
%15 = trunc i129 %14 to i64
%16 = insertvalue { i64, i64 } poison, i64 %13, 0
%17 = insertvalue { i64, i64 } %16, i64 %15, 1
ret { i64, i64 } %17
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int solve_problem(int);
int main() {
  int num;
  num = solve_problem(1);
  printf("num=%d\n", num);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"num=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @solve_problem(i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
void XrmGetDatabase() {}


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

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

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

LLVM IR (-O2):
define void @XrmGetDatabase() {
ret void
}
int vde_chain_nm6_work(int *sz_arg, int *sz_res, int *sz_iw, int *sz_w) {
  if (sz_arg)
    *sz_arg = 4;
  if (sz_res)
    *sz_res = 3;
  if (sz_iw)
    *sz_iw = 0;
  if (sz_w)
    *sz_w = 69;
  return 0;
}


x86 assembly (clang, -O0):
<vde_chain_nm6_work>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1129 <vde_chain_nm6_work+0x29>
mov    -0x8(%rbp),%rax
movl   $0x4,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     113e <vde_chain_nm6_work+0x3e>
mov    -0x10(%rbp),%rax
movl   $0x3,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     1153 <vde_chain_nm6_work+0x53>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     1168 <vde_chain_nm6_work+0x68>
mov    -0x20(%rbp),%rax
movl   $0x45,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vde_chain_nm6_work>:
test   %rdi,%rdi
je     110b <vde_chain_nm6_work+0xb>
movl   $0x4,(%rdi)
test   %rsi,%rsi
je     1116 <vde_chain_nm6_work+0x16>
movl   $0x3,(%rsi)
test   %rdx,%rdx
je     1121 <vde_chain_nm6_work+0x21>
movl   $0x0,(%rdx)
test   %rcx,%rcx
je     112c <vde_chain_nm6_work+0x2c>
movl   $0x45,(%rcx)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @vde_chain_nm6_work(i32* writeonly %0, i32* writeonly %1, i32* writeonly %2, i32* writeonly %3) {
%5 = icmp eq i32* %0, null
br i1 %5, label %7, label %6
6: ; preds = %4
store i32 4, i32* %0
br label %7
7: ; preds = %6, %4
%8 = icmp eq i32* %1, null
br i1 %8, label %10, label %9
9: ; preds = %7
store i32 3, i32* %1
br label %10
10: ; preds = %9, %7
%11 = icmp eq i32* %2, null
br i1 %11, label %13, label %12
12: ; preds = %10
store i32 0, i32* %2
br label %13
13: ; preds = %12, %10
%14 = icmp eq i32* %3, null
br i1 %14, label %16, label %15
15: ; preds = %13
store i32 69, i32* %3
br label %16
16: ; preds = %15, %13
ret i32 0
}
/* Variables and functions */
size_t strlen(char const *);
int isString(const char *image) {
  size_t len = strlen(image);
  return (len >= 2 && image[0] == '"' && image[len - 1] == '"');
}


x86 assembly (clang, -O0):
<isString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x2,-0x10(%rbp)
mov    %al,-0x11(%rbp)
jb     1167 <isString+0x57>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x22,%ecx
mov    %al,-0x11(%rbp)
jne    1167 <isString+0x57>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x22,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isString>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x2,%rcx
jb     1133 <isString+0x23>
cmpb   $0x22,(%rbx)
jne    1133 <isString+0x23>
xor    %eax,%eax
cmpb   $0x22,-0x1(%rcx,%rbx,1)
sete   %al
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @isString(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = icmp ugt i64 %2, 1
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 34
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = add i64 %2, -1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 34
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %7, %4, %1
%14 = phi i32 [ 0, %4 ], [ 0, %1 ], [ %12, %7 ]
ret i32 %14
}
int phy_suspend(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @phy_suspend() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ BUFSIZ;
int /*<<< orphan*/ _IOFBF;
int /*<<< orphan*/ _IONBF;
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/ *, char *, int /*<<< orphan*/,
                           int /*<<< orphan*/);
void setbuf(FILE *fp, char *buf) {
  if (buf != NULL) {
    setvbuf(fp, buf, _IOFBF, BUFSIZ);
  } else {
    setvbuf(fp, buf, _IONBF, BUFSIZ);
  };
}


x86 assembly (clang, -O0):
<setbuf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114f <setbuf+0x3f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2e96(%rip),%rax
mov    (%rax),%edx
mov    0x2e95(%rip),%rax
mov    (%rax),%ecx
call   1030 <setvbuf@plt>
jmp    116e <setbuf+0x5e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2e8a(%rip),%rax
mov    (%rax),%edx
mov    0x2e71(%rip),%rax
mov    (%rax),%ecx
call   1030 <setvbuf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setbuf>:
test   %rsi,%rsi
je     112c <setbuf+0x1c>
mov    0x2eb4(%rip),%rax
mov    (%rax),%edx
mov    0x2eb3(%rip),%rax
mov    (%rax),%ecx
jmp    1030 <setvbuf@plt>
mov    0x2eb5(%rip),%rax
mov    (%rax),%edx
mov    0x2e9c(%rip),%rax
mov    (%rax),%ecx
xor    %esi,%esi
jmp    1030 <setvbuf@plt>

LLVM IR (-O0):
@_IOFBF = global i32 0
@BUFSIZ = global i32 0
@_IONBF = global i32 0
define void @setbuf(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32*, i32** %3
%9 = load i8*, i8** %4
%10 = load i32, i32* @_IOFBF
%11 = load i32, i32* @BUFSIZ
%12 = call i32 @setvbuf(i32* %8, i8* %9, i32 %10, i32 %11)
br label %19
13: ; preds = %2
%14 = load i32*, i32** %3
%15 = load i8*, i8** %4
%16 = load i32, i32* @_IONBF
%17 = load i32, i32* @BUFSIZ
%18 = call i32 @setvbuf(i32* %14, i8* %15, i32 %16, i32 %17)
br label %19
19: ; preds = %13, %7
ret void
}

LLVM IR (-O2):
@_IOFBF = global i32 0
@BUFSIZ = global i32 0
@_IONBF = global i32 0
define void @setbuf(i32* nocapture %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @_IOFBF
%6 = load i32, i32* @BUFSIZ
%7 = tail call i32 @setvbuf(i32* %0, i8* %1, i32 %5, i32 %6)
br label %12
8: ; preds = %2
%9 = load i32, i32* @_IONBF
%10 = load i32, i32* @BUFSIZ
%11 = tail call i32 @setvbuf(i32* %0, i8* null, i32 %9, i32 %10)
br label %12
12: ; preds = %8, %4
ret void
}
unsigned int max(unsigned int a, unsigned int b) {
  if (a > b) {
    return a;
  } else {
    return b;
  }
  __builtin_unreachable();
}


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

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

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

LLVM IR (-O2):
define i32 @max(i32 %0, i32 %1) {
%3 = icmp ugt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
long double __divtf3(long double a __attribute__((unused)),
                     long double b __attribute__((unused))) {
  return 0.0;
}


x86 assembly (clang, -O0):
<__divtf3>:
push   %rbp
mov    %rsp,%rbp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
fldz
pop    %rbp
ret

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

LLVM IR (-O0):
define x86_fp80 @__divtf3(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %3
store x86_fp80 %1, x86_fp80* %4
ret x86_fp80 0xK00000000000000000000
}

LLVM IR (-O2):
define x86_fp80 @__divtf3(x86_fp80 %0, x86_fp80 %1) {
ret x86_fp80 0xK00000000000000000000
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void usage(int exitval) {
  fprintf(exitval ? stderr : stdout,
          "Usage: vfs-concat IMAGE BLOCKSZ FILE\n"
          "Concatenate FILE to existing ethersex IMAGE.\n\n");
  exit(exitval);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1146 <usage+0x26>
mov    0x2ea4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1152 <usage+0x32>
mov    0x2e8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    0xea4(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %edi,%ebx
test   %edi,%edi
jne    1130 <usage+0x10>
mov    0x2eaa(%rip),%rax
jmp    1137 <usage+0x17>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@stdout = global i32 0
@.str = [84 x i8] c"Usage: vfs-concat IMAGE BLOCKSZ FILE\0AConcatenate FILE to existing ethersex IMAGE.\0A\0A\00"
define void @usage(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load i32, i32* @stderr
br label %9
7: ; preds = %1
%8 = load i32, i32* @stdout
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ %6, %5 ], [ %8, %7 ]
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %2
%13 = call i32 @exit(i32 %12)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@stdout = global i32 0
@.str = [84 x i8] c"Usage: vfs-concat IMAGE BLOCKSZ FILE\0AConcatenate FILE to existing ethersex IMAGE.\0A\0A\00"
define void @usage(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = load i32, i32* @stderr
%4 = load i32, i32* @stdout
%5 = select i1 %2, i32 %4, i32 %3
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 %0)
unreachable
}
void __of_remove_property_sysfs(struct device_node *np, struct property *prop) {
}


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

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

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

LLVM IR (-O2):
%struct.device_node = type opaque
%struct.property = type opaque
define void @__of_remove_property_sysfs(%struct.device_node* nocapture %0, %struct.property* nocapture %1) {
ret void
}
float Section2Area(float radius) { return radius * radius * 3.141592; }


x86 assembly (clang, -O0):
<Section2Area>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xee1(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Section2Area>:
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xef0(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @Section2Area(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = load float, float* %2
%5 = fmul float %3, %4
%6 = fpext float %5 to double
%7 = fmul double %6, 0x400921FAFC8B007A
%8 = fptrunc double %7 to float
ret float %8
}

LLVM IR (-O2):
define float @Section2Area(float %0) {
%2 = fmul float %0, %0
%3 = fpext float %2 to double
%4 = fmul double %3, 0x400921FAFC8B007A
%5 = fptrunc double %4 to float
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ LINUX_REBOOT_CMD_RESTART;
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ reboot(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  puts("hello, KVM guest!\r");
  reboot(LINUX_REBOOT_CMD_RESTART);
  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)
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
call   1040 <reboot@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [19 x i8] c"hello, KVM guest!\0D\00"
@LINUX_REBOOT_CMD_RESTART = global i32 0
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 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @LINUX_REBOOT_CMD_RESTART
%8 = call i32 @reboot(i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"hello, KVM guest!\0D\00"
@LINUX_REBOOT_CMD_RESTART = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @LINUX_REBOOT_CMD_RESTART
%5 = tail call i32 @reboot(i32 %4)
ret i32 0
}
void f2(void) {
  char buf[1000];
  int i;
  for (i = 0; i < sizeof(buf); i++) {
    buf[i] = 0;
  }
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x380,%rsp
movl   $0x0,-0x3f4(%rbp)
movslq -0x3f4(%rbp),%rax
cmp    $0x3e8,%rax
jae    114b <f2+0x4b>
movslq -0x3f4(%rbp),%rax
movb   $0x0,-0x3f0(%rbp,%rax,1)
mov    -0x3f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3f4(%rbp)
jmp    1115 <f2+0x15>
add    $0x380,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f2() {
%1 = alloca [1000 x i8]
%2 = alloca i32
store i32 0, i32* %2
br label %3
3: ; preds = %11, %0
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = icmp ult i64 %5, 1000
br i1 %6, label %7, label %14
7: ; preds = %3
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %9
store i8 0, i8* %10
br label %11
11: ; preds = %7
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %3
14: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @f2() {
ret void
}
/* Variables and functions */
size_t __off(const char *const a, const char *const b) {
  return (size_t)(b - a);
}


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

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

LLVM IR (-O0):
define i64 @__off(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i8*, i8** %3
%7 = ptrtoint i8* %5 to i64
%8 = ptrtoint i8* %6 to i64
%9 = sub i64 %7, %8
ret i64 %9
}

LLVM IR (-O2):
define i64 @__off(i8* %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = ptrtoint i8* %0 to i64
%5 = sub i64 %3, %4
ret i64 %5
}
void SIO1configure() {}


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

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

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

LLVM IR (-O2):
define void @SIO1configure() {
ret void
}
int check_bit(unsigned char data, unsigned char bit) {
  return (data | bit) ? 1 : 0;
}


x86 assembly (clang, -O0):
<check_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%edx
movzbl -0x2(%rbp),%eax
or     %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_bit>:
xor    %eax,%eax
or     %esi,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @check_bit(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
%9 = or i32 %6, %8
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i64
%12 = select i1 %10, i32 1, i32 0
ret i32 %12
}

LLVM IR (-O2):
define i32 @check_bit(i8 zeroext %0, i8 zeroext %1) {
%3 = or i8 %1, %0
%4 = icmp ne i8 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
void block_api() {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<block_api>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <block_api+0x9>
jmp    1109 <block_api+0x9>

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

LLVM IR (-O0):
define void @block_api() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @block_api() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
size_t strlen(char const *);
char *my_strdup(const char *s) {
  size_t len = strlen(s);
  char *dst = malloc(len + 1);
  if (!dst)
    return NULL;
  memcpy(dst, s, len + 1);
  return dst;
}


x86 assembly (clang, -O0):
<my_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1172 <my_strdup+0x42>
movq   $0x0,-0x8(%rbp)
jmp    118f <my_strdup+0x5f>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x1,%rdx
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %rax,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
call   1050 <malloc@plt>
mov    %rax,%r15
test   %rax,%rax
je     1162 <my_strdup+0x32>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <memcpy@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @my_strdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @memcpy(i8* %4, i8* %0, i64 %3)
br label %8
8: ; preds = %1, %6
ret i8* %4
}