xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ tmp;
struct SFMF_FileHash {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int sfmf_filehash_format(struct SFMF_FileHash *, char *, int);
char *strdup(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
char *make_blob_filename(struct SFMF_FileHash *hash) {
  char tmp[128];
  int res = sfmf_filehash_format(hash, tmp, sizeof(tmp));
  assert(res);
  strncat(tmp, ".blob", sizeof(tmp));
  return strdup(tmp);
}


x86 assembly (clang, -O0):
<make_blob_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
mov    $0x80,%edx
call   1050 <sfmf_filehash_format@plt>
mov    %eax,-0x94(%rbp)
mov    -0x94(%rbp),%edi
call   1040 <assert@plt>
lea    -0x90(%rbp),%rdi
lea    0xe7d(%rip),%rsi
mov    $0x80,%edx
call   1030 <strncat@plt>
lea    -0x90(%rbp),%rdi
call   1060 <strdup@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_blob_filename>:
push   %rbx
sub    $0x80,%rsp
mov    %rsp,%rbx
mov    %rbx,%rsi
mov    $0x80,%edx
call   1050 <sfmf_filehash_format@plt>
mov    %eax,%edi
call   1040 <assert@plt>
lea    0xe9a(%rip),%rsi
mov    %rbx,%rdi
mov    $0x80,%edx
call   1030 <strncat@plt>
mov    %rbx,%rdi
call   1060 <strdup@plt>
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.SFMF_FileHash = type { i32 }
@.str = [6 x i8] c".blob\00"
define i8* @make_blob_filename(%struct.SFMF_FileHash* %0) {
%2 = alloca %struct.SFMF_FileHash*
%3 = alloca [128 x i8]
%4 = alloca i32
store %struct.SFMF_FileHash* %0, %struct.SFMF_FileHash** %2
%5 = load %struct.SFMF_FileHash*, %struct.SFMF_FileHash** %2
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%7 = call i32 @sfmf_filehash_format(%struct.SFMF_FileHash* %5, i8* %6, i32 128)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = call i32 @assert(i32 %8)
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%11 = call i32 @strncat(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 128)
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%13 = call i8* @strdup(i8* %12)
ret i8* %13
}

LLVM IR (-O2):
%struct.SFMF_FileHash = type { i32 }
@.str = [6 x i8] c".blob\00"
define noalias i8* @make_blob_filename(%struct.SFMF_FileHash* %0) {
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%4 = call i32 @sfmf_filehash_format(%struct.SFMF_FileHash* %0, i8* %3, i32 128)
%5 = call i32 @assert(i32 %4)
%6 = call i32 @strncat(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 128)
%7 = call i8* @strdup(i8* %3)
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char *malloc(scalar_t__);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *strcopy(char *str) {
  char *p = malloc(strlen(str) + 1);
  if (!p) {
    fprintf(stderr, "out of memory\n");
    exit(-1);
  }
  strcpy(p, str);
  return (p);
}


x86 assembly (clang, -O0):
<strcopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    119f <strcopy+0x4f>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
lea    0xe70(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcopy>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1060 <malloc@plt>
test   %rax,%rax
je     1183 <strcopy+0x33>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
lea    0xe6d(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"out of memory\0A\00"
define i8* @strcopy(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %14, label %10
10: ; preds = %1
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 -1)
unreachable
14: ; preds = %1
%15 = load i8*, i8** %3
%16 = load i8*, i8** %2
%17 = call i32 @strcpy(i8* %15, i8* %16)
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"out of memory\0A\00"
define i8* @strcopy(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 -1)
unreachable
10: ; preds = %1
%11 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
double calculate(double a, double b, char op) {
  switch (op) {
  case '+':
    return a + b;
  case '-':
    return a - b;
  case '*':
    return a * b;
  case '/':
    return a / b;
  }
}


x86 assembly (clang, -O0):
<calculate>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x5,%eax
ja     1189 <calculate+0x89>
mov    -0x28(%rbp),%rax
lea    0xecb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1189 <calculate+0x89>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1189 <calculate+0x89>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1189 <calculate+0x89>
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate>:
add    $0xffffffd6,%edi
cmp    $0x5,%edi
ja     112b <calculate+0x2b>
lea    0xef1(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mulsd  %xmm1,%xmm0
ret
addsd  %xmm1,%xmm0
ret
subsd  %xmm1,%xmm0
ret
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @calculate(double %0, double %1, i8 signext %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i8
store double %0, double* %5
store double %1, double* %6
store i8 %2, i8* %7
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
switch i32 %9, label %26 [
i32 43, label %10
i32 45, label %14
i32 42, label %18
i32 47, label %22
]
10: ; preds = %3
%11 = load double, double* %5
%12 = load double, double* %6
%13 = fadd double %11, %12
store double %13, double* %4
br label %26
14: ; preds = %3
%15 = load double, double* %5
%16 = load double, double* %6
%17 = fsub double %15, %16
store double %17, double* %4
br label %26
18: ; preds = %3
%19 = load double, double* %5
%20 = load double, double* %6
%21 = fmul double %19, %20
store double %21, double* %4
br label %26
22: ; preds = %3
%23 = load double, double* %5
%24 = load double, double* %6
%25 = fdiv double %23, %24
store double %25, double* %4
br label %26
26: ; preds = %10, %14, %18, %22, %3
%27 = load double, double* %4
ret double %27
}

LLVM IR (-O2):
define double @calculate(double %0, double %1, i8 signext %2) {
%4 = sext i8 %2 to i32
switch i32 %4, label %13 [
i32 43, label %5
i32 45, label %7
i32 42, label %9
i32 47, label %11
]
5: ; preds = %3
%6 = fadd double %0, %1
br label %13
7: ; preds = %3
%8 = fsub double %0, %1
br label %13
9: ; preds = %3
%10 = fmul double %0, %1
br label %13
11: ; preds = %3
%12 = fdiv double %0, %1
br label %13
13: ; preds = %5, %7, %9, %11, %3
%14 = phi double [ undef, %3 ], [ %12, %11 ], [ %10, %9 ], [ %8, %7 ], [ %6, %5 ]
ret double %14
}
/* Variables and functions */
int yahoo_M1Common(unsigned int, int);
int yahoo_f01_5a(int Salt, int Parameter) {
  unsigned b = Salt * 0x41CD726F + 0x3F79;
  return yahoo_M1Common(b, Parameter);
}


x86 assembly (clang, -O0):
<yahoo_f01_5a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
imul   $0x41cd726f,-0x4(%rbp),%eax
add    $0x3f79,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <yahoo_M1Common@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yahoo_f01_5a>:
imul   $0x41cd726f,%edi,%edi
add    $0x3f79,%edi
jmp    1030 <yahoo_M1Common@plt>

LLVM IR (-O0):
define i32 @yahoo_f01_5a(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = mul nsw i32 %6, 1103983215
%8 = add nsw i32 %7, 16249
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = call i32 @yahoo_M1Common(i32 %9, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @yahoo_f01_5a(i32 %0, i32 %1) {
%3 = mul nsw i32 %0, 1103983215
%4 = add nsw i32 %3, 16249
%5 = tail call i32 @yahoo_M1Common(i32 %4, i32 %1)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hello world!\n");
  printf("Hi!\n");
  printf("Teams\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"Hello world!\0A\00"
@.str.1 = [5 x i8] c"Hi!\0A\00"
@.str.2 = [7 x i8] c"Teams\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"Hello world!\00"
@str.3 = [4 x i8] c"Hi!\00"
@str.4 = [6 x i8] c"Teams\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.4, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int InitialisationAvecService(char *);
int Initialisation() { return InitialisationAvecService("12321"); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"12321\00"
define i32 @Initialisation() {
%1 = tail call i32 @InitialisationAvecService(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
double invsqrt_d(double x) {
  int64_t i;
  double xhalf = x * .5;
  i = *(int64_t *)&x;
  i = 0x5fe6eb50c7b537a9LL - (i >> 1);
  x = *(double *)&i;
  x = x * (1.5 - (xhalf * x * x));
  return x;
}


x86 assembly (clang, -O0):
<invsqrt_d>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x1,%eax
movslq %eax,%rcx
movabs $0x5fe6eb50c7b537a9,%rax
eb e6 5f
sub    %rcx,%rax
mov    %eax,-0xc(%rbp)
movsd  -0xc(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe85(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<invsqrt_d>:
movq   %xmm0,%rax
sar    %eax
mov    $0xc7b537a9,%ecx
sub    %eax,%ecx
mov    %ecx,-0x8(%rsp)
movsd  -0x8(%rsp),%xmm1
mulsd  0xee0(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  0xed8(%rip),%xmm0
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @invsqrt_d(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = fmul double %5, 5.000000e-01
store double %6, double* %4
%7 = bitcast double* %2 to i32*
%8 = load i32, i32* %7
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = ashr i32 %9, 1
%11 = sext i32 %10 to i64
%12 = sub nsw i64 6910469410427058089, %11
%13 = trunc i64 %12 to i32
store i32 %13, i32* %3
%14 = bitcast i32* %3 to double*
%15 = load double, double* %14
store double %15, double* %2
%16 = load double, double* %2
%17 = load double, double* %4
%18 = load double, double* %2
%19 = fmul double %17, %18
%20 = load double, double* %2
%21 = fneg double %19
%22 = call double @llvm.fmuladd.f64(double %21, double %20, double 1.500000e+00)
%23 = fmul double %16, %22
store double %23, double* %2
%24 = load double, double* %2
ret double %24
}

LLVM IR (-O2):
define double @invsqrt_d(double %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = bitcast double %0 to i64
%5 = trunc i64 %4 to i32
%6 = ashr i32 %5, 1
%7 = sub nsw i32 -944425047, %6
store i32 %7, i32* %2
%8 = bitcast i32* %2 to double*
%9 = load double, double* %8
%10 = fmul double %0, -5.000000e-01
%11 = fmul double %10, %9
%12 = tail call double @llvm.fmuladd.f64(double %11, double %9, double 1.500000e+00)
%13 = fmul double %9, %12
ret double %13
}
int get_max_id(int num_seq[5]) {
  int max = num_seq[0];
  int max_id = 0;
  for (int i = 1; i < 5; i++) {
    if (num_seq[i] > max) {
      max = num_seq[i];
      max_id = i;
    }
  }
  return (max_id);
}


x86 assembly (clang, -O0):
<get_max_id>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    1164 <get_max_id+0x64>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0xc(%rbp),%eax
jle    1151 <get_max_id+0x51>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1156 <get_max_id+0x56>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111f <get_max_id+0x1f>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_max_id>:
mov    (%rdi),%eax
mov    0x4(%rdi),%ecx
xor    %edx,%edx
cmp    %eax,%ecx
setg   %dl
cmovg  %ecx,%eax
mov    0x8(%rdi),%ecx
cmp    %eax,%ecx
cmovg  %ecx,%eax
mov    $0x2,%ecx
cmovle %edx,%ecx
mov    0xc(%rdi),%edx
cmp    %eax,%edx
cmovg  %edx,%eax
mov    $0x3,%edx
cmovle %ecx,%edx
cmp    %eax,0x10(%rdi)
mov    $0x4,%eax
cmovle %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @get_max_id(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, %2
%6 = select i1 %5, i32 %4, i32 %2
%7 = zext i1 %5 to i32
%8 = getelementptr inbounds i32, i32* %0, i64 2
%9 = load i32, i32* %8
%10 = icmp sgt i32 %9, %6
%11 = select i1 %10, i32 %9, i32 %6
%12 = select i1 %10, i32 2, i32 %7
%13 = getelementptr inbounds i32, i32* %0, i64 3
%14 = load i32, i32* %13
%15 = icmp sgt i32 %14, %11
%16 = select i1 %15, i32 %14, i32 %11
%17 = select i1 %15, i32 3, i32 %12
%18 = getelementptr inbounds i32, i32* %0, i64 4
%19 = load i32, i32* %18
%20 = icmp sgt i32 %19, %16
%21 = select i1 %20, i32 4, i32 %17
ret i32 %21
}
/* Type definitions */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int16_t le16_to_cpu(int16_t x) { return (x); }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
double ftell(int /*<<< orphan*/ *);
double find_file_size(char *filename) {
  FILE *fd;
  double found_size = 0;
  fd = fopen(filename, "r");
  fseek(fd, 0L, SEEK_END);
  found_size = ftell(fd);
  fclose(fd);
  return found_size;
}


x86 assembly (clang, -O0):
<find_file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e75(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1050 <fseek@plt>
mov    -0x10(%rbp),%rdi
call   1040 <ftell@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_file_size>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    0x2e8d(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <fseek@plt>
mov    %rbx,%rdi
call   1040 <ftell@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <fclose@plt>
movsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@SEEK_END = global i32 0
define double @find_file_size(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca double
store i8* %0, i8** %2
store double 0.000000e+00, double* %4
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = load i32, i32* @SEEK_END
%9 = call i32 @fseek(i32* %7, i64 0, i32 %8)
%10 = load i32*, i32** %3
%11 = call double @ftell(i32* %10)
store double %11, double* %4
%12 = load i32*, i32** %3
%13 = call i32 @fclose(i32* %12)
%14 = load double, double* %4
ret double %14
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@SEEK_END = global i32 0
define double @find_file_size(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @SEEK_END
%4 = tail call i32 @fseek(i32* %2, i64 0, i32 %3)
%5 = tail call double @ftell(i32* %2)
%6 = tail call i32 @fclose(i32* %2)
ret double %5
}
extern unsigned char ReturnUint8() { return 0xFE; }


x86 assembly (clang, -O0):
<ReturnUint8>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfe,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReturnUint8>:
mov    $0xfe,%al
ret

LLVM IR (-O0):
define zeroext i8 @ReturnUint8() {
ret i8 -2
}

LLVM IR (-O2):
define zeroext i8 @ReturnUint8() {
ret i8 -2
}
/* Variables and functions */
long atol(char *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
long choice() {
  char buffer[64];
  fflush(stdout);
  fgets(buffer, 128, stdin);
  return atol(buffer);
}


x86 assembly (clang, -O0):
<choice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
lea    -0x40(%rbp),%rdi
mov    0x2e97(%rip),%rax
mov    (%rax),%edx
mov    $0x80,%esi
call   1030 <fgets@plt>
lea    -0x40(%rbp),%rdi
call   1050 <atol@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<choice>:
push   %rbx
sub    $0x40,%rsp
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    0x2e9e(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x80,%esi
call   1030 <fgets@plt>
mov    %rbx,%rdi
call   1050 <atol@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
@stdin = global i32 0
define i64 @choice() {
%1 = alloca [64 x i8]
%2 = load i32, i32* @stdout
%3 = call i32 @fflush(i32 %2)
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 128, i32 %5)
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%8 = call i64 @atol(i8* %7)
ret i64 %8
}

LLVM IR (-O2):
@stdout = global i32 0
@stdin = global i32 0
define i64 @choice() {
%1 = alloca [64 x i8]
%2 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %2, i32 128, i32 %5)
%7 = call i64 @atol(i8* %2)
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int /*<<< orphan*/ sys_write(int, char const *, int /*<<< orphan*/);
void fprints(int fd, const char *str) {
  if (str == 0)
    return;
  sys_write(fd, str, strlen(str));
}


x86 assembly (clang, -O0):
<fprints>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    113f <fprints+0x1f>
jmp    1164 <fprints+0x44>
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1040 <sys_write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprints>:
test   %rsi,%rsi
je     1147 <fprints+0x27>
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <sys_write@plt>
ret

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

LLVM IR (-O2):
define void @fprints(i32 %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @strlen(i8* %1)
%6 = tail call i32 @sys_write(i32 %0, i8* %1, i32 %5)
br label %7
7: ; preds = %2, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ errx(int, char *);
void *malloc(size_t);
void *domalloc(size_t len) {
  void *x;
  x = malloc(len);
  if (x == NULL) {
    errx(3, "Out of memory");
  }
  return x;
}


x86 assembly (clang, -O0):
<domalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1155 <domalloc+0x35>
mov    $0x3,%edi
lea    0xeb0(%rip),%rsi
call   1030 <errx@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<domalloc>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113f <domalloc+0x1f>
lea    0xecb(%rip),%rsi
mov    $0x3,%edi
call   1030 <errx@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Out of memory\00"
define i8* @domalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @errx(i32 3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [14 x i8] c"Out of memory\00"
define noalias i8* @domalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @errx(i32 3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Type definitions */
typedef int u_int8_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int *);
unsigned little_endian_8(u_int8_t *buffer) {
  assert(buffer);
  return *buffer;
}


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

x86 assembly (clang, -O2):
<little_endian_8>:
push   %rbx
mov    %rdi,%rbx
call   1030 <assert@plt>
mov    (%rbx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @little_endian_8(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @assert(i32* %3)
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @little_endian_8(i32* %0) {
%2 = tail call i32 @assert(i32* %0)
%3 = load i32, i32* %0
ret i32 %3
}
long mult2(long a, long b) {
  long s = a * b;
  return s;
}


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

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

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

LLVM IR (-O2):
define i64 @mult2(i64 %0, i64 %1) {
%3 = mul nsw i64 %1, %0
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_socket_server_new_ipv6_loopback() {
  printf("NOT IMPLEMENTED:"
         "pa_socket_server_new_ipv6_loopback"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [52 x i8] c"NOT IMPLEMENTED:pa_socket_server_new_ipv6_loopback\0A\00"
define i32 @pa_socket_server_new_ipv6_loopback() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [51 x i8] c"NOT IMPLEMENTED:pa_socket_server_new_ipv6_loopback\00"
define i32 @pa_socket_server_new_ipv6_loopback() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int IFF_NO_PI;
int no_pi() { return IFF_NO_PI; }


x86 assembly (clang, -O0):
<no_pi>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<no_pi>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@IFF_NO_PI = global i32 0
define i32 @no_pi() {
%1 = load i32, i32* @IFF_NO_PI
ret i32 %1
}

LLVM IR (-O2):
@IFF_NO_PI = global i32 0
define i32 @no_pi() {
%1 = load i32, i32* @IFF_NO_PI
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ fscanf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stdin;
scalar_t__ valid_serial(char *);
int validate_serial() {
  char serial[24];
  fscanf(stdin, "%s", serial);
  if (valid_serial(serial)) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<validate_serial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rdx
lea    0xec4(%rip),%rsi
call   1030 <fscanf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <valid_serial@plt>
cmp    $0x0,%rax
je     1160 <validate_serial+0x40>
movl   $0x1,-0x4(%rbp)
jmp    1167 <validate_serial+0x47>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_serial>:
push   %rbx
sub    $0x20,%rsp
mov    0x2ebc(%rip),%rax
mov    (%rax),%edi
lea    0xecb(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdx
call   1030 <fscanf@plt>
mov    %rbx,%rdi
call   1040 <valid_serial@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @validate_serial() {
%1 = alloca i32
%2 = alloca [24 x i8]
%3 = load i32, i32* @stdin
%4 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%5 = call i32 @fscanf(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%7 = call i64 @valid_serial(i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %0
store i32 1, i32* %1
br label %11
10: ; preds = %0
store i32 0, i32* %1
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @validate_serial() {
%1 = alloca [24 x i8]
%2 = getelementptr inbounds [24 x i8], [24 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fscanf(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = call i64 @valid_serial(i8* %2)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
void test___atomic_or_fetch_0(char *mem) { __atomic_or_fetch(mem, 1, 4); }


x86 assembly (clang, -O0):
<test___atomic_or_fetch_0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movb   $0x1,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    %cl,-0xc(%rbp)
mov    (%rax),%al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%al
mov    -0x18(%rbp),%rcx
mov    -0xc(%rbp),%sil
mov    %al,%dl
or     %sil,%dl
lock cmpxchg %dl,(%rcx)
sete   %cl
mov    %al,-0x19(%rbp)
test   $0x1,%cl
mov    %al,-0xb(%rbp)
jne    114a <test___atomic_or_fetch_0+0x4a>
jmp    111f <test___atomic_or_fetch_0+0x1f>
mov    -0xc(%rbp),%cl
mov    -0x19(%rbp),%al
or     %cl,%al
mov    %al,-0xa(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test___atomic_or_fetch_0>:
lock orb $0x1,(%rdi)
ret

LLVM IR (-O0):
define void @test___atomic_or_fetch_0(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i8
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8 1, i8* %3
%6 = load i8, i8* %3
%7 = atomicrmw or i8* %5, i8 %6 acq_rel
%8 = or i8 %7, %6
store i8 %8, i8* %4
%9 = load i8, i8* %4
ret void
}

LLVM IR (-O2):
define void @test___atomic_or_fetch_0(i8* nocapture %0) {
%2 = atomicrmw or i8* %0, i8 1 acq_rel
ret void
}
/* Variables and functions */
int sched_yield();
__attribute__((weak)) int __real_sched_yield(void) { return sched_yield(); }


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

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

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

LLVM IR (-O2):
define weak i32 @__real_sched_yield() {
%1 = tail call i32 (...) @sched_yield()
ret i32 %1
}
/* Variables and functions */
int IsOdd(unsigned int);
int /*<<< orphan*/ printf(char *, ...);
bool IsEven(unsigned int n) {
  if (n == 0) {
    printf("if (n == 0)\n");
    return true;
  } else {
    printf("IsOdd(%d)\n", (n - 1));
    return IsOdd(n - 1);
  }
}


x86 assembly (clang, -O0):
<IsEven>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    114f <IsEven+0x2f>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1171 <IsEven+0x51>
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1040 <IsOdd@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsEven>:
push   %rbx
test   %edi,%edi
je     1152 <IsEven+0x22>
mov    %edi,%ebx
add    $0xffffffff,%ebx
lea    0xebf(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1050 <IsOdd@plt>
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"if (n == 0)\0A\00"
@.str.1 = [11 x i8] c"IsOdd(%d)\0A\00"
define i32 @IsEven(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %2
br label %15
8: ; preds = %1
%9 = load i32, i32* %3
%10 = sub i32 %9, 1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %3
%13 = sub i32 %12, 1
%14 = call i32 @IsOdd(i32 %13)
store i32 %14, i32* %2
br label %15
15: ; preds = %8, %6
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@.str.1 = [11 x i8] c"IsOdd(%d)\0A\00"
@str = [12 x i8] c"if (n == 0)\00"
define i32 @IsEven(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
br label %9
5: ; preds = %1
%6 = add i32 %0, -1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = tail call i32 @IsOdd(i32 %6)
br label %9
9: ; preds = %5, %3
%10 = phi i32 [ 1, %3 ], [ %8, %5 ]
ret i32 %10
}
void strrev(char *str, char *end) {
  while (str < end) {
    char tmp = *str;
    *str = *end;
    *end = tmp;
    ++str;
    --end;
  }
}


x86 assembly (clang, -O0):
<strrev>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1155 <strrev+0x55>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <strrev+0xc>
pop    %rbp
ret

x86 assembly (clang, -O2):
<strrev>:
cmp    %rsi,%rdi
jae    112c <strrev+0x2c>
add    $0xffffffffffffffff,%rsi
nopl   0x0(%rax)
movzbl (%rdi),%eax
movzbl 0x1(%rsi),%ecx
mov    %cl,(%rdi)
mov    %al,0x1(%rsi)
add    $0x1,%rdi
lea    -0x1(%rsi),%rax
cmp    %rsi,%rdi
mov    %rax,%rsi
jb     1110 <strrev+0x10>
ret

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

LLVM IR (-O2):
define void @strrev(i8* %0, i8* %1) {
%3 = icmp ult i8* %0, %1
br i1 %3, label %4, label %12
4: ; preds = %2, %4
%5 = phi i8* [ %9, %4 ], [ %0, %2 ]
%6 = phi i8* [ %10, %4 ], [ %1, %2 ]
%7 = load i8, i8* %5
%8 = load i8, i8* %6
store i8 %8, i8* %5
store i8 %7, i8* %6
%9 = getelementptr inbounds i8, i8* %5, i64 1
%10 = getelementptr inbounds i8, i8* %6, i64 -1
%11 = icmp ult i8* %9, %10
br i1 %11, label %4, label %12
12: ; preds = %4, %2
ret void
}
/* Type definitions */
struct SocketBuffer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ buffWrite(double *, int, struct SocketBuffer *);
void writeDouble(double value, struct SocketBuffer *buff) {
  buffWrite(&value, sizeof(double), buff);
}


x86 assembly (clang, -O0):
<writeDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
lea    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1030 <buffWrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeDouble>:
push   %rax
mov    %rdi,%rdx
movsd  %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x8,%esi
call   1030 <buffWrite@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.SocketBuffer = type { i32 }
define void @writeDouble(double %0, %struct.SocketBuffer* %1) {
%3 = alloca double
%4 = alloca %struct.SocketBuffer*
store double %0, double* %3
store %struct.SocketBuffer* %1, %struct.SocketBuffer** %4
%5 = load %struct.SocketBuffer*, %struct.SocketBuffer** %4
%6 = call i32 @buffWrite(double* %3, i32 8, %struct.SocketBuffer* %5)
ret void
}

LLVM IR (-O2):
%struct.SocketBuffer = type { i32 }
define void @writeDouble(double %0, %struct.SocketBuffer* %1) {
%3 = alloca double
store double %0, double* %3
%4 = call i32 @buffWrite(double* %3, i32 8, %struct.SocketBuffer* %1)
ret void
}
void usage(s) char *s;
{
  printf(
      "Usage: %s [-r or -ns] [-b block-size] [-c cache-size] [-g gdbm-file]\n",
      s);
  exit(2);
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [70 x i8] c"Usage: %s [-r or -ns] [-b block-size] [-c cache-size] [-g gdbm-file]\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i8* %3)
unreachable
}

LLVM IR (-O2):
@.str = [70 x i8] c"Usage: %s [-r or -ns] [-b block-size] [-c cache-size] [-g gdbm-file]\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i8* %0)
tail call void @exit(i32 2)
unreachable
}
void foo023() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ get_RPM();
int /*<<< orphan*/ get_TPS();
int /*<<< orphan*/ get_alphaN_table(int /*<<< orphan*/, int /*<<< orphan*/);
double_t get_fuel_pw() { return get_alphaN_table(get_RPM(), get_TPS()); }


x86 assembly (clang, -O0):
<get_fuel_pw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <get_RPM@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <get_TPS@plt>
mov    -0x4(%rbp),%edi
mov    %eax,%esi
call   1050 <get_alphaN_table@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_fuel_pw>:
push   %rbx
xor    %eax,%eax
call   1030 <get_RPM@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <get_TPS@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1050 <get_alphaN_table@plt>

LLVM IR (-O0):
define i32 @get_fuel_pw() {
%1 = call i32 (...) @get_RPM()
%2 = call i32 (...) @get_TPS()
%3 = call i32 @get_alphaN_table(i32 %1, i32 %2)
ret i32 %3
}

LLVM IR (-O2):
define i32 @get_fuel_pw() {
%1 = tail call i32 (...) @get_RPM()
%2 = tail call i32 (...) @get_TPS()
%3 = tail call i32 @get_alphaN_table(i32 %1, i32 %2)
ret i32 %3
}
/* Variables and functions */
int ipc_connect(char *);
int vipc_connect() { return ipc_connect("/tmp/vision_socket"); }


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

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

LLVM IR (-O0):
@.str = [19 x i8] c"/tmp/vision_socket\00"
define i32 @vipc_connect() {
%1 = call i32 @ipc_connect(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [19 x i8] c"/tmp/vision_socket\00"
define i32 @vipc_connect() {
%1 = tail call i32 @ipc_connect(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
bool isLeftAssociative(char operator) {
  switch (operator) {
  case '+':
  case '-':
  case '*':
  case '/':
    return true;
  case '^':
    return false;
  }
}


x86 assembly (clang, -O0):
<isLeftAssociative>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffffd6,%eax
sub    $0x2,%eax
jb     1155 <isLeftAssociative+0x55>
jmp    1122 <isLeftAssociative+0x22>
mov    -0xc(%rbp),%eax
sub    $0x2d,%eax
je     1155 <isLeftAssociative+0x55>
jmp    1133 <isLeftAssociative+0x33>
mov    -0xc(%rbp),%eax
sub    $0x2f,%eax
je     1155 <isLeftAssociative+0x55>
jmp    1144 <isLeftAssociative+0x44>
mov    -0xc(%rbp),%eax
sub    $0x5e,%eax
je     1161 <isLeftAssociative+0x61>
jmp    1168 <isLeftAssociative+0x68>
movl   $0x1,-0x4(%rbp)
jmp    1168 <isLeftAssociative+0x68>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isLeftAssociative>:
xor    %eax,%eax
cmp    $0x5e,%dil
setne  %al
ret

LLVM IR (-O0):
define i32 @isLeftAssociative(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %8 [
i32 43, label %6
i32 45, label %6
i32 42, label %6
i32 47, label %6
i32 94, label %7
]
6: ; preds = %1, %1, %1, %1
store i32 1, i32* %2
br label %8
7: ; preds = %1
store i32 0, i32* %2
br label %8
8: ; preds = %6, %7, %1
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @isLeftAssociative(i8 signext %0) {
%2 = icmp ne i8 %0, 94
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int f(int);
main() {
  if (f(3) != 28)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3,%edi
call   1040 <f@plt>
cmp    $0x1c,%eax
je     1149 <main+0x29>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
call   1040 <f@plt>
cmp    $0x1c,%eax
jne    1134 <main+0x14>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @f(i32 3)
%3 = icmp ne i32 %2, 28
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 3)
%2 = icmp eq i32 %1, 28
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
scalar_t__ processString(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char string[1024];
  scanf("%[^\n]s", string);
  if (0 == processString(string)) {
    printf("\nSuccess!\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xeb0(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x410(%rbp),%rdi
call   1050 <processString@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    117b <main+0x4b>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
lea    0xec1(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1050 <processString@plt>
test   %rax,%rax
jne    1163 <main+0x33>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%[^\0A]s\00"
@.str.1 = [11 x i8] c"\0ASuccess!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%6 = call i64 @processString(i8* %5)
%7 = icmp eq i64 0, %6
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%[^\0A]s\00"
@str = [10 x i8] c"\0ASuccess!\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i64 @processString(i8* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
ret i32 0
}