xunge/DecIR huggingface dataset:
x() {
  if (&&e - &&b < 0)
    x();
b:
  goto *&&b;
e:;
}


x86 assembly (clang, -O0):
<x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0x1d(%rip),%rcx
mov    $0x1,%eax
sub    %rcx,%rax
jns    1137 <x+0x27>
jmp    1132 <x+0x22>
call   1030 <x@plt>
jmp    113c <x+0x2c>
jmp    113c <x+0x2c>

x86 assembly (clang, -O2):
<x>:
lea    0x19(%rip),%rax
mov    $0x1,%ecx
cmp    %rax,%rcx
js     1132 <x+0x22>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
jmp    1130 <x+0x20>
push   %rax
call   1030 <x@plt>

LLVM IR (-O0):
define i32 @x() {
%1 = alloca i32
br i1 icmp slt (i64 sub (i64 ptrtoint (i8* blockaddress(@x, %6) to i64), i64 ptrtoint (i8* blockaddress(@x, %5) to i64)), i64 0), label %2, label %4
2: ; preds = %0
%3 = call i32 @x()
br label %4
4: ; preds = %2, %0
br label %5
5: ; preds = %5, %4, %8
br label %5
6: ; preds = %8
%7 = load i32, i32* %1
ret i32 %7
8: ; No predecessors!
indirectbr i8* undef, [label %6, label %5]
}

LLVM IR (-O2):
define i32 @x() {
br i1 icmp slt (i64 sub (i64 1, i64 ptrtoint (i8* blockaddress(@x, %3) to i64)), i64 0), label %1, label %3
1: ; preds = %0
%2 = tail call i32 @x()
unreachable
3: ; preds = %0, %3
br label %3
}
/* Variables and functions */
int isinf(double);
int tor_isinf(double x) { return isinf(x); }


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

x86 assembly (clang, -O2):
<tor_isinf>:
jmp    1030 <isinf@plt>

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

LLVM IR (-O2):
define i32 @tor_isinf(double %0) {
%2 = tail call i32 @isinf(double %0)
ret i32 %2
}
/* Type definitions */
struct stringbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ stringbuf_append(struct stringbuf *, char *, int);
void stringbuf_putc(struct stringbuf *sb, char cc) {
  stringbuf_append(sb, &cc, 1);
}


x86 assembly (clang, -O0):
<stringbuf_putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
call   1030 <stringbuf_append@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringbuf_putc>:
push   %rax
mov    %sil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <stringbuf_append@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.stringbuf = type { i32 }
define void @stringbuf_putc(%struct.stringbuf* %0, i8 signext %1) {
%3 = alloca %struct.stringbuf*
%4 = alloca i8
store %struct.stringbuf* %0, %struct.stringbuf** %3
store i8 %1, i8* %4
%5 = load %struct.stringbuf*, %struct.stringbuf** %3
%6 = call i32 @stringbuf_append(%struct.stringbuf* %5, i8* %4, i32 1)
ret void
}

LLVM IR (-O2):
%struct.stringbuf = type { i32 }
define void @stringbuf_putc(%struct.stringbuf* %0, i8 signext %1) {
%3 = alloca i8
store i8 %1, i8* %3
%4 = call i32 @stringbuf_append(%struct.stringbuf* %0, i8* %3, i32 1)
ret void
}
void initialize_cofold(int length) {}


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

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

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

LLVM IR (-O2):
define void @initialize_cofold(i32 %0) {
ret void
}
/* Variables and functions */
size_t lst_size(void *lst) {
  size_t count = 0;
  void *aux = lst;
LOOP:
  if (*(void **)aux) {
    count++;
    aux = *(void **)aux;
    goto LOOP;
  }
  return count;
}


