xunge/DecIR huggingface dataset:
/* Variables and functions */
size_t strlen(const char *s) {
  const char *start = s;
  while (*s++)
    ;
  return (s - 1) - start;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     112d <strlen+0x2d>
jmp    1110 <strlen+0x10>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %4, %2 ]
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %3
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
long random();
long strtol(char *, char **, int /*<<< orphan*/);
int test(void) {
  long x;
  printf("Hello World!\n");
  x = random();
  printf("Result of random() = %ld\n", x);
  x = strtol("42", (char **)0, 0);
  printf("Result of strtol() = %ld\n", x);
  return (0);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <random@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
lea    0xefc(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <random@plt>
lea    0xeb5(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
mov    $0x2a,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello World!\0A\00"
@.str.1 = [26 x i8] c"Result of random() = %ld\0A\00"
@.str.2 = [3 x i8] c"42\00"
@.str.3 = [26 x i8] c"Result of strtol() = %ld\0A\00"
define i32 @test() {
%1 = alloca i64
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = call i64 (...) @random()
store i64 %3, i64* %1
%4 = load i64, i64* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i64 %4)
%6 = call i64 @strtol(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** null, i32 0)
store i64 %6, i64* %1
%7 = load i64, i64* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i64 %7)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [26 x i8] c"Result of random() = %ld\0A\00"
@.str.3 = [26 x i8] c"Result of strtol() = %ld\0A\00"
@str = [13 x i8] c"Hello World!\00"
define i32 @test() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = tail call i64 (...) @random()
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i64 %2)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i64 42)
ret i32 0
}
int process_sman_fin() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @process_sman_fin() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ interrupt(int, int, char *, int, int /*<<< orphan*/);
void terminate() {
  char shell[6];
  shell[0] = 's';
  shell[1] = 'h';
  shell[2] = 'e';
  shell[3] = 'l';
  shell[4] = 'l';
  shell[5] = '\0';
  interrupt(0x21, 4, shell, 0x2000, 0);
}


x86 assembly (clang, -O0):
<terminate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x73,-0x6(%rbp)
movb   $0x68,-0x5(%rbp)
movb   $0x65,-0x4(%rbp)
movb   $0x6c,-0x3(%rbp)
movb   $0x6c,-0x2(%rbp)
movb   $0x0,-0x1(%rbp)
lea    -0x6(%rbp),%rdx
mov    $0x21,%edi
mov    $0x4,%esi
mov    $0x2000,%ecx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<terminate>:
push   %rax
movl   $0x6c656873,0x2(%rsp)
6c
movw   $0x6c,0x6(%rsp)
lea    0x2(%rsp),%rdx
mov    $0x21,%edi
mov    $0x4,%esi
mov    $0x2000,%ecx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @terminate() {
%1 = alloca [6 x i8]
%2 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
store i8 115, i8* %2
%3 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 1
store i8 104, i8* %3
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 2
store i8 101, i8* %4
%5 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 3
store i8 108, i8* %5
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 4
store i8 108, i8* %6
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 5
store i8 0, i8* %7
%8 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%9 = call i32 @interrupt(i32 33, i32 4, i8* %8, i32 8192, i32 0)
ret void
}

