xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int Exists(const char *fname) {
  FILE *file = fopen(fname, "r");
  if (file) {
    fclose(file);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<Exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1160 <Exists+0x40>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1167 <Exists+0x47>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Exists>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1141 <Exists+0x21>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @Exists(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %7
}
void _exc_del_nomem(struct exception *e) { return; }


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

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

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

LLVM IR (-O2):
%struct.exception = type opaque
define void @_exc_del_nomem(%struct.exception* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void random_wave_note_free(void *data) { free(data); }


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

x86 assembly (clang, -O2):
<random_wave_note_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @random_wave_note_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void h_td_end(void) { fputs("</td>\n", stdout); }


x86 assembly (clang, -O0):
<h_td_end>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<h_td_end>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"</td>\0A\00"
@stdout = global i32 0
define void @h_td_end() {
%1 = load i32, i32* @stdout
%2 = call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"</td>\0A\00"
@stdout = global i32 0
define void @h_td_end() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
double area_square(double sidelen) { return sidelen * sidelen; }


x86 assembly (clang, -O0):
<area_square>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<area_square>:
mulsd  %xmm0,%xmm0
ret

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

LLVM IR (-O2):
define double @area_square(double %0) {
%2 = fmul double %0, %0
ret double %2
}
/* Variables and functions */
int pica_node_main(int, char **);
int main(int argc, char **argv) { return pica_node_main(argc, argv); }


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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <pica_node_main@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1030 <pica_node_main@plt>

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 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @pica_node_main(i32 %6, i8** %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @pica_node_main(i32 %0, i8** %1)
ret i32 %3
}
extern int Max3(int i1, int i2, int i3) {
  if (i1 >= i2 && i1 >= i3)
    return i1;
  return i2 >= i3 ? i2 : i3;
}


x86 assembly (clang, -O0):
<Max3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1130 <Max3+0x30>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     1130 <Max3+0x30>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <Max3+0x53>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     1147 <Max3+0x47>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    114d <Max3+0x4d>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Max3>:
cmp    %edx,%esi
mov    %esi,%ecx
cmovl  %edx,%ecx
cmp    %edx,%edi
mov    %edi,%eax
cmovl  %ecx,%eax
cmp    %esi,%edi
cmovl  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @Max3(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = icmp slt i32 %0, %2
%6 = or i1 %4, %5
%7 = icmp slt i32 %1, %2
%8 = select i1 %7, i32 %2, i32 %1
%9 = select i1 %6, i32 %8, i32 %0
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void indexfn(void *arg, size_t index) {
  if (!arg) {
    printf("indexfn got a NULL arg\n");
    exit(1);
  } else {
  }
}


x86 assembly (clang, -O0):
<indexfn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1151 <indexfn+0x31>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
jmp    1156 <indexfn+0x36>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<indexfn>:
test   %rdi,%rdi
je     1126 <indexfn+0x6>
ret
push   %rax
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"indexfn got a NULL arg\0A\00"
define void @indexfn(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %2
br label %11
11: ; preds = %10
ret void
}

LLVM IR (-O2):
@str = [23 x i8] c"indexfn got a NULL arg\00"
define void @indexfn(i8* readnone %0, i64 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ getdelim(char **, size_t *, char, int /*<<< orphan*/ *);
ssize_t getline(char **linebuf, size_t *n, FILE *file) {
  return (getdelim(linebuf, n, '\n', file));
}


x86 assembly (clang, -O0):
<getline>:
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),%rcx
mov    $0xa,%edx
call   1030 <getdelim@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getline>:
mov    %rdx,%rcx
mov    $0xa,%edx
jmp    1030 <getdelim@plt>

LLVM IR (-O0):
define i32 @getline(i8** %0, i64* %1, i32* %2) {
%4 = alloca i8**
%5 = alloca i64*
%6 = alloca i32*
store i8** %0, i8*** %4
store i64* %1, i64** %5
store i32* %2, i32** %6
%7 = load i8**, i8*** %4
%8 = load i64*, i64** %5
%9 = load i32*, i32** %6
%10 = call i32 @getdelim(i8** %7, i64* %8, i8 signext 10, i32* %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @getline(i8** %0, i64* %1, i32* %2) {
%4 = tail call i32 @getdelim(i8** %0, i64* %1, i8 signext 10, i32* %2)
ret i32 %4
}
unsigned int rev4(unsigned int x) {
  return ((x & 0x000000ff) << 24) | ((x & 0x0000ff00) << 8) |
         ((x & 0x00ff0000) >> 8) | ((x & 0xff000000) >> 24);
}


x86 assembly (clang, -O0):
<rev4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
shl    $0x18,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff0000,%ecx
shr    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff000000,%ecx
shr    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rev4>:
mov    %edi,%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @rev4(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = shl i32 %4, 24
%6 = load i32, i32* %2
%7 = and i32 %6, 65280
%8 = shl i32 %7, 8
%9 = or i32 %5, %8
%10 = load i32, i32* %2
%11 = and i32 %10, 16711680
%12 = lshr i32 %11, 8
%13 = or i32 %9, %12
%14 = load i32, i32* %2
%15 = and i32 %14, -16777216
%16 = lshr i32 %15, 24
%17 = or i32 %13, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @rev4(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
void initialiser_motTrouve(int *table, int taille) {
  int i;
  for (i = 0; i < taille; i++) {
    table[i] = 0;
  }
}


x86 assembly (clang, -O0):
<initialiser_motTrouve>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113b <initialiser_motTrouve+0x3b>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <initialiser_motTrouve+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialiser_motTrouve>:
test   %esi,%esi
jle    1126 <initialiser_motTrouve+0x16>
push   %rax
mov    %esi,%edx
shl    $0x2,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @initialiser_motTrouve(i32* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = bitcast i32* %0 to i8*
%6 = zext i32 %1 to i64
%7 = shl nuw nsw i64 %6, 2
br label %8
8: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef scalar_t__ const wchar_t;

/* Variables and functions */
wchar_t *wcsrchr(const wchar_t *wcs, wchar_t wc) {
  wchar_t *last = 0;
  for (; *wcs; ++wcs)
    if (*wcs == wc)
      last = (wchar_t *)wcs;
  return last;
}


x86 assembly (clang, -O0):
<wcsrchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1151 <wcsrchr+0x51>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
cmp    -0x10(%rbp),%rax
jne    113b <wcsrchr+0x3b>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1140 <wcsrchr+0x40>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    1114 <wcsrchr+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcsrchr>:
mov    (%rdi),%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1124 <wcsrchr+0x24>
nopw   0x0(%rax,%rax,1)
cmp    %rsi,%rcx
cmove  %rdi,%rax
mov    0x8(%rdi),%rcx
add    $0x8,%rdi
test   %rcx,%rcx
jne    1110 <wcsrchr+0x10>
ret

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

LLVM IR (-O2):
define i64* @wcsrchr(i64* %0, i64 %1) {
%3 = load i64, i64* %0
%4 = icmp eq i64 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %12, %5 ], [ %3, %2 ]
%7 = phi i64* [ %10, %5 ], [ null, %2 ]
%8 = phi i64* [ %11, %5 ], [ %0, %2 ]
%9 = icmp eq i64 %6, %1
%10 = select i1 %9, i64* %8, i64* %7
%11 = getelementptr inbounds i64, i64* %8, i64 1
%12 = load i64, i64* %11
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %2
%15 = phi i64* [ null, %2 ], [ %10, %5 ]
ret i64* %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int /*<<< orphan*/ system(char *);
void rtorrent_kill(char nickname[]) {
  char chaine[100] = {0};
  snprintf(chaine, 100, "killall --user %s rtorrent\n", nickname);
  printf("%s", chaine);
  system(chaine);
}


x86 assembly (clang, -O0):
<rtorrent_kill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x64,%esi
lea    0xe90(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x70(%rbp),%rsi
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1030 <system@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtorrent_kill>:
push   %rbx
sub    $0x70,%rsp
mov    %rdi,%rcx
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
lea    0xe99(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <snprintf@plt>
lea    0xe9e(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"killall --user %s rtorrent\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define void @rtorrent_kill(i8* %0) {
%2 = alloca i8*
%3 = alloca [100 x i8]
store i8* %0, i8** %2
%4 = bitcast [100 x i8]* %3 to i8*
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @snprintf(i8* %5, i32 100, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%11 = call i32 @system(i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"killall --user %s rtorrent\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define void @rtorrent_kill(i8* %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 100, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%6 = call i32 @system(i8* %3)
ret void
}
void str_conv_to_upper_case(char *str) {
  while (*str) {
    if (('a' <= *str) && (*str <= 'z')) {
      *str = (*str - 0x20);
    }
    str++;
  }
}


x86 assembly (clang, -O0):
<str_conv_to_upper_case>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     115c <str_conv_to_upper_case+0x5c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x61,%eax
cmp    %ecx,%eax
jg     114b <str_conv_to_upper_case+0x4b>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jg     114b <str_conv_to_upper_case+0x4b>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x20,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <str_conv_to_upper_case+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_conv_to_upper_case>:
mov    (%rdi),%al
test   %al,%al
je     112a <str_conv_to_upper_case+0x2a>
add    $0x1,%rdi
jmp    111b <str_conv_to_upper_case+0x1b>
nopl   0x0(%rax)
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     112a <str_conv_to_upper_case+0x2a>
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     1110 <str_conv_to_upper_case+0x10>
add    $0xe0,%al
mov    %al,-0x1(%rdi)
jmp    1110 <str_conv_to_upper_case+0x10>
ret

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

LLVM IR (-O2):
define void @str_conv_to_upper_case(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %11
%5 = phi i8 [ %13, %11 ], [ %2, %1 ]
%6 = phi i8* [ %12, %11 ], [ %0, %1 ]
%7 = add i8 %5, -97
%8 = icmp ult i8 %7, 26
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = add nsw i8 %5, -32
store i8 %10, i8* %6
br label %11
11: ; preds = %9, %4
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %11, %1
ret void
}
int test_00(int *p) {
  int nr = 15;
  volatile char *addr = (volatile char *)&p[1];
  if ((addr[(nr >> 3) ^ 7] & (1 << (nr & 7))) == 0)
    return 40;
  else
    return 50;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0xf,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
sar    $0x3,%ecx
xor    $0x7,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
movsbl %al,%eax
mov    -0x14(%rbp),%ecx
and    $0x7,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
jne    1157 <test_00+0x57>
movl   $0x28,-0x4(%rbp)
jmp    115e <test_00+0x5e>
movl   $0x32,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
cmpb   $0x0,0xa(%rdi)
mov    $0x28,%ecx
mov    $0x32,%eax
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_00(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i8*
store i32* %0, i32** %3
store i32 15, i32* %4
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 1
%8 = bitcast i32* %7 to i8*
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = load i32, i32* %4
%11 = ashr i32 %10, 3
%12 = xor i32 %11, 7
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %9, i64 %13
%15 = load volatile i8, i8* %14
%16 = sext i8 %15 to i32
%17 = load i32, i32* %4
%18 = and i32 %17, 7
%19 = shl i32 1, %18
%20 = and i32 %16, %19
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %1
store i32 40, i32* %2
br label %24
23: ; preds = %1
store i32 50, i32* %2
br label %24
24: ; preds = %23, %22
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
define i32 @test_00(i32* %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = bitcast i32* %2 to i8*
%4 = getelementptr inbounds i8, i8* %3, i64 6
%5 = load volatile i8, i8* %4
%6 = icmp sgt i8 %5, -1
%7 = select i1 %6, i32 40, i32 50
ret i32 %7
}
int main(void) {
  char c __attribute__((unused)), *c0 = malloc(0), *c1;
  c = *c0;
  c0 = realloc(c0, 10);
  assert(c0);
  c = *c0;
  c1 = c0;
  c0 = realloc(c0, 0);
  assert(!c0);
  c = *c1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x5(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1050 <realloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x5(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <realloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x5(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1040 <malloc@plt>
mov    $0xa,%esi
mov    %rax,%rdi
call   1050 <realloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %eax,%eax
call   1030 <assert@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <realloc@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
xor    %eax,%eax
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
%5 = call i8* @malloc(i64 0)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
store i8 %7, i8* %2
%8 = load i8*, i8** %3
%9 = call i8* @realloc(i8* %8, i64 10)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @assert to i32 (i8*, ...)*)(i8* %10)
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
store i8 %13, i8* %2
%14 = load i8*, i8** %3
store i8* %14, i8** %4
%15 = load i8*, i8** %3
%16 = call i8* @realloc(i8* %15, i64 0)
store i8* %16, i8** %3
%17 = load i8*, i8** %3
%18 = icmp ne i8* %17, null
%19 = xor i1 %18, true
%20 = zext i1 %19 to i32
%21 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %20)
%22 = load i8*, i8** %4
%23 = load i8, i8* %22
store i8 %23, i8* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i8* @malloc(i64 0)
%2 = tail call dereferenceable_or_null(10) i8* @realloc(i8* %1, i64 10)
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @assert to i32 (i8*, ...)*)(i8* %2)
%4 = tail call i8* @realloc(i8* %2, i64 0)
%5 = icmp eq i8* %4, null
%6 = zext i1 %5 to i32
%7 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %6)
ret i32 0
}
unsigned char gray2bin(unsigned char gray) {
  unsigned char bin;
  bin = gray ^ (gray >> 1);
  bin ^= (bin >> 2);
  bin ^= (bin >> 4);
  return bin;
}


x86 assembly (clang, -O0):
<gray2bin>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
movzbl -0x1(%rbp),%ecx
sar    $0x1,%ecx
xor    %ecx,%eax
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%ecx
sar    $0x2,%ecx
movzbl -0x2(%rbp),%eax
xor    %ecx,%eax
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%ecx
sar    $0x4,%ecx
movzbl -0x2(%rbp),%eax
xor    %ecx,%eax
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gray2bin>:
mov    %edi,%eax
shr    %al
xor    %dil,%al
mov    %eax,%ecx
shr    $0x2,%cl
xor    %al,%cl
mov    %ecx,%eax
shr    $0x4,%al
xor    %cl,%al
ret

LLVM IR (-O0):
define zeroext i8 @gray2bin(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = load i8, i8* %2
%7 = zext i8 %6 to i32
%8 = ashr i32 %7, 1
%9 = xor i32 %5, %8
%10 = trunc i32 %9 to i8
store i8 %10, i8* %3
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = ashr i32 %12, 2
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = xor i32 %15, %13
%17 = trunc i32 %16 to i8
store i8 %17, i8* %3
%18 = load i8, i8* %3
%19 = zext i8 %18 to i32
%20 = ashr i32 %19, 4
%21 = load i8, i8* %3
%22 = zext i8 %21 to i32
%23 = xor i32 %22, %20
%24 = trunc i32 %23 to i8
store i8 %24, i8* %3
%25 = load i8, i8* %3
ret i8 %25
}

LLVM IR (-O2):
define zeroext i8 @gray2bin(i8 zeroext %0) {
%2 = lshr i8 %0, 1
%3 = xor i8 %2, %0
%4 = lshr i8 %3, 2
%5 = xor i8 %4, %3
%6 = lshr i8 %5, 4
%7 = xor i8 %6, %5
ret i8 %7
}
/* Variables and functions */
int /*<<< orphan*/ RawComm_LCD_Send(int, int, int, char const);
void LCD_PutChar(char const ch) { RawComm_LCD_Send(true, false, 40, ch); }


x86 assembly (clang, -O0):
<LCD_PutChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x1,%edi
xor    %esi,%esi
mov    $0x28,%edx
movsbl -0x1(%rbp),%ecx
call   1030 <RawComm_LCD_Send@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCD_PutChar>:
mov    %edi,%ecx
mov    $0x1,%edi
xor    %esi,%esi
mov    $0x28,%edx
jmp    1030 <RawComm_LCD_Send@plt>

LLVM IR (-O0):
define void @LCD_PutChar(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @RawComm_LCD_Send(i32 1, i32 0, i32 40, i8 signext %3)
ret void
}

LLVM IR (-O2):
define void @LCD_PutChar(i8 signext %0) {
%2 = tail call i32 @RawComm_LCD_Send(i32 1, i32 0, i32 40, i8 signext %0)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t gf_mul_bit(uint8_t a, uint8_t b) {
  int sum_log;
  while (b) {
    if (b & 1) {
      sum_log ^= a;
    }
    a = (a << 1) ^ (a & 0x80 ? 0x1d : 0);
    b >>= 1;
  }
  return sum_log;
}


x86 assembly (clang, -O0):
<gf_mul_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     115b <gf_mul_bit+0x5b>
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     112c <gf_mul_bit+0x2c>
mov    -0x4(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    -0x4(%rbp),%esi
and    $0x80,%esi
xor    %ecx,%ecx
mov    $0x1d,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
xor    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110a <gf_mul_bit+0xa>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gf_mul_bit>:
test   %esi,%esi
je     1133 <gf_mul_bit+0x33>
mov    %esi,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    %esi,%edx
and    $0x1,%edx
neg    %edx
and    %edi,%edx
xor    %edx,%eax
lea    (%rdi,%rdi,1),%edx
movsbl %dil,%edi
shr    $0x7,%edi
and    $0x1d,%edi
xor    %edx,%edi
sar    %ecx
cmp    $0x1,%esi
mov    %ecx,%esi
ja     1110 <gf_mul_bit+0x10>
ret

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

LLVM IR (-O2):
define i32 @gf_mul_bit(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %19, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %11, %4 ], [ undef, %2 ]
%6 = phi i32 [ %17, %4 ], [ %1, %2 ]
%7 = phi i32 [ %16, %4 ], [ %0, %2 ]
%8 = and i32 %6, 1
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 0, i32 %7
%11 = xor i32 %10, %5
%12 = shl i32 %7, 1
%13 = and i32 %7, 128
%14 = icmp eq i32 %13, 0
%15 = select i1 %14, i32 0, i32 29
%16 = xor i32 %15, %12
%17 = ashr i32 %6, 1
%18 = icmp ult i32 %6, 2
br i1 %18, label %19, label %4
19: ; preds = %4, %2
%20 = phi i32 [ undef, %2 ], [ %11, %4 ]
ret i32 %20
}
/* Variables and functions */
int /*<<< orphan*/ print_info(int, char *, int /*<<< orphan*/);
void print_ppid(int pid) { print_info(pid, "ppid", 0); }


x86 assembly (clang, -O0):
<print_ppid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0xedb(%rip),%rsi
xor    %edx,%edx
call   1030 <print_info@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_ppid>:
lea    0xee9(%rip),%rsi
xor    %edx,%edx
jmp    1030 <print_info@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"ppid\00"
define void @print_ppid(i32 %0) {
%2 = tail call i32 @print_info(i32 %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 0)
ret void
}
/* Variables and functions */
int fact(int);
int /*<<< orphan*/ printf(char *, int);
void main() { printf(" Factorial of 5 = %d\n", fact(5)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%edi
call   1040 <fact@plt>
mov    %eax,%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [22 x i8] c" Factorial of 5 = %d\0A\00"
define void @main() {
%1 = call i32 @fact(i32 5)
%2 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c" Factorial of 5 = %d\0A\00"
define void @main() {
%1 = tail call i32 @fact(i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Type definitions */
struct Tuple2_Int_Int {
  int dummy;
};

/* Variables and functions */
struct Tuple2_Int_Int *Tuple2_0(int /*<<< orphan*/, int /*<<< orphan*/);
struct Tuple2_Int_Int *init_point() {
  return Tuple2_0(0, 0);
}


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

x86 assembly (clang, -O2):
<init_point>:
xor    %edi,%edi
xor    %esi,%esi
jmp    1030 <Tuple2_0@plt>

LLVM IR (-O0):
%struct.Tuple2_Int_Int = type { i32 }
define %struct.Tuple2_Int_Int* @init_point() {
%1 = call %struct.Tuple2_Int_Int* @Tuple2_0(i32 0, i32 0)
ret %struct.Tuple2_Int_Int* %1
}

LLVM IR (-O2):
%struct.Tuple2_Int_Int = type { i32 }
define %struct.Tuple2_Int_Int* @init_point() {
%1 = tail call %struct.Tuple2_Int_Int* @Tuple2_0(i32 0, i32 0)
ret %struct.Tuple2_Int_Int* %1
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int strtol(char *, char **, int /*<<< orphan*/);
int socket_parse_port(char *ptr, uint16_t *res) {
  char *end;
  int port = strtol(ptr, &end, 0);
  if (*end != '\0' || port > 0xFFFF || port <= 0)
    return -1;
  *res = port;
  return 0;
}


x86 assembly (clang, -O0):
<socket_parse_port>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
xor    %edx,%edx
call   1030 <strtol@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1159 <socket_parse_port+0x49>
cmpl   $0xffff,-0x24(%rbp)
jg     1159 <socket_parse_port+0x49>
cmpl   $0x0,-0x24(%rbp)
jg     1165 <socket_parse_port+0x55>
movl   $0xffffffff,-0x4(%rbp)
jmp    1175 <socket_parse_port+0x65>
mov    -0x24(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket_parse_port>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0x8(%rsp),%rsi
xor    %edx,%edx
call   1030 <strtol@plt>
mov    %eax,%ecx
mov    0x8(%rsp),%rax
cmpb   $0x0,(%rax)
mov    $0xffffffff,%eax
jne    1145 <socket_parse_port+0x35>
cmp    $0xffff,%ecx
jg     1145 <socket_parse_port+0x35>
test   %ecx,%ecx
jle    1145 <socket_parse_port+0x35>
mov    %ecx,(%rbx)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @socket_parse_port(i8* %0, i32* nocapture writeonly %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i32 @strtol(i8* %0, i8** %3, i32 0)
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
%9 = icmp sgt i32 %5, 65535
%10 = select i1 %8, i1 true, i1 %9
%11 = icmp slt i32 %5, 1
%12 = select i1 %10, i1 true, i1 %11
br i1 %12, label %14, label %13
13: ; preds = %2
store i32 %5, i32* %1
br label %14
14: ; preds = %2, %13
%15 = phi i32 [ 0, %13 ], [ -1, %2 ]
ret i32 %15
}
/* Type definitions */
struct bplus_node {
  int dummy;
};
typedef int /*<<< orphan*/ key_t;

/* Variables and functions */
int key_binary_search(struct bplus_node *, int /*<<< orphan*/);
int parent_key_index(struct bplus_node *parent, key_t key) {
  int index = key_binary_search(parent, key);
  return index >= 0 ? index : -index - 2;
}


x86 assembly (clang, -O0):
<parent_key_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <key_binary_search@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     1143 <parent_key_index+0x33>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    114e <parent_key_index+0x3e>
xor    %eax,%eax
sub    -0x10(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parent_key_index>:
push   %rax
call   1030 <key_binary_search@plt>
mov    $0xfffffffe,%ecx
sub    %eax,%ecx
test   %eax,%eax
cmovs  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.bplus_node = type { i32 }
define i32 @parent_key_index(%struct.bplus_node* %0, i32 %1) {
%3 = alloca %struct.bplus_node*
%4 = alloca i32
%5 = alloca i32
store %struct.bplus_node* %0, %struct.bplus_node** %3
store i32 %1, i32* %4
%6 = load %struct.bplus_node*, %struct.bplus_node** %3
%7 = load i32, i32* %4
%8 = call i32 @key_binary_search(%struct.bplus_node* %6, i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i32, i32* %5
br label %17
13: ; preds = %2
%14 = load i32, i32* %5
%15 = sub nsw i32 0, %14
%16 = sub nsw i32 %15, 2
br label %17
17: ; preds = %13, %11
%18 = phi i32 [ %12, %11 ], [ %16, %13 ]
ret i32 %18
}

LLVM IR (-O2):
%struct.bplus_node = type { i32 }
define i32 @parent_key_index(%struct.bplus_node* %0, i32 %1) {
%3 = tail call i32 @key_binary_search(%struct.bplus_node* %0, i32 %1)
%4 = icmp sgt i32 %3, -1
%5 = sub i32 -2, %3
%6 = select i1 %4, i32 %3, i32 %5
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ _OSSwapInt16(int /*<<< orphan*/);
void OSWriteSwapInt16(volatile void *base, uintptr_t byteOffset,
                      uint16_t data) {
  *(volatile uint16_t *)((uintptr_t)base + byteOffset) = _OSSwapInt16(data);
}


x86 assembly (clang, -O0):
<OSWriteSwapInt16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <_OSSwapInt16@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OSWriteSwapInt16>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %edx,%edi
call   1030 <_OSSwapInt16@plt>
mov    %eax,(%rbx,%r14,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @OSWriteSwapInt16(i8* %0, i64 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = call i32 @_OSSwapInt16(i32 %7)
%9 = load i8*, i8** %4
%10 = ptrtoint i8* %9 to i64
%11 = load i64, i64* %5
%12 = add i64 %10, %11
%13 = inttoptr i64 %12 to i32*
store volatile i32 %8, i32* %13
ret void
}

LLVM IR (-O2):
define void @OSWriteSwapInt16(i8* %0, i64 %1, i32 %2) {
%4 = tail call i32 @_OSSwapInt16(i32 %2)
%5 = ptrtoint i8* %0 to i64
%6 = add i64 %5, %1
%7 = inttoptr i64 %6 to i32*
store volatile i32 %4, i32* %7
ret void
}
unsigned xrop3_73_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  unsigned stk4;
  stk4 = T & D;
  stk3 = S | stk4;
  stk2 = D ^ stk3;
  stk1 = T ^ stk2;
  stk1 = ~stk1;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_73_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_73_1_0>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
mov    %esi,%ecx
shl    $0x8,%ecx
not    %esi
xor    %eax,%ecx
and    %esi,%ecx
xor    $0xffffff00,%ecx
not    %eax
and    %ecx,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_73_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = shl i32 %13, 8
%15 = load i8, i8* %3
%16 = zext i8 %15 to i32
%17 = or i32 %14, %16
store i32 %17, i32* %6
%18 = load i8, i8* %4
%19 = zext i8 %18 to i32
%20 = shl i32 %19, 8
%21 = load i8, i8* %4
%22 = zext i8 %21 to i32
%23 = or i32 %20, %22
store i32 %23, i32* %7
%24 = load i32, i32* %7
%25 = load i32, i32* %5
%26 = and i32 %24, %25
store i32 %26, i32* %11
%27 = load i32, i32* %6
%28 = load i32, i32* %11
%29 = or i32 %27, %28
store i32 %29, i32* %10
%30 = load i32, i32* %5
%31 = load i32, i32* %10
%32 = xor i32 %30, %31
store i32 %32, i32* %9
%33 = load i32, i32* %7
%34 = load i32, i32* %9
%35 = xor i32 %33, %34
store i32 %35, i32* %8
%36 = load i32, i32* %8
%37 = xor i32 %36, -1
store i32 %37, i32* %8
%38 = load i32, i32* %8
%39 = load i32, i32* %6
%40 = xor i32 %39, -1
%41 = and i32 %38, %40
%42 = load i32, i32* %5
%43 = load i32, i32* %6
%44 = and i32 %42, %43
%45 = or i32 %41, %44
ret i32 %45
}

LLVM IR (-O2):
define i32 @xrop3_73_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = shl nuw nsw i32 %5, 8
%7 = xor i32 %5, -1
%8 = xor i32 %4, %6
%9 = and i32 %8, %7
%10 = xor i32 %9, -256
%11 = xor i32 %4, -1
%12 = and i32 %10, %11
%13 = or i32 %12, %3
ret i32 %13
}
void ff_hevc_put_hevc_uni_epel_v6_8_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_epel_v6_8_sse4() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ hilbert_recurse(void *, int, int, int);
void hilbert(void *img, int n, int parity) {
  hilbert_recurse(img, n, parity, 479 / (1 << n));
}


x86 assembly (clang, -O0):
<hilbert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    $0x1df,%eax
cltd
idiv   %ecx
mov    -0x14(%rbp),%edx
mov    %eax,%ecx
call   1030 <hilbert_recurse@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hilbert>:
mov    $0x1df,%eax
mov    %esi,%ecx
shr    %cl,%eax
mov    %eax,%ecx
jmp    1030 <hilbert_recurse@plt>

LLVM IR (-O0):
define void @hilbert(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = load i32, i32* %5
%11 = shl i32 1, %10
%12 = sdiv i32 479, %11
%13 = call i32 @hilbert_recurse(i8* %7, i32 %8, i32 %9, i32 %12)
ret void
}

LLVM IR (-O2):
define void @hilbert(i8* %0, i32 %1, i32 %2) {
%4 = lshr i32 479, %1
%5 = tail call i32 @hilbert_recurse(i8* %0, i32 %1, i32 %2, i32 %4)
ret void
}
int smbd_reconnect(struct TCP_Server_Info *server) { return -1; }


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

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

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

LLVM IR (-O2):
%struct.TCP_Server_Info = type opaque
define i32 @smbd_reconnect(%struct.TCP_Server_Info* nocapture readnone %0) {
ret i32 -1
}
int ex_get_cpu_ws(void) { return (sizeof(float)); }


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

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

LLVM IR (-O0):
define i32 @ex_get_cpu_ws() {
ret i32 4
}

LLVM IR (-O2):
define i32 @ex_get_cpu_ws() {
ret i32 4
}
/* Variables and functions */
int liefere_ganze_zufallszahl(int, int);
void initialisiere_int_bereich_zufaellig(int *von, int *bis, int min, int max) {
  for (int *p = von; p <= bis; p++)
    *p = liefere_ganze_zufallszahl(min, max);
}


x86 assembly (clang, -O0):
<initialisiere_int_bereich_zufaellig>:
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    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
ja     1160 <initialisiere_int_bereich_zufaellig+0x50>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <liefere_ganze_zufallszahl@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
jmp    112e <initialisiere_int_bereich_zufaellig+0x1e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialisiere_int_bereich_zufaellig>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %rsi,%rdi
ja     1147 <initialisiere_int_bereich_zufaellig+0x37>
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %rdi,%rbp
nopl   0x0(%rax,%rax,1)
mov    %r15d,%edi
mov    %r14d,%esi
call   1030 <liefere_ganze_zufallszahl@plt>
mov    %eax,0x0(%rbp)
add    $0x4,%rbp
cmp    %rbx,%rbp
jbe    1130 <initialisiere_int_bereich_zufaellig+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @initialisiere_int_bereich_zufaellig(i32* writeonly %0, i32* readnone %1, i32 %2, i32 %3) {
%5 = icmp ugt i32* %0, %1
br i1 %5, label %6, label %7
6: ; preds = %7, %4
ret void
7: ; preds = %4, %7
%8 = phi i32* [ %10, %7 ], [ %0, %4 ]
%9 = tail call i32 @liefere_ganze_zufallszahl(i32 %2, i32 %3)
store i32 %9, i32* %8
%10 = getelementptr inbounds i32, i32* %8, i64 1
%11 = icmp ugt i32* %10, %1
br i1 %11, label %6, label %7
}