x86 assembly (clang, -O0):
<lst_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     1142 <lst_size+0x42>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1118 <lst_size+0x18>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @lst_size(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %8, %2 ]
%4 = phi i8* [ %0, %1 ], [ %6, %2 ]
%5 = bitcast i8* %4 to i8**
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
%8 = add i64 %3, 1
br i1 %7, label %9, label %2
9: ; preds = %2
ret i64 %3
}
/* Variables and functions */
float atof(char *);
int /*<<< orphan*/ printf(char *, float);
int main() {
  char *a = "-100.23";
  char *b = "100e-2";
  float c;
  c = atof(a) + atof(b);
  printf("%f\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <atof@plt>
movaps %xmm0,%xmm1
movss  -0x20(%rbp),%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <atof@plt>
movss  %xmm0,0x4(%rsp)
lea    0xece(%rip),%rdi
call   1030 <atof@plt>
addss  0x4(%rsp),%xmm0
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"-100.23\00"
@.str.1 = [7 x i8] c"100e-2\00"
@.str.2 = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = tail call float @atof(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call float @atof(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%3 = fadd float %1, %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), float %3)
ret i32 0
}
int ez_horner_hash(char *_key, int _tsize) {
  int sum = 0;
  while (_key)
    sum = (sum << 5) + *_key++;
  return sum % _tsize;
}


x86 assembly (clang, -O0):
<ez_horner_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     113f <ez_horner_hash+0x3f>
mov    -0x10(%rbp),%eax
shl    $0x5,%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <ez_horner_hash+0x12>
mov    -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @ez_horner_hash(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
ret i32 0
}
char *Mystrcpy(char *strDest, const char *strSrc) {
  char *address = strDest;
  while ((*strDest++ = *strSrc++) != '\0')
    ;
  return address;
}


x86 assembly (clang, -O0):
<Mystrcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     1147 <Mystrcpy+0x47>
jmp    1114 <Mystrcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mystrcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <Mystrcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @Mystrcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
/* Type definitions */
struct utf8cursor {
  int dummy;
};
struct tree {
  int dummy;
};

/* Variables and functions */
int utf8ncursor(struct utf8cursor *, struct tree *, char const *, unsigned int);
int utf8cursor(struct utf8cursor *u8c, struct tree *tree, const char *s) {
  return utf8ncursor(u8c, tree, s, (unsigned int)-1);
}


x86 assembly (clang, -O0):
<utf8cursor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0xffffffff,%ecx
call   1030 <utf8ncursor@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf8cursor>:
mov    $0xffffffff,%ecx
jmp    1030 <utf8ncursor@plt>

LLVM IR (-O0):
%struct.utf8cursor = type { i32 }
%struct.tree = type { i32 }
define i32 @utf8cursor(%struct.utf8cursor* %0, %struct.tree* %1, i8* %2) {
%4 = alloca %struct.utf8cursor*
%5 = alloca %struct.tree*
%6 = alloca i8*
store %struct.utf8cursor* %0, %struct.utf8cursor** %4
store %struct.tree* %1, %struct.tree** %5
store i8* %2, i8** %6
%7 = load %struct.utf8cursor*, %struct.utf8cursor** %4
%8 = load %struct.tree*, %struct.tree** %5
%9 = load i8*, i8** %6
%10 = call i32 @utf8ncursor(%struct.utf8cursor* %7, %struct.tree* %8, i8* %9, i32 -1)
ret i32 %10
}

LLVM IR (-O2):
%struct.utf8cursor = type { i32 }
%struct.tree = type { i32 }
define i32 @utf8cursor(%struct.utf8cursor* %0, %struct.tree* %1, i8* %2) {
%4 = tail call i32 @utf8ncursor(%struct.utf8cursor* %0, %struct.tree* %1, i8* %2, i32 -1)
ret i32 %4
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int sd_bus_negotiate_timestamp(void *bus,
                                                                      int b) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_bus_negotiate_timestamp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
mov    0x2ecc(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_bus_negotiate_timestamp>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_bus_negotiate_timestamp(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @EINVAL
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_bus_negotiate_timestamp(i8* nocapture readnone %0, i32 %1) {
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}
void FMCloseTable(void) { return; }


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

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

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

LLVM IR (-O2):
define void @FMCloseTable() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isprint(int);
void t_isprint_0xa4() {
  Assert_real((isprint(164) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isprint.c",
              825, ("isprint should be 0 for 0xa4"));
}


x86 assembly (clang, -O0):
<t_isprint_0xa4>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa4,%edi
call   1030 <isprint@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x339,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isprint_0xa4>:
push   %rax
mov    $0xa4,%edi
call   1030 <isprint@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x339,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isprint.c\00"
@.str.1 = [29 x i8] c"isprint should be 0 for 0xa4\00"
define void @t_isprint_0xa4() {
%1 = call i64 @isprint(i32 164)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 825, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isprint.c\00"
@.str.1 = [29 x i8] c"isprint should be 0 for 0xa4\00"
define void @t_isprint_0xa4() {
%1 = tail call i64 @isprint(i32 164)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 825, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ list(char *);
int /*<<< orphan*/ stderr;
main(int argc, char **argv) {
  if (argc != 2)
    fprintf(stderr, "Usage: %s <DikuMUD playerfile-name>\n", argv[0]);
  else
    list(argv[1]);
}


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)
cmpl   $0x2,-0x8(%rbp)
je     1161 <main+0x41>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xea9(%rip),%rsi
call   1030 <fprintf@plt>
jmp    116e <main+0x4e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <list@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1131 <main+0x11>
mov    0x8(%rsi),%rdi
call   1040 <list@plt>
jmp    1149 <main+0x29>
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xebc(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"Usage: %s <DikuMUD playerfile-name>\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 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %19
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @list(i8* %17)
br label %19
19: ; preds = %14, %8
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"Usage: %s <DikuMUD playerfile-name>\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %12
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @list(i8* %10)
br label %12
12: ; preds = %8, %4
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ mq_unlink(char *);
void s_destroy() { mq_unlink("/ipcbench"); }


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"/ipcbench\00"
define void @s_destroy() {
%1 = call i32 @mq_unlink(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"/ipcbench\00"
define void @s_destroy() {
%1 = tail call i32 @mq_unlink(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void TCPhead(int osvers, int osrel, int ossub) {
  printf("inerr/s  retrans/s  attfail/s  "
         "estabreset/s  outreset/s         _tcp_");
}


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

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

LLVM IR (-O0):
@.str = [70 x i8] c"inerr/s retrans/s attfail/s estabreset/s outreset/s _tcp_\00"
define void @TCPhead(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [70 x i8] c"inerr/s retrans/s attfail/s estabreset/s outreset/s _tcp_\00"
define void @TCPhead(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ starp(int);
int main(int argc, char const *argv[]) {
  starp(10);
  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    $0xa,%edi
call   1030 <starp@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1030 <starp@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
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 @starp(i32 10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @starp(i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sched_yield();
void rathread_yield(void) { sched_yield(); }


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

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

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

LLVM IR (-O2):
define void @rathread_yield() {
%1 = tail call i32 (...) @sched_yield()
ret void
}
void echpint(int **a, int **b) {
  printf("avant a,b : %d,%d\n", *a, *b);
  int **t;
  *t = *a;
  *a = *b;
  *b = *t;
  printf("apres a,b : %d,%d\n", *a, *b);
}


x86 assembly (clang, -O0):
<echpint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<echpint>:
push   %rax
mov    (%rdi),%rax
mov    (%rsi),%rdx
lea    0xee2(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"avant a,b : %d,%d\0A\00"
@.str.1 = [19 x i8] c"apres a,b : %d,%d\0A\00"
define void @echpint(i32** %0, i32** %1) {
%3 = alloca i32**
%4 = alloca i32**
%5 = alloca i32**
store i32** %0, i32*** %3
store i32** %1, i32*** %4
%6 = load i32**, i32*** %3
%7 = load i32*, i32** %6
%8 = load i32**, i32*** %4
%9 = load i32*, i32** %8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32* %7, i32* %9)
%11 = load i32**, i32*** %3
%12 = load i32*, i32** %11
%13 = load i32**, i32*** %5
store i32* %12, i32** %13
%14 = load i32**, i32*** %4
%15 = load i32*, i32** %14
%16 = load i32**, i32*** %3
store i32* %15, i32** %16
%17 = load i32**, i32*** %5
%18 = load i32*, i32** %17
%19 = load i32**, i32*** %4
store i32* %18, i32** %19
%20 = load i32**, i32*** %3
%21 = load i32*, i32** %20
%22 = load i32**, i32*** %4
%23 = load i32*, i32** %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* %21, i32* %23)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"avant a,b : %d,%d\0A\00"
define void @echpint(i32** nocapture %0, i32** nocapture %1) {
%3 = load i32*, i32** %0
%4 = load i32*, i32** %1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ back_mouse_up(double, double);
void front_mouse_up(double x, double y) { back_mouse_up(x, y); }


x86 assembly (clang, -O0):
<front_mouse_up>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <back_mouse_up@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<front_mouse_up>:
jmp    1030 <back_mouse_up@plt>

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

LLVM IR (-O2):
define void @front_mouse_up(double %0, double %1) {
%3 = tail call i32 @back_mouse_up(double %0, double %1)
ret void
}
/* Variables and functions */
char toupper(char);
void converte_maisculo(char *palavra) {
  while (*palavra) {
    *palavra = toupper(*palavra);
    palavra++;
  }
}


x86 assembly (clang, -O0):
<converte_maisculo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114e <converte_maisculo+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 <converte_maisculo+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<converte_maisculo>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1136 <converte_maisculo+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 <converte_maisculo+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @converte_maisculo(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 @converte_maisculo(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
}
/* Variables and functions */
int /*<<< orphan*/ putc(char const);
void putstr(const char *s) {
  while (*s) {
    putc(*s);
    if (*s == '\n')
      putc('\r');
    s++;
  }
}


x86 assembly (clang, -O0):
<putstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1160 <putstr+0x50>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putc@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    114f <putstr+0x3f>
mov    $0xd,%edi
call   1030 <putc@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <putstr+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putstr>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1145 <putstr+0x35>
mov    %rdi,%rbx
add    $0x1,%rbx
jmp    112b <putstr+0x1b>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1145 <putstr+0x35>
movsbl %al,%edi
call   1030 <putc@plt>
cmpb   $0xa,-0x1(%rbx)
jne    1120 <putstr+0x10>
mov    $0xd,%edi
call   1030 <putc@plt>
jmp    1120 <putstr+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @putstr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %12
%5 = phi i8 [ %14, %12 ], [ %2, %1 ]
%6 = phi i8* [ %13, %12 ], [ %0, %1 ]
%7 = tail call i32 @putc(i8 signext %5)
%8 = load i8, i8* %6
%9 = icmp eq i8 %8, 10
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = tail call i32 @putc(i8 signext 13)
br label %12
12: ; preds = %10, %4
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %12, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ display_menu();
int /*<<< orphan*/ get_user_input(char *, char *);
int /*<<< orphan*/ handle_command(char);
int main(int argc, char *argv[]) {
  char input[80];
  do {
    display_menu();
    get_user_input("Enter Option:", input);
    handle_command(input[0]);
  } while (input[0] != 'Q');
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <display_menu@plt>
lea    -0x60(%rbp),%rsi
lea    0xea8(%rip),%rdi
call   1030 <get_user_input@plt>
movsbl -0x60(%rbp),%edi
call   1040 <handle_command@plt>
movsbl -0x60(%rbp),%eax
cmp    $0x51,%eax
jne    1146 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
lea    0xec2(%rip),%r14
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <display_menu@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <get_user_input@plt>
movsbl (%rsp),%edi
call   1040 <handle_command@plt>
cmpb   $0x51,(%rsp)
jne    1150 <main+0x20>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Enter Option:\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [80 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %14, %2
%8 = call i32 (...) @display_menu()
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%10 = call i32 @get_user_input(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%12 = load i8, i8* %11
%13 = call i32 @handle_command(i8 signext %12)
br label %14
14: ; preds = %7
%15 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 81
br i1 %18, label %7, label %19
19: ; preds = %14
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@.str = [14 x i8] c"Enter Option:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [80 x i8]
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
br label %5
5: ; preds = %5, %2
%6 = call i32 (...) @display_menu()
%7 = call i32 @get_user_input(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %4)
%8 = load i8, i8* %4
%9 = call i32 @handle_command(i8 signext %8)
%10 = load i8, i8* %4
%11 = icmp eq i8 %10, 81
br i1 %11, label %12, label %5
12: ; preds = %5
ret i32 0
}
void RTAvloGCPhysGet(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvloGCPhysGet() {
ret void
}
int mullo(int a, int b) {
  asm("mul %%edx   # %%1 was %1"
      : "+"
        "a"(a),
        "+d"(b));
  return a;
}


x86 assembly (clang, -O0):
<mullo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%edx
mul    %edx
mov    %eax,-0x4(%rbp)
mov    %edx,-0x8(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mullo>:
mov    %esi,%edx
mov    %edi,%eax
mul    %edx
ret

LLVM IR (-O0):
define i32 @mullo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call { i32, i32 } asm "mul %edx # %1 was $1", "={ax},={dx},0,1,~{dirflag},~{fpsr},~{flags}"(i32 %5, i32 %6)
%8 = extractvalue { i32, i32 } %7, 0
%9 = extractvalue { i32, i32 } %7, 1
store i32 %8, i32* %3
store i32 %9, i32* %4
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @mullo(i32 %0, i32 %1) {
%3 = tail call { i32, i32 } asm "mul %edx # %1 was $1", "={ax},={dx},0,1,~{dirflag},~{fpsr},~{flags}"(i32 %0, i32 %1)
%4 = extractvalue { i32, i32 } %3, 0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ G_RegisterMapLocationName(char *);
void G_MapLocations_Init(void) { G_RegisterMapLocationName("someplace"); }


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"someplace\00"
define void @G_MapLocations_Init() {
%1 = call i32 @G_RegisterMapLocationName(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"someplace\00"
define void @G_MapLocations_Init() {
%1 = tail call i32 @G_RegisterMapLocationName(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int fib1(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int number, value;
  printf("Input number: ");
  scanf("%d", &number);
  value = fib1(number);
  printf("fibonacci(%d) = %d\n", number, value);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1040 <fib1@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <fib1@plt>
mov    0x4(%rsp),%esi
lea    0xeae(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Input number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"fibonacci(%d) = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = call i32 @fib1(i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Input number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"fibonacci(%d) = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @fib1(i32 %5)
%7 = load i32, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %6)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ gamma_x(int /*<<< orphan*/ *);
int /*<<< orphan*/ pi1(int /*<<< orphan*/ *);
int /*<<< orphan*/ pi2(int /*<<< orphan*/ *);
int /*<<< orphan*/ theta(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
void noekeon_round(uint32_t *key, uint32_t *state, uint8_t const1,
                   uint8_t const2) {
  ((uint8_t *)state)[0] ^= const1;
  theta(key, state);
  ((uint8_t *)state)[0] ^= const2;
  pi1(state);
  gamma_x(state);
  pi2(state);
}


x86 assembly (clang, -O0):
<noekeon_round>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <theta@plt>
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <pi1@plt>
mov    -0x10(%rbp),%rdi
call   1050 <gamma_x@plt>
mov    -0x10(%rbp),%rdi
call   1060 <pi2@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<noekeon_round>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rsi,%rbx
xor    %edx,(%rsi)
call   1040 <theta@plt>
xor    %ebp,(%rbx)
mov    %rbx,%rdi
call   1030 <pi1@plt>
mov    %rbx,%rdi
call   1050 <gamma_x@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <pi2@plt>

LLVM IR (-O0):
define void @noekeon_round(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* %7
%10 = load i32*, i32** %6
%11 = getelementptr inbounds i32, i32* %10, i64 0
%12 = load i32, i32* %11
%13 = xor i32 %12, %9
store i32 %13, i32* %11
%14 = load i32*, i32** %5
%15 = load i32*, i32** %6
%16 = call i32 @theta(i32* %14, i32* %15)
%17 = load i32, i32* %8
%18 = load i32*, i32** %6
%19 = getelementptr inbounds i32, i32* %18, i64 0
%20 = load i32, i32* %19
%21 = xor i32 %20, %17
store i32 %21, i32* %19
%22 = load i32*, i32** %6
%23 = call i32 @pi1(i32* %22)
%24 = load i32*, i32** %6
%25 = call i32 @gamma_x(i32* %24)
%26 = load i32*, i32** %6
%27 = call i32 @pi2(i32* %26)
ret void
}

LLVM IR (-O2):
define void @noekeon_round(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = load i32, i32* %1
%6 = xor i32 %5, %2
store i32 %6, i32* %1
%7 = tail call i32 @theta(i32* %0, i32* %1)
%8 = load i32, i32* %1
%9 = xor i32 %8, %3
store i32 %9, i32* %1
%10 = tail call i32 @pi1(i32* %1)
%11 = tail call i32 @gamma_x(i32* %1)
%12 = tail call i32 @pi2(i32* %1)
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
size_t fmt_u32_dec(char *, int);
size_t fmt_s32_dec(char *out, int32_t val) {
  int negative = (val < 0);
  if (negative) {
    if (out) {
      *out++ = '-';
    }
    val *= -1;
  }
  return fmt_u32_dec(out, val) + negative;
}


x86 assembly (clang, -O0):
<fmt_s32_dec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     115c <fmt_s32_dec+0x4c>
cmpq   $0x0,-0x8(%rbp)
je     1155 <fmt_s32_dec+0x45>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x2d,(%rax)
imul   $0xffffffff,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <fmt_u32_dec@plt>
movslq -0x10(%rbp),%rcx
add    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmt_s32_dec>:
push   %rbx
mov    %esi,%ebx
test   %esi,%esi
js     111b <fmt_s32_dec+0xb>
mov    %ebx,%esi
jmp    112f <fmt_s32_dec+0x1f>
test   %rdi,%rdi
je     1129 <fmt_s32_dec+0x19>
movb   $0x2d,(%rdi)
add    $0x1,%rdi
jmp    112b <fmt_s32_dec+0x1b>
xor    %edi,%edi
mov    %ebx,%esi
neg    %esi
shr    $0x1f,%ebx
call   1030 <fmt_u32_dec@plt>
add    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @fmt_s32_dec(i8* %0, i32 %1) {
%3 = icmp slt i32 %1, 0
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = icmp eq i8* %0, null
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = getelementptr inbounds i8, i8* %0, i64 1
store i8 45, i8* %0
br label %8
8: ; preds = %6, %4
%9 = phi i8* [ %7, %6 ], [ null, %4 ]
%10 = sub nsw i32 0, %1
br label %11
11: ; preds = %8, %2
%12 = phi i32 [ %10, %8 ], [ %1, %2 ]
%13 = phi i8* [ %9, %8 ], [ %0, %2 ]
%14 = lshr i32 %1, 31
%15 = tail call i64 @fmt_u32_dec(i8* %13, i32 %12)
%16 = zext i32 %14 to i64
%17 = add i64 %15, %16
ret i64 %17
}
/* Variables and functions */
int /*<<< orphan*/ error(int);
int /*<<< orphan*/ printf(char *);
int main() {
  int err = 0;
  error(err);
  error(err);
  printf("This is"
         "ver 0");
  error(err);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [13 x i8] c"This isver 0\00"
define i32 @main() {
%1 = tail call i32 @error(i32 0)
%2 = tail call i32 @error(i32 0)
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @error(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ pmu_reg_write(int, int);
int /*<<< orphan*/ pmu_set_active_clk(int, int, int, int);
int /*<<< orphan*/ pmu_set_adc_period(int);
int /*<<< orphan*/ pmu_set_sar_override(int);
int /*<<< orphan*/ pmu_set_sleep_low();
void pmu_set_clk_init() {
  pmu_set_active_clk(0xF, 0x1, 0x10, 0x2);
  pmu_set_sleep_low();
  pmu_reg_write(0x05, ((0 << 13) | (0 << 12) | (1 << 11) | (0 << 10) |
                       (0 << 9) | (0 << 8) | (0 << 7) | (0x3C)));
  pmu_set_sar_override(0x3C);
  pmu_set_adc_period(1);
}


x86 assembly (clang, -O0):
<pmu_set_clk_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf,%edi
mov    $0x1,%esi
mov    $0x10,%edx
mov    $0x2,%ecx
call   1030 <pmu_set_active_clk@plt>
mov    $0x0,%al
call   1050 <pmu_set_sleep_low@plt>
mov    $0x5,%edi
mov    $0x83c,%esi
call   1040 <pmu_reg_write@plt>
mov    $0x3c,%edi
call   1060 <pmu_set_sar_override@plt>
mov    $0x1,%edi
call   1070 <pmu_set_adc_period@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmu_set_clk_init>:
push   %rax
mov    $0xf,%edi
mov    $0x1,%esi
mov    $0x10,%edx
mov    $0x2,%ecx
call   1030 <pmu_set_active_clk@plt>
xor    %eax,%eax
call   1050 <pmu_set_sleep_low@plt>
mov    $0x5,%edi
mov    $0x83c,%esi
call   1040 <pmu_reg_write@plt>
mov    $0x3c,%edi
call   1060 <pmu_set_sar_override@plt>
mov    $0x1,%edi
pop    %rax
jmp    1070 <pmu_set_adc_period@plt>

LLVM IR (-O0):
define void @pmu_set_clk_init() {
%1 = call i32 @pmu_set_active_clk(i32 15, i32 1, i32 16, i32 2)
%2 = call i32 (...) @pmu_set_sleep_low()
%3 = call i32 @pmu_reg_write(i32 5, i32 2108)
%4 = call i32 @pmu_set_sar_override(i32 60)
%5 = call i32 @pmu_set_adc_period(i32 1)
ret void
}

LLVM IR (-O2):
define void @pmu_set_clk_init() {
%1 = tail call i32 @pmu_set_active_clk(i32 15, i32 1, i32 16, i32 2)
%2 = tail call i32 (...) @pmu_set_sleep_low()
%3 = tail call i32 @pmu_reg_write(i32 5, i32 2108)
%4 = tail call i32 @pmu_set_sar_override(i32 60)
%5 = tail call i32 @pmu_set_adc_period(i32 1)
ret void
}
void test1(void) {
  int *apic_tpr_addr = (int *)0xfee00080;
  *apic_tpr_addr += 4;
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfee00080,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x4,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
mov    $0xfee00080,%eax
addl   $0x4,(%rax)
ret

LLVM IR (-O0):
define void @test1() {
%1 = alloca i32*
store i32* inttoptr (i64 4276093056 to i32*), i32** %1
%2 = load i32*, i32** %1
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 4
store i32 %4, i32* %2
ret void
}

LLVM IR (-O2):
define void @test1() {
%1 = load i32, i32* inttoptr (i64 4276093056 to i32*)
%2 = add nsw i32 %1, 4
store i32 %2, i32* inttoptr (i64 4276093056 to i32*)
ret void
}
unsigned long unsignedlong_id(unsigned long x) { return x; }


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

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

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

LLVM IR (-O2):
define i64 @unsignedlong_id(i64 returned %0) {
ret i64 %0
}
/* Variables and functions */
int MyFunction();
int main() { return MyFunction(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <MyFunction@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @MyFunction()
ret i32 %1
}