LLVM IR (-O2):
define void @terminate() {
%1 = alloca [6 x i8]
%2 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
store i8 115, i8* %2
%3 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 1
store i8 104, i8* %3
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 2
store i8 101, i8* %4
%5 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 3
store i8 108, i8* %5
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 4
store i8 108, i8* %6
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 5
store i8 0, i8* %7
%8 = call i32 @interrupt(i32 33, i32 4, i8* %2, i32 8192, i32 0)
ret void
}
/* Type definitions */
struct rusage {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ RUSAGE_SELF;
int /*<<< orphan*/ getrusage(int /*<<< orphan*/, struct rusage *);
int /*<<< orphan*/ printf(char *);
int main(void) {
  struct rusage rusage;
  (void)getrusage(RUSAGE_SELF, &rusage);
  printf("#define HAVE_GETRUSAGE /* yes */\n");
  return 0;
}


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

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

LLVM IR (-O0):
%struct.rusage = type { i32 }
@RUSAGE_SELF = global i32 0
@.str = [34 x i8] c"#define HAVE_GETRUSAGE /* yes */\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.rusage
store i32 0, i32* %1
%3 = load i32, i32* @RUSAGE_SELF
%4 = call i32 @getrusage(i32 %3, %struct.rusage* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.rusage = type { i32 }
@RUSAGE_SELF = global i32 0
@str = [33 x i8] c"#define HAVE_GETRUSAGE /* yes */\00"
define i32 @main() {
%1 = alloca %struct.rusage
%2 = bitcast %struct.rusage* %1 to i8*
%3 = load i32, i32* @RUSAGE_SELF
%4 = call i32 @getrusage(i32 %3, %struct.rusage* %1)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int is_prime(int num) {
  int y;
  if (num < 2) {
    return 0;
  } else if (num == 2) {
    return 1;
  }
  for (y = 2; y < num; y++) {
    if (num % y == 0) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    111d <is_prime+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1181 <is_prime+0x81>
cmpl   $0x2,-0x8(%rbp)
jne    1133 <is_prime+0x33>
movl   $0x1,-0x4(%rbp)
jmp    1181 <is_prime+0x81>
jmp    1138 <is_prime+0x38>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    117a <is_prime+0x7a>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1167 <is_prime+0x67>
movl   $0x0,-0x4(%rbp)
jmp    1181 <is_prime+0x81>
jmp    116c <is_prime+0x6c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113f <is_prime+0x3f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
xor    %ecx,%ecx
cmp    $0x2,%edi
jge    110a <is_prime+0xa>
mov    %ecx,%eax
ret
jne    1112 <is_prime+0x12>
mov    $0x1,%eax
ret
mov    $0x2,%esi
nopw   0x0(%rax,%rax,1)
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1107 <is_prime+0x7>
add    $0x1,%esi
cmp    %esi,%edi
jne    1120 <is_prime+0x20>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @is_prime(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = icmp eq i32 %0, 2
br i1 %4, label %12, label %7
5: ; preds = %7
%6 = icmp eq i32 %11, %0
br i1 %6, label %12, label %7
7: ; preds = %3, %5
%8 = phi i32 [ %11, %5 ], [ 2, %3 ]
%9 = srem i32 %0, %8
%10 = icmp eq i32 %9, 0
%11 = add nuw nsw i32 %8, 1
br i1 %10, label %12, label %5
12: ; preds = %7, %5, %3, %1
%13 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 0, %7 ], [ 1, %5 ]
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int parse_fasta_alignment(int /*<<< orphan*/ *, char ***, char ***, int);
int parse_aln_fasta(FILE *fp, char ***names, char ***aln, char **id,
                    char **structure, int verbosity) {
  if (id)
    *id = NULL;
  if (structure)
    *structure = NULL;
  return parse_fasta_alignment(fp, names, aln, verbosity);
}


x86 assembly (clang, -O0):
<parse_aln_fasta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1146 <parse_aln_fasta+0x36>
mov    -0x20(%rbp),%rax
movq   $0x0,(%rax)
cmpq   $0x0,-0x28(%rbp)
je     115c <parse_aln_fasta+0x4c>
mov    -0x28(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
call   1030 <parse_fasta_alignment@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_aln_fasta>:
test   %rcx,%rcx
je     111c <parse_aln_fasta+0xc>
movq   $0x0,(%rcx)
test   %r8,%r8
je     1128 <parse_aln_fasta+0x18>
movq   $0x0,(%r8)
mov    %r9d,%ecx
jmp    1030 <parse_fasta_alignment@plt>

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

LLVM IR (-O2):
define i32 @parse_aln_fasta(i32* %0, i8*** %1, i8*** %2, i8** writeonly %3, i8** writeonly %4, i32 %5) {
%7 = icmp eq i8** %3, null
br i1 %7, label %9, label %8
8: ; preds = %6
store i8* null, i8** %3
br label %9
9: ; preds = %8, %6
%10 = icmp eq i8** %4, null
br i1 %10, label %12, label %11
11: ; preds = %9
store i8* null, i8** %4
br label %12
12: ; preds = %11, %9
%13 = tail call i32 @parse_fasta_alignment(i32* %0, i8*** %1, i8*** %2, i32 %5)
ret i32 %13
}
float alpha2angle(float alpha) {
  alpha = 20 / 33.9333333 * alpha * -1;
  alpha = alpha + 135 - 18;
  return alpha;
}


x86 assembly (clang, -O0):
<alpha2angle>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xef6(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xee2(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  0xec9(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
movss  0xeb8(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<alpha2angle>:
cvtss2sd %xmm0,%xmm0
mulsd  0xef4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
addss  0xef0(%rip),%xmm0
addss  0xeec(%rip),%xmm0
ret

LLVM IR (-O0):
define float @alpha2angle(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fmul double 0x3FE2DC4A6FF70DE6, %4
%6 = fmul double %5, -1.000000e+00
%7 = fptrunc double %6 to float
store float %7, float* %2
%8 = load float, float* %2
%9 = fadd float %8, 1.350000e+02
%10 = fsub float %9, 1.800000e+01
store float %10, float* %2
%11 = load float, float* %2
ret float %11
}

LLVM IR (-O2):
define float @alpha2angle(float %0) {
%2 = fpext float %0 to double
%3 = fmul double %2, 0xBFE2DC4A6FF70DE6
%4 = fptrunc double %3 to float
%5 = fadd float %4, 1.350000e+02
%6 = fadd float %5, -1.800000e+01
ret float %6
}
/* Variables and functions */
int bar();
int foo() {
  int a, b, c;
  a = b + c;
  b = bar();
  c = bar();
  return a + b + c;
}


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

x86 assembly (clang, -O2):
<foo>:
push   %rax
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <bar@plt>

LLVM IR (-O0):
define i32 @foo() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = add nsw i32 %4, %5
store i32 %6, i32* %1
%7 = call i32 (...) @bar()
store i32 %7, i32* %2
%8 = call i32 (...) @bar()
store i32 %8, i32* %3
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = add nsw i32 %9, %10
%12 = load i32, i32* %3
%13 = add nsw i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @foo() {
%1 = tail call i32 (...) @bar()
%2 = tail call i32 (...) @bar()
ret i32 undef
}
void wifi_rsp_sme_disconnect(const struct wifi_msg_sme_disconnect_rsp_t *msg) {}


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

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

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

LLVM IR (-O2):
%struct.wifi_msg_sme_disconnect_rsp_t = type opaque
define void @wifi_rsp_sme_disconnect(%struct.wifi_msg_sme_disconnect_rsp_t* nocapture %0) {
ret void
}
int intcmp(int *i1, int *i2) { return *i1 - *i2; }


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

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

LLVM IR (-O0):
define i32 @intcmp(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = sub nsw i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @intcmp(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = sub nsw i32 %3, %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ XKeymapEvent;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void free_XKeymapEvent(void *_p) {
  if (_p == NULL)
    abort();
  free((XKeymapEvent *)_p);
}


x86 assembly (clang, -O0):
<free_XKeymapEvent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113e <free_XKeymapEvent+0x1e>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_XKeymapEvent>:
test   %rdi,%rdi
je     112a <free_XKeymapEvent+0xa>
jmp    1030 <free@plt>
push   %rax
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
define void @free_XKeymapEvent(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = bitcast i8* %8 to i32*
%10 = call i32 @free(i32* %9)
ret void
}

LLVM IR (-O2):
define void @free_XKeymapEvent(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
%6 = bitcast i8* %0 to i32*
%7 = tail call i32 @free(i32* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(unsigned char *);
unsigned char *malloc(int);
__attribute__((no)) int do_stupid_malloc_stuff(void) {
  int sum = 0;
  unsigned char *duh = malloc(100 * sizeof(char));
  sum += duh[-1];
  free(duh);
  sum += duh[50];
  return sum;
}


x86 assembly (clang, -O0):
<do_stupid_malloc_stuff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl -0x1(%rax),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
movzbl 0x32(%rax),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_stupid_malloc_stuff>:
push   %rbx
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <free@plt>
movzbl 0x32(%rbx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @do_stupid_malloc_stuff() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* @malloc(i32 100)
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 -1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = load i32, i32* %1
%9 = add nsw i32 %8, %7
store i32 %9, i32* %1
%10 = load i8*, i8** %2
%11 = call i32 @free(i8* %10)
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 50
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = load i32, i32* %1
%17 = add nsw i32 %16, %15
store i32 %17, i32* %1
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
define i32 @do_stupid_malloc_stuff() {
%1 = tail call dereferenceable_or_null(100) i8* @malloc(i32 100)
%2 = tail call i32 @free(i8* %1)
%3 = getelementptr inbounds i8, i8* %1, i64 50
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
ret i32 %5
}
unsigned int inl(int port) {
  unsigned long val;
  __asm__ __volatile__("inl %w1, %k0" : "=a"(val) : "Nd"(port));
  return val;
}


x86 assembly (clang, -O0):
<inl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
in     (%dx),%eax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inl>:
mov    %edi,%edx
in     (%dx),%eax
ret

LLVM IR (-O0):
define i32 @inl(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i64 asm sideeffect "inl ${1:w}, ${0:k}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 %4)
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @inl(i32 %0) {
%2 = tail call i64 asm sideeffect "inl ${1:w}, ${0:k}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
int main() {
  system("cd /mnt/user/code/Events/bin && /mnt/user/jvm/java Main");
}


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

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

LLVM IR (-O0):
@.str = [56 x i8] c"cd /mnt/user/code/Events/bin && /mnt/user/jvm/java Main\00"
define i32 @main() {
%1 = call i32 @system(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [56 x i8] c"cd /mnt/user/code/Events/bin && /mnt/user/jvm/java Main\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int test_imm_0Duint8_reg(unsigned char val) {
  return ((val) & (-0x0D << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_0Duint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xfffffff3,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_0Duint8_reg>:
test   $0xf3,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_0Duint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -13
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void functionWithoutLoop() { printf("Empty\n"); }


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"Empty\00"
define void @functionWithoutLoop() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
int test_goto2(int f) {
  int i;
  for (i = 0; i < 10; i++)
    if (i == f)
      goto lab2;
  return 4;
lab2:
  return 8;
}


x86 assembly (clang, -O0):
<test_goto2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    113c <test_goto2+0x3c>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1129 <test_goto2+0x29>
jmp    1148 <test_goto2+0x48>
jmp    112e <test_goto2+0x2e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <test_goto2+0xe>
movl   $0x4,-0x4(%rbp)
jmp    114f <test_goto2+0x4f>
movl   $0x8,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_goto2>:
xor    %eax,%eax
cmp    $0xa,%edi
setb   %al
lea    0x4(,%rax,4),%eax
ret

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

LLVM IR (-O2):
define i32 @test_goto2(i32 %0) {
%2 = icmp ult i32 %0, 10
%3 = select i1 %2, i32 8, i32 4
ret i32 %3
}
void movqq(float *dest, const float *src) {
  dest[0] = src[0];
  dest[1] = src[1];
  dest[2] = src[2];
  dest[3] = src[3];
}


x86 assembly (clang, -O0):
<movqq>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movss  0xc(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<movqq>:
movss  (%rsi),%xmm0
movss  %xmm0,(%rdi)
movss  0x4(%rsi),%xmm0
movss  %xmm0,0x4(%rdi)
movss  0x8(%rsi),%xmm0
movss  %xmm0,0x8(%rdi)
movss  0xc(%rsi),%xmm0
movss  %xmm0,0xc(%rdi)
ret

LLVM IR (-O0):
define void @movqq(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %4
%6 = getelementptr inbounds float, float* %5, i64 0
%7 = load float, float* %6
%8 = load float*, float** %3
%9 = getelementptr inbounds float, float* %8, i64 0
store float %7, float* %9
%10 = load float*, float** %4
%11 = getelementptr inbounds float, float* %10, i64 1
%12 = load float, float* %11
%13 = load float*, float** %3
%14 = getelementptr inbounds float, float* %13, i64 1
store float %12, float* %14
%15 = load float*, float** %4
%16 = getelementptr inbounds float, float* %15, i64 2
%17 = load float, float* %16
%18 = load float*, float** %3
%19 = getelementptr inbounds float, float* %18, i64 2
store float %17, float* %19
%20 = load float*, float** %4
%21 = getelementptr inbounds float, float* %20, i64 3
%22 = load float, float* %21
%23 = load float*, float** %3
%24 = getelementptr inbounds float, float* %23, i64 3
store float %22, float* %24
ret void
}

LLVM IR (-O2):
define void @movqq(float* nocapture writeonly %0, float* nocapture %1) {
%3 = load float, float* %1
store float %3, float* %0
%4 = getelementptr inbounds float, float* %1, i64 1
%5 = load float, float* %4
%6 = getelementptr inbounds float, float* %0, i64 1
store float %5, float* %6
%7 = getelementptr inbounds float, float* %1, i64 2
%8 = load float, float* %7
%9 = getelementptr inbounds float, float* %0, i64 2
store float %8, float* %9
%10 = getelementptr inbounds float, float* %1, i64 3
%11 = load float, float* %10
%12 = getelementptr inbounds float, float* %0, i64 3
store float %11, float* %12
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gmvwrite_vinfo_name_data(int, int, char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
void fgmvwrite_vinfo_name_data_(int nelem, int nlines, char varname[],
                                char *vids) {
  char name[10];
  strncpy(name, varname, 8);
  *(name + 8) = '\0';
  gmvwrite_vinfo_name_data(nelem, nlines, name, vids);
}


x86 assembly (clang, -O0):
<fgmvwrite_vinfo_name_data_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
lea    -0x22(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x1a(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0x22(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1040 <gmvwrite_vinfo_name_data@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgmvwrite_vinfo_name_data_>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r14
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xe(%rsp),%r15
mov    %r15,%rdi
mov    %rdx,%rsi
mov    $0x8,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x16(%rsp)
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <gmvwrite_vinfo_name_data@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @fgmvwrite_vinfo_name_data_(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [10 x i8]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%11 = load i8*, i8** %7
%12 = call i32 @strncpy(i8* %10, i8* %11, i32 8)
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%14 = getelementptr inbounds i8, i8* %13, i64 8
store i8 0, i8* %14
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%18 = load i8*, i8** %8
%19 = call i32 @gmvwrite_vinfo_name_data(i32 %15, i32 %16, i8* %17, i8* %18)
ret void
}

LLVM IR (-O2):
define void @fgmvwrite_vinfo_name_data_(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca [10 x i8]
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%7 = call i32 @strncpy(i8* %6, i8* %2, i32 8)
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 8
store i8 0, i8* %8
%9 = call i32 @gmvwrite_vinfo_name_data(i32 %0, i32 %1, i8* %6, i8* %3)
ret void
}
/* Variables and functions */
int strcmp(char const *, char const *);
int os_strcmp(const char *s1, const char *s2) { return strcmp(s1, s2); }


x86 assembly (clang, -O0):
<os_strcmp>:
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 <strcmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_strcmp>:
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @os_strcmp(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 @strcmp(i8* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @os_strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ srand(int);
int time(int /*<<< orphan*/ *);
void init_rand() {
  static int first = 1;
  if (first) {
    first = 0;
    int seed = time(NULL);
    printf("********* seed = %d\n", seed);
    srand(seed);
  }
}


x86 assembly (clang, -O0):
<init_rand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cmpl   $0x0,0x2ef9(%rip)
je     1172 <init_rand+0x42>
movl   $0x0,0x2ee9(%rip)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <srand@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_rand>:
push   %rbx
cmpb   $0x0,0x2f04(%rip)
je     113c <init_rand+0xc>
pop    %rbx
ret
movb   $0x1,0x2ef9(%rip)
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%ebx
lea    0xead(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <srand@plt>

LLVM IR (-O0):
@init_rand.first = internal global i32 1
@.str = [21 x i8] c"********* seed = %d\0A\00"
define void @init_rand() {
%1 = alloca i32
%2 = load i32, i32* @init_rand.first
%3 = icmp ne i32 %2, 0
br i1 %3, label %4, label %10
4: ; preds = %0
store i32 0, i32* @init_rand.first
%5 = call i32 @time(i32* null)
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %1
%9 = call i32 @srand(i32 %8)
br label %10
10: ; preds = %4, %0
ret void
}

LLVM IR (-O2):
@init_rand.first = internal unnamed_addr global i1 false
@.str = [21 x i8] c"********* seed = %d\0A\00"
define void @init_rand() {
%1 = load i1, i1* @init_rand.first
br i1 %1, label %6, label %2
2: ; preds = %0
store i1 true, i1* @init_rand.first
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @srand(i32 %3)
br label %6
6: ; preds = %2, %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ key_t;

/* Variables and functions */
int shmget(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int __sm_seg_stat(key_t key) {
  int id;
  do {
    ;
  } while (0);
  id = shmget(key, 0, 0);
  return (id);
}


x86 assembly (clang, -O0):
<__sm_seg_stat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
jmp    1120 <__sm_seg_stat+0x10>
mov    -0x4(%rbp),%edi
xor    %edx,%edx
mov    %edx,%esi
call   1030 <shmget@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sm_seg_stat>:
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <shmget@plt>

LLVM IR (-O0):
define i32 @__sm_seg_stat(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %1
br label %5
5: ; preds = %4
%6 = load i32, i32* %2
%7 = call i32 @shmget(i32 %6, i32 0, i32 0)
store i32 %7, i32* %3
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @__sm_seg_stat(i32 %0) {
%2 = tail call i32 @shmget(i32 %0, i32 0, i32 0)
ret i32 %2
}
void BIO_dump_fp(void) {}


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

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

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

LLVM IR (-O2):
define void @BIO_dump_fp() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ F();
int E() { F(); }


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

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

LLVM IR (-O0):
define i32 @E() {
%1 = alloca i32
%2 = call i32 (...) @F()
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @E() {
%1 = tail call i32 (...) @F()
ret i32 undef
}
double heaviside(double z) {
  float w = 1.0;
  if (z < 0)
    w = 0.0;
  return (w);
}


x86 assembly (clang, -O0):
<heaviside>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movss  0xeef(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    112c <heaviside+0x2c>
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<heaviside>:
xorpd  %xmm1,%xmm1
cmpltsd %xmm1,%xmm0
movsd  0xeef(%rip),%xmm1
andnpd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @heaviside(double %0) {
%2 = alloca double
%3 = alloca float
store double %0, double* %2
store float 1.000000e+00, float* %3
%4 = load double, double* %2
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %6, label %7
6: ; preds = %1
store float 0.000000e+00, float* %3
br label %7
7: ; preds = %6, %1
%8 = load float, float* %3
%9 = fpext float %8 to double
ret double %9
}

LLVM IR (-O2):
define double @heaviside(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = select i1 %2, double 0.000000e+00, double 1.000000e+00
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void invalid_move() {
  fputs("A player tried to play a forbidden move.", stderr);
}


x86 assembly (clang, -O0):
<invalid_move>:
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):
<invalid_move>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"A player tried to play a forbidden move.\00"
@stderr = global i32 0
define void @invalid_move() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"A player tried to play a forbidden move.\00"
@stderr = global i32 0
define void @invalid_move() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int strlen(char const *);
int uri_length_string(char const *);
int uri_validate_string(const char *string) {
  int n = uri_length_string(string);
  return n >= 0 ? n == strlen(string) : n;
}


x86 assembly (clang, -O0):
<uri_validate_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <uri_length_string@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1168 <uri_validate_string+0x48>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
jmp    116e <uri_validate_string+0x4e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uri_validate_string>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <uri_length_string@plt>
mov    %eax,%ebx
test   %eax,%eax
js     1143 <uri_validate_string+0x23>
mov    %r14,%rdi
call   1030 <strlen@plt>
xor    %ecx,%ecx
cmp    %eax,%ebx
sete   %cl
mov    %ecx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @uri_validate_string(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @uri_length_string(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i32, i32* %3
%10 = load i8*, i8** %2
%11 = call i32 @strlen(i8* %10)
%12 = icmp eq i32 %9, %11
%13 = zext i1 %12 to i32
br label %16
14: ; preds = %1
%15 = load i32, i32* %3
br label %16
16: ; preds = %14, %8
%17 = phi i32 [ %13, %8 ], [ %15, %14 ]
ret i32 %17
}

LLVM IR (-O2):
define i32 @uri_validate_string(i8* %0) {
%2 = tail call i32 @uri_length_string(i8* %0)
%3 = icmp sgt i32 %2, -1
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 @strlen(i8* %0)
%6 = icmp eq i32 %2, %5
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ %2, %1 ]
ret i32 %9
}
int test_imm_59uint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0x59 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_59uint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 32
%6 = and i64 %5, 89
%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_59uint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 382252089344
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int main(int argc, char **argv) {
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void imprimir_entero(int dato) { printf("%d ", dato); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @imprimir_entero(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
__attribute__((no, noclone)) unsigned __int128 t153_4add(unsigned __int128 x) {
  unsigned __int128 y = (-1);
  unsigned __int128 r;
  if (__builtin_add_overflow(x, y, &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t153_4add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
movq   $0xffffffffffffffff,-0x38(%rbp)
ff
movq   $0xffffffffffffffff,-0x40(%rbp)
ff
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x40(%rbp),%rsi
mov    -0x38(%rbp),%rax
add    %rsi,%rdx
adc    %rax,%rcx
setb   %al
mov    %rdx,-0x50(%rbp)
mov    %rcx,-0x48(%rbp)
test   $0x1,%al
jne    116e <t153_4add+0x5e>
jmp    1175 <t153_4add+0x65>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x50(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t153_4add>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
adc    $0xffffffffffffffff,%r14
jae    112b <t153_4add+0x1b>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %rbx,%rax
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define { i64, i64 } @t153_4add(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = tail call { i128, i1 } @llvm.uadd.with.overflow.i128(i128 %6, i128 -1)
%8 = extractvalue { i128, i1 } %7, 1
%9 = extractvalue { i128, i1 } %7, 0
br i1 %8, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (...) @bar()
br label %12
12: ; preds = %10, %2
%13 = trunc i128 %9 to i64
%14 = lshr i128 %9, 64
%15 = trunc i128 %14 to i64
%16 = insertvalue { i64, i64 } poison, i64 %13, 0
%17 = insertvalue { i64, i64 } %16, i64 %15, 1
ret { i64, i64 } %17
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
void read_int_array(int *arr, int len) {
  for (int i = 0; i < len; ++i) {
    scanf("%d", &arr[i]);
  }
}


x86 assembly (clang, -O0):
<read_int_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115b <read_int_array+0x4b>
mov    -0x8(%rbp),%rsi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeb8(%rip),%rdi
call   1030 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <read_int_array+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_int_array>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1145 <read_int_array+0x35>
mov    %rdi,%rbx
mov    %esi,%r15d
lea    0xeda(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <scanf@plt>
add    $0x4,%rbx
add    $0xffffffffffffffff,%r15
jne    1130 <read_int_array+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @read_int_array(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 = %16, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %19
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
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %14)
br label %16
16: ; preds = %10
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %5
br label %6
19: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @read_int_array(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %11, %7 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%11 = add nuw nsw i64 %8, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %6, label %7
}