xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ deviceIf_getColourBuffer(void **, int *, unsigned int *);
void get_cbuf(void **start, unsigned int *used) {
  int length;
  deviceIf_getColourBuffer(start, &length, used);
}


x86 assembly (clang, -O0):
<get_cbuf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rsi
call   1030 <deviceIf_getColourBuffer@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cbuf>:
push   %rax
mov    %rsi,%rdx
lea    0x4(%rsp),%rsi
call   1030 <deviceIf_getColourBuffer@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @get_cbuf(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 i8**, i8*** %3
%7 = load i32*, i32** %4
%8 = call i32 @deviceIf_getColourBuffer(i8** %6, i32* %5, i32* %7)
ret void
}

LLVM IR (-O2):
define void @get_cbuf(i8** %0, i32* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @deviceIf_getColourBuffer(i8** %0, i32* %3, i32* %1)
ret void
}
/* Type definitions */
struct chmcTreeNode {
  int dummy;
};
struct chmcFile {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(struct chmcFile *);
struct chmcTreeNode *chmc_add_entry(struct chmcFile *, char const *,
                                    int /*<<< orphan*/, int /*<<< orphan*/,
                                    int /*<<< orphan*/ *, int /*<<< orphan*/,
                                    int /*<<< orphan*/);
struct chmcTreeNode *chmc_add_dir(struct chmcFile *chm, const char *dir) {
  assert(chm);
  return chmc_add_entry(chm, dir, 0, 0, NULL, 0, 0);
}


x86 assembly (clang, -O0):
<chmc_add_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %r9d,%r9d
xor    %eax,%eax
mov    %eax,%r8d
mov    %r9d,%edx
mov    %r9d,%ecx
movl   $0x0,(%rsp)
call   1040 <chmc_add_entry@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chmc_add_dir>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <assert@plt>
movl   $0x0,(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1040 <chmc_add_entry@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.chmcTreeNode = type { i32 }
%struct.chmcFile = type { i32 }
define %struct.chmcTreeNode* @chmc_add_dir(%struct.chmcFile* %0, i8* %1) {
%3 = alloca %struct.chmcFile*
%4 = alloca i8*
store %struct.chmcFile* %0, %struct.chmcFile** %3
store i8* %1, i8** %4
%5 = load %struct.chmcFile*, %struct.chmcFile** %3
%6 = call i32 @assert(%struct.chmcFile* %5)
%7 = load %struct.chmcFile*, %struct.chmcFile** %3
%8 = load i8*, i8** %4
%9 = call %struct.chmcTreeNode* @chmc_add_entry(%struct.chmcFile* %7, i8* %8, i32 0, i32 0, i32* null, i32 0, i32 0)
ret %struct.chmcTreeNode* %9
}

LLVM IR (-O2):
%struct.chmcTreeNode = type { i32 }
%struct.chmcFile = type { i32 }
define %struct.chmcTreeNode* @chmc_add_dir(%struct.chmcFile* %0, i8* %1) {
%3 = tail call i32 @assert(%struct.chmcFile* %0)
%4 = tail call %struct.chmcTreeNode* @chmc_add_entry(%struct.chmcFile* %0, i8* %1, i32 0, i32 0, i32* null, i32 0, i32 0)
ret %struct.chmcTreeNode* %4
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void seek_past(uint32_t offset, FILE *infile) {
  if (-1 == fseek(infile, offset, SEEK_CUR)) {
    fprintf(stderr, "seek by 0x%x failed\n", offset);
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<seek_past>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    0x2e9b(%rip),%rax
mov    (%rax),%edx
call   1040 <fseek@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1189 <seek_past+0x59>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xe8a(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seek_past>:
push   %rbx
mov    %edi,%ebx
mov    0x2eae(%rip),%rax
mov    (%rax),%edx
mov    %rsi,%rdi
mov    %ebx,%esi
call   1040 <fseek@plt>
cmp    $0xffffffff,%eax
je     114d <seek_past+0x1d>
pop    %rbx
ret
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
lea    0xea3(%rip),%rsi
mov    %ebx,%edx
call   1030 <fprintf@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@SEEK_CUR = global i32 0
@stderr = global i32 0
@.str = [21 x i8] c"seek by 0x%x failed\0A\00"
@EXIT_FAILURE = global i32 0
define void @seek_past(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = load i32, i32* %3
%7 = load i32, i32* @SEEK_CUR
%8 = call i32 @fseek(i32* %5, i32 %6, i32 %7)
%9 = icmp eq i32 -1, %8
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i32, i32* %3
%13 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32, i32* @EXIT_FAILURE
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %2
ret void
}

LLVM IR (-O2):
@SEEK_CUR = global i32 0
@stderr = global i32 0
@.str = [21 x i8] c"seek by 0x%x failed\0A\00"
@EXIT_FAILURE = global i32 0
define void @seek_past(i32 %0, i32* nocapture %1) {
%3 = load i32, i32* @SEEK_CUR
%4 = tail call i32 @fseek(i32* %1, i32 %0, i32 %3)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %0)
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %2
ret void
}
void g_list_nth_data() {}


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

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

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

LLVM IR (-O2):
define void @g_list_nth_data() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int num = 1;
  printf("1 to 100 numbers\n");
  while (num <= 100) {
    printf("%d \t", num);
    num++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x64,-0x8(%rbp)
jg     115d <main+0x4d>
mov    -0x8(%rbp),%esi
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1134 <main+0x24>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
lea    0xec4(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x65,%ebx
jne    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%d \09\00"
@str = [17 x i8] c"1 to 100 numbers\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 1, %0 ], [ %5, %2 ]
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = add nuw nsw i32 %3, 1
%6 = icmp eq i32 %5, 101
br i1 %6, label %7, label %2
7: ; preds = %2
ret i32 0
}
__attribute__((__no__)) void
do_nothing_trailing_hole_assigned_dynamic_all(struct test_trailing_hole *ptr) {
  if ((unsigned long)ptr > 0x2)
    return;
  else
    return;
}


x86 assembly (clang, -O0):
<do_nothing_trailing_hole_assigned_dynamic_all>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmp    $0x2,%rax
jbe    111b <do_nothing_trailing_hole_assigned_dynamic_all+0x1b>
jmp    1120 <do_nothing_trailing_hole_assigned_dynamic_all+0x20>
jmp    1120 <do_nothing_trailing_hole_assigned_dynamic_all+0x20>
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.test_trailing_hole = type opaque
define void @do_nothing_trailing_hole_assigned_dynamic_all(%struct.test_trailing_hole* %0) {
%2 = alloca %struct.test_trailing_hole*
store %struct.test_trailing_hole* %0, %struct.test_trailing_hole** %2
%3 = load %struct.test_trailing_hole*, %struct.test_trailing_hole** %2
%4 = ptrtoint %struct.test_trailing_hole* %3 to i64
%5 = icmp ugt i64 %4, 2
br i1 %5, label %6, label %7
6: ; preds = %1
br label %8
7: ; preds = %1
br label %8
8: ; preds = %7, %6
ret void
}

LLVM IR (-O2):
%struct.test_trailing_hole = type opaque
define void @do_nothing_trailing_hole_assigned_dynamic_all(%struct.test_trailing_hole* nocapture %0) {
ret void
}
char *tmpnam(char *s) {
  static unsigned long int seed = 0;
  static char namebuf[255];
  if (s == ((void *)0))
    s = namebuf;
  if (_tmpnam(s, &seed) == ((void *)0))
    return ((void *)0);
  return s;
}


x86 assembly (clang, -O0):
<tmpnam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1132 <tmpnam+0x22>
lea    0x2f22(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0x2f03(%rip),%rsi
mov    $0x0,%al
call   1030 <_tmpnam@plt>
cltq
cmp    $0x0,%rax
jne    115d <tmpnam+0x4d>
movq   $0x0,-0x8(%rbp)
jmp    1165 <tmpnam+0x55>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tmpnam>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
lea    0x2f32(%rip),%rbx
cmovne %rdi,%rbx
lea    0x2f17(%rip),%rsi
xor    %r14d,%r14d
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <_tmpnam@plt>
test   %eax,%eax
cmovne %rbx,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@tmpnam.seed = internal global i64 0
@tmpnam.namebuf = internal global [255 x i8] zeroinitializer
define i8* @tmpnam(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([255 x i8], [255 x i8]* @tmpnam.namebuf, i64 0, i64 0), i8** %3
br label %7
7: ; preds = %6, %1
%8 = load i8*, i8** %3
%9 = call i32 (i8*, i64*, ...) bitcast (i32 (...)* @_tmpnam to i32 (i8*, i64*, ...)*)(i8* %8, i64* @tmpnam.seed)
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i8*
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %14
13: ; preds = %7
store i8* null, i8** %2
br label %16
14: ; preds = %7
%15 = load i8*, i8** %3
store i8* %15, i8** %2
br label %16
16: ; preds = %14, %13
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
@tmpnam.seed = internal global i64 0
@tmpnam.namebuf = internal global [255 x i8] zeroinitializer
define i8* @tmpnam(i8* %0) {
%2 = icmp eq i8* %0, null
%3 = select i1 %2, i8* getelementptr inbounds ([255 x i8], [255 x i8]* @tmpnam.namebuf, i64 0, i64 0), i8* %0
%4 = tail call i32 (i8*, i64*, ...) bitcast (i32 (...)* @_tmpnam to i32 (i8*, i64*, ...)*)(i8* %3, i64* @tmpnam.seed)
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i8* null, i8* %3
ret i8* %6
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
double stdlib_strided_dsapxsum(int, float, float *, int);
int main() {
  float x[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
  int64_t N = 4;
  int64_t stride = 2;
  double v = stdlib_strided_dsapxsum(N, 5.0f, x, stride);
  printf("sum: %lf\n", v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed8(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x4,-0x24(%rbp)
movl   $0x2,-0x28(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%edx
movss  0xe8c(%rip),%xmm0
call   1040 <stdlib_strided_dsapxsum@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xef5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,(%rsp)
movss  0xebd(%rip),%xmm0
mov    %rsp,%rsi
mov    $0x4,%edi
mov    $0x2,%edx
call   1040 <stdlib_strided_dsapxsum@plt>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [8 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, float 8.000000e+00]
@.str = [10 x i8] c"sum: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x float]
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = bitcast [8 x float]* %1 to i8*
store i32 4, i32* %2
store i32 2, i32* %3
%6 = load i32, i32* %2
%7 = getelementptr inbounds [8 x float], [8 x float]* %1, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call double @stdlib_strided_dsapxsum(i32 %6, float 5.000000e+00, float* %7, i32 %8)
store double %9, double* %4
%10 = load double, double* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [8 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, float 8.000000e+00]
@.str = [10 x i8] c"sum: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x float]
%2 = bitcast [8 x float]* %1 to i8*
%3 = getelementptr inbounds [8 x float], [8 x float]* %1, i64 0, i64 0
%4 = call double @stdlib_strided_dsapxsum(i32 4, float 5.000000e+00, float* %3, i32 2)
%5 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %4)
ret i32 0
}
/* Variables and functions */
char *md5_encode_str(const unsigned char *buffer, long length) {
  char *hash = NULL;
  return hash;
}


x86 assembly (clang, -O0):
<md5_encode_str>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @md5_encode_str(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
store i8* null, i8** %5
%6 = load i8*, i8** %5
ret i8* %6
}

LLVM IR (-O2):
define noalias i8* @md5_encode_str(i8* nocapture readnone %0, i64 %1) {
ret i8* null
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int /*<<< orphan*/);
void print_line_int64_t(uint32_t i, uint32_t j, int64_t v, int magma) {
  if (magma)
    printf("A[%u,%u]:=%ld;\n", i, j, v);
  else
    printf("%u %u %ld\n", i, j, v);
}


x86 assembly (clang, -O0):
<print_line_int64_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1148 <print_line_int64_t+0x38>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
jmp    115d <print_line_int64_t+0x4d>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_line_int64_t>:
mov    %edx,%eax
mov    %esi,%edx
mov    %edi,%esi
test   %ecx,%ecx
lea    0xef1(%rip),%rcx
lea    0xeda(%rip),%rdi
cmove  %rcx,%rdi
mov    %eax,%ecx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"A[%u,%u]:=%ld;\0A\00"
@.str.1 = [11 x i8] c"%u %u %ld\0A\00"
define void @print_line_int64_t(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* %8
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %4
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %13, i32 %14)
br label %21
16: ; preds = %4
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %18, i32 %19)
br label %21
21: ; preds = %16, %11
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"A[%u,%u]:=%ld;\0A\00"
@.str.1 = [11 x i8] c"%u %u %ld\0A\00"
define void @print_line_int64_t(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %3, 0
%6 = select i1 %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0)
%7 = tail call i32 @printf(i8* %6, i32 %0, i32 %1, i32 %2)
ret void
}
void min_max(double value, double *min, double *max) {
  if (value < *min) {
    *min = value;
  }
  if (value > *max) {
    *max = value;
  }
}


x86 assembly (clang, -O0):
<min_max>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1135 <min_max+0x35>
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    1155 <min_max+0x55>
movsd  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<min_max>:
movsd  (%rdi),%xmm1
ucomisd %xmm0,%xmm1
ja     1111 <min_max+0x11>
ucomisd (%rsi),%xmm0
ja     111b <min_max+0x1b>
ret
movsd  %xmm0,(%rdi)
ucomisd (%rsi),%xmm0
jbe    1110 <min_max+0x10>
movsd  %xmm0,(%rsi)
ret

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

LLVM IR (-O2):
define void @min_max(double %0, double* nocapture %1, double* nocapture %2) {
%4 = load double, double* %1
%5 = fcmp ogt double %4, %0
br i1 %5, label %6, label %7
6: ; preds = %3
store double %0, double* %1
br label %7
7: ; preds = %6, %3
%8 = load double, double* %2
%9 = fcmp olt double %8, %0
br i1 %9, label %10, label %11
10: ; preds = %7
store double %0, double* %2
br label %11
11: ; preds = %10, %7
ret void
}
/* Variables and functions */
float int_to_float(int);
float sNaNf(int payload) { return int_to_float(0x7f800000 | payload); }


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

x86 assembly (clang, -O2):
<sNaNf>:
or     $0x7f800000,%edi
jmp    1030 <int_to_float@plt>

LLVM IR (-O0):
define float @sNaNf(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = or i32 2139095040, %3
%5 = call float @int_to_float(i32 %4)
ret float %5
}

LLVM IR (-O2):
define float @sNaNf(i32 %0) {
%2 = or i32 %0, 2139095040
%3 = tail call float @int_to_float(i32 %2)
ret float %3
}
int encode_varint_old(int n, char *buf) {
  int len;
  if (n < 64) {
    len = 1;
    *buf = -n;
  } else {
    len = 2;
    *buf = -(n & 0x3f) - 64;
    *(unsigned char *)(buf + 1) = n >> 6;
  }
  return len;
}


x86 assembly (clang, -O0):
<encode_varint_old>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x40,-0x4(%rbp)
jge    112e <encode_varint_old+0x2e>
movl   $0x1,-0x14(%rbp)
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
jmp    1159 <encode_varint_old+0x59>
movl   $0x2,-0x14(%rbp)
mov    -0x4(%rbp),%ecx
and    $0x3f,%ecx
xor    %eax,%eax
sub    %ecx,%eax
sub    $0x40,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
sar    $0x6,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<encode_varint_old>:
cmp    $0x3f,%edi
jg     1111 <encode_varint_old+0x11>
neg    %dil
mov    %dil,(%rsi)
mov    $0x1,%eax
ret
mov    %edi,%eax
and    $0x3f,%al
mov    $0xc0,%cl
sub    %al,%cl
mov    %cl,(%rsi)
shr    $0x6,%edi
mov    %dil,0x1(%rsi)
mov    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @encode_varint_old(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 64
br i1 %7, label %8, label %13
8: ; preds = %2
store i32 1, i32* %5
%9 = load i32, i32* %3
%10 = sub nsw i32 0, %9
%11 = trunc i32 %10 to i8
%12 = load i8*, i8** %4
store i8 %11, i8* %12
br label %25
13: ; preds = %2
store i32 2, i32* %5
%14 = load i32, i32* %3
%15 = and i32 %14, 63
%16 = sub nsw i32 0, %15
%17 = sub nsw i32 %16, 64
%18 = trunc i32 %17 to i8
%19 = load i8*, i8** %4
store i8 %18, i8* %19
%20 = load i32, i32* %3
%21 = ashr i32 %20, 6
%22 = trunc i32 %21 to i8
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i64 1
store i8 %22, i8* %24
br label %25
25: ; preds = %13, %8
%26 = load i32, i32* %5
ret i32 %26
}

LLVM IR (-O2):
define i32 @encode_varint_old(i32 %0, i8* nocapture writeonly %1) {
%3 = icmp slt i32 %0, 64
%4 = trunc i32 %0 to i8
br i1 %3, label %5, label %7
5: ; preds = %2
%6 = sub i8 0, %4
store i8 %6, i8* %1
br label %13
7: ; preds = %2
%8 = and i8 %4, 63
%9 = sub nuw nsw i8 -64, %8
store i8 %9, i8* %1
%10 = lshr i32 %0, 6
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %11, i8* %12
br label %13
13: ; preds = %7, %5
%14 = phi i32 [ 1, %5 ], [ 2, %7 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void l(void) { printf("l"); }


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

x86 assembly (clang, -O2):
<l>:
mov    $0x6c,%edi
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @l() {
%1 = tail call i32 @putchar(i32 108)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ const uint16_t;

/* Variables and functions */
uint16_t pgm_read_word(const void *ptr) { return *(const uint16_t *)ptr; }


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

x86 assembly (clang, -O2):
<pgm_read_word>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @pgm_read_word(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @pgm_read_word(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
void insw(unsigned short port, void *addr, unsigned long count) {
  __asm__ __volatile__("cld ; rep ; ins"
                       "w"
                       : "=D"(addr), "=c"(count)
                       : "d"(port), "0"(addr), "1"(count));
}


x86 assembly (clang, -O0):
<insw>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x2(%rbp),%dx
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rcx
cld
rep insw (%dx),%es:(%rdi)
mov    %rdi,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<insw>:
mov    %rdx,%rcx
mov    %edi,%edx
mov    %rsi,%rdi
cld
rep insw (%dx),%es:(%rdi)
ret

LLVM IR (-O0):
define void @insw(i16 zeroext %0, i8* %1, i64 %2) {
%4 = alloca i16
%5 = alloca i8*
%6 = alloca i64
store i16 %0, i16* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i16, i16* %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call { i8*, i64 } asm sideeffect "cld ; rep ; insw", "={di},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i16 %7, i8* %8, i64 %9)
%11 = extractvalue { i8*, i64 } %10, 0
%12 = extractvalue { i8*, i64 } %10, 1
store i8* %11, i8** %5
store i64 %12, i64* %6
ret void
}

LLVM IR (-O2):
define void @insw(i16 zeroext %0, i8* %1, i64 %2) {
%4 = tail call { i8*, i64 } asm sideeffect "cld ; rep ; insw", "={di},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i16 %0, i8* %1, i64 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cleanup();
int parse_cmd(int, char **);
int /*<<< orphan*/ run();
int main(int argc, char **argv) {
  int rcode = parse_cmd(argc, argv);
  if (rcode != 0) {
    return rcode;
  }
  run();
  cleanup();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <parse_cmd@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     116a <main+0x3a>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117f <main+0x4f>
mov    $0x0,%al
call   1030 <run@plt>
mov    $0x0,%al
call   1050 <cleanup@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
call   1040 <parse_cmd@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    114a <main+0x1a>
xor    %eax,%eax
call   1030 <run@plt>
xor    %eax,%eax
call   1050 <cleanup@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = call i32 @parse_cmd(i32 %7, i8** %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load i32, i32* %6
store i32 %13, i32* %3
br label %17
14: ; preds = %2
%15 = call i32 (...) @run()
%16 = call i32 (...) @cleanup()
store i32 0, i32* %3
br label %17
17: ; preds = %14, %12
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @parse_cmd(i32 %0, i8** %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 (...) @run()
%7 = tail call i32 (...) @cleanup()
br label %8
8: ; preds = %2, %5
ret i32 %3
}
void debug_info(int vret) {}


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

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

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

LLVM IR (-O2):
define void @debug_info(i32 %0) {
ret void
}
/* Variables and functions */
int RAND_MAX;
int my_rand_r(unsigned int *);
int uniform(int n, unsigned int *seedp) {
  int r;
  int rem = RAND_MAX % n;
  do {
    r = my_rand_r(seedp);
  } while (r > RAND_MAX - rem);
  return r % n;
}


x86 assembly (clang, -O0):
<uniform>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%eax
cltd
idivl  -0x4(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <my_rand_r@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2ea3(%rip),%rcx
mov    (%rcx),%ecx
sub    -0x18(%rbp),%ecx
cmp    %ecx,%eax
jg     112f <uniform+0x1f>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uniform>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%r14d
mov    0x2ec4(%rip),%r15
mov    (%r15),%eax
cltd
idiv   %edi
mov    %edx,%ebp
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <my_rand_r@plt>
mov    (%r15),%ecx
sub    %ebp,%ecx
cmp    %ecx,%eax
jg     1130 <uniform+0x20>
cltd
idiv   %r14d
mov    %edx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@RAND_MAX = global i32 0
define i32 @uniform(i32 %0, i32* %1) {
%3 = load i32, i32* @RAND_MAX
%4 = srem i32 %3, %0
br label %5
5: ; preds = %5, %2
%6 = tail call i32 @my_rand_r(i32* %1)
%7 = load i32, i32* @RAND_MAX
%8 = sub nsw i32 %7, %4
%9 = icmp sgt i32 %6, %8
br i1 %9, label %5, label %10
10: ; preds = %5
%11 = srem i32 %6, %0
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
void g(int j) { f(j); }


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

x86 assembly (clang, -O2):
<g>:
jmp    1030 <f@plt>

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

LLVM IR (-O2):
define void @g(i32 %0) {
%2 = tail call i32 @f(i32 %0)
ret void
}
/* Type definitions */
struct in_addr {
  int dummy;
};

/* Variables and functions */
int mjt_pton4(char const *, struct in_addr *);
int inet_aton(const char *src, struct in_addr *addr) {
  return mjt_pton4(src, addr);
}


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

x86 assembly (clang, -O2):
<inet_aton>:
jmp    1030 <mjt_pton4@plt>

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

LLVM IR (-O2):
%struct.in_addr = type { i32 }
define i32 @inet_aton(i8* %0, %struct.in_addr* %1) {
%3 = tail call i32 @mjt_pton4(i8* %0, %struct.in_addr* %1)
ret i32 %3
}
/* Variables and functions */
char *basm_strdup(char *);
char *blnk_strdup(char *str) { return (basm_strdup(str)); }


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

x86 assembly (clang, -O2):
<blnk_strdup>:
jmp    1030 <basm_strdup@plt>

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

LLVM IR (-O2):
define i8* @blnk_strdup(i8* %0) {
%2 = tail call i8* @basm_strdup(i8* %0)
ret i8* %2
}
void worker_process_exit(void) {}


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

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

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

LLVM IR (-O2):
define void @worker_process_exit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int loadIndexInGPUMemory();
int /*<<< orphan*/ printf(char *);
void prepareServer() {
  int status = loadIndexInGPUMemory();
  if (status == -1) {
    printf("Could not load index in memory. Exiting.\n");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<prepareServer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <loadIndexInGPUMemory@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    1166 <prepareServer+0x36>
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prepareServer>:
push   %rax
xor    %eax,%eax
call   1040 <loadIndexInGPUMemory@plt>
cmp    $0xffffffff,%eax
je     113f <prepareServer+0xf>
pop    %rax
ret
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"Could not load index in memory. Exiting.\0A\00"
@EXIT_FAILURE = global i32 0
define void @prepareServer() {
%1 = alloca i32
%2 = call i32 (...) @loadIndexInGPUMemory()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = call i32 @exit(i32 %7)
unreachable
9: ; preds = %0
ret void
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@str = [41 x i8] c"Could not load index in memory. Exiting.\00"
define void @prepareServer() {
%1 = tail call i32 (...) @loadIndexInGPUMemory()
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
7: ; preds = %0
ret void
}
unsigned long int findGCD(unsigned long int a, unsigned long int b) {
  unsigned long int c;
  while (1) {
    c = a % b;
    if (c == 0) {
      return b;
    }
    a = b;
    b = c;
  }
  return 0;
}


x86 assembly (clang, -O0):
<findGCD>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    112d <findGCD+0x2d>
mov    -0x10(%rbp),%rax
pop    %rbp
ret
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    110c <findGCD+0xc>

x86 assembly (clang, -O2):
<findGCD>:
mov    %rsi,%rdx
mov    %rdi,%rax
jmp    111d <findGCD+0x1d>
nopl   0x0(%rax,%rax,1)
xor    %edx,%edx
div    %rcx
mov    %rcx,%rax
test   %rdx,%rdx
je     1132 <findGCD+0x32>
mov    %rdx,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
jne    1110 <findGCD+0x10>
xor    %edx,%edx
div    %ecx
jmp    1115 <findGCD+0x15>
mov    %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @findGCD(i64 %0, i64 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ %1, %2 ], [ %6, %3 ]
%5 = phi i64 [ %0, %2 ], [ %4, %3 ]
%6 = urem i64 %5, %4
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %3
8: ; preds = %3
ret i64 %4
}
int test_imm_E1int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0xE1 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_E1int64_highword_mem>:
testb  $0xe1,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_E1int64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 32
%6 = and i64 %5, 225
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_E1int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 966367641600
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void *, int);
void __attribute__((regparm(3))) memcpy_4(void *dest, void *src) {
  memcpy(dest, src, 4);
}


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

x86 assembly (clang, -O2):
<memcpy_4>:
mov    $0x4,%edx
jmp    1030 <memcpy@plt>

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

LLVM IR (-O2):
define void @memcpy_4(i8* %0, i8* %1) {
%3 = tail call i32 @memcpy(i8* %0, i8* %1, i32 4)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int dirfd(int /*<<< orphan*/ *);
int /*<<< orphan*/ readlink(char *, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
const char *getdirpath(DIR *dir) {
  static char dirpath[256];
  char linkpath[256];
  int dir_fd;
  dir_fd = dirfd(dir);
  snprintf(linkpath, 256, "/proc/self/fd/%d", dir_fd);
  readlink(linkpath, dirpath, 256);
  return dirpath;
}


x86 assembly (clang, -O0):
<getdirpath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <dirfd@plt>
mov    %eax,-0x114(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x114(%rbp),%ecx
mov    $0x100,%esi
lea    0xe99(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x110(%rbp),%rdi
lea    0x2ed6(%rip),%rsi
mov    $0x100,%edx
call   1030 <readlink@plt>
lea    0x2ec5(%rip),%rax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getdirpath>:
push   %r14
push   %rbx
sub    $0x108,%rsp
call   1050 <dirfd@plt>
lea    0xeba(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x100,%esi
mov    %eax,%ecx
call   1040 <snprintf@plt>
lea    0x2ef1(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x100,%edx
call   1030 <readlink@plt>
mov    %rbx,%rax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@getdirpath.dirpath = internal global [256 x i8] zeroinitializer
@.str = [17 x i8] c"/proc/self/fd/%d\00"
define i8* @getdirpath(i32* %0) {
%2 = alloca i32*
%3 = alloca [256 x i8]
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = call i32 @dirfd(i32* %5)
store i32 %6, i32* %4
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%8 = load i32, i32* %4
%9 = call i32 @snprintf(i8* %7, i32 256, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%11 = call i32 @readlink(i8* %10, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @getdirpath.dirpath, i64 0, i64 0), i32 256)
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @getdirpath.dirpath, i64 0, i64 0)
}

LLVM IR (-O2):
@getdirpath.dirpath = internal global [256 x i8] zeroinitializer
@.str = [17 x i8] c"/proc/self/fd/%d\00"
define i8* @getdirpath(i32* %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @dirfd(i32* %0)
%5 = call i32 @snprintf(i8* %3, i32 256, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @readlink(i8* %3, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @getdirpath.dirpath, i64 0, i64 0), i32 256)
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @getdirpath.dirpath, i64 0, i64 0)
}
/* Variables and functions */
float __math_check_uflowf(float);
float check_uflowf(float x) { return 0 ? __math_check_uflowf(x) : x; }


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

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

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

LLVM IR (-O2):
define float @check_uflowf(float returned %0) {
ret float %0
}
void stop_speech(void) {}


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

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

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

LLVM IR (-O2):
define void @stop_speech() {
ret void
}
/* Variables and functions */
int pow(int, int);
int number_of_elements(int subdivision_level) {
  return 20 * pow(4, subdivision_level);
}


x86 assembly (clang, -O0):
<number_of_elements>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x4,%edi
call   1030 <pow@plt>
imul   $0x14,%eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<number_of_elements>:
push   %rax
mov    %edi,%esi
mov    $0x4,%edi
call   1030 <pow@plt>
shl    $0x2,%eax
lea    (%rax,%rax,4),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @number_of_elements(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @pow(i32 4, i32 %3)
%5 = mul nsw i32 20, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @number_of_elements(i32 %0) {
%2 = tail call i32 @pow(i32 4, i32 %0)
%3 = mul nsw i32 %2, 20
ret i32 %3
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int rec_clone_file(char const *const, char const *const, char *, struct stat *);
scalar_t__ stat(char const *const, struct stat *);
int clone_file(const char *const oldpath, const char *const newpath) {
  struct stat b;
  if (stat(oldpath, &b)) {
    return -1;
  }
  return rec_clone_file(oldpath, newpath, "", &b);
}


x86 assembly (clang, -O0):
<clone_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
je     1153 <clone_file+0x33>
movl   $0xffffffff,-0x4(%rbp)
jmp    116e <clone_file+0x4e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    0xe9e(%rip),%rdx
lea    -0x20(%rbp),%rcx
call   1040 <rec_clone_file@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clone_file>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%rsi
call   1030 <stat@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    1154 <clone_file+0x34>
lea    0xeba(%rip),%rdx
mov    %rsp,%rcx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <rec_clone_file@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [1 x i8] zeroinitializer
define i32 @clone_file(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca %struct.stat
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = call i64 @stat(i8* %7, %struct.stat* %6)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 -1, i32* %3
br label %15
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = load i8*, i8** %5
%14 = call i32 @rec_clone_file(i8* %12, i8* %13, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %struct.stat* %6)
store i32 %14, i32* %3
br label %15
15: ; preds = %11, %10
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [1 x i8] zeroinitializer
define i32 @clone_file(i8* %0, i8* %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = call i64 @stat(i8* %0, %struct.stat* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 @rec_clone_file(i8* %0, i8* %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %struct.stat* %3)
br label %9
9: ; preds = %2, %7
%10 = phi i32 [ %8, %7 ], [ -1, %2 ]
ret i32 %10
}