xunge/DecIR huggingface dataset:
void calc_tempo(int segs, int *ps, int *pm, int *ph) {
  *ph = segs / 3600;
  *pm = (segs - (*ph * 3600)) / 60;
  *ps = segs - (*ph * 3600) - (*pm * 60);
}


x86 assembly (clang, -O0):
<calc_tempo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
mov    -0x20(%rbp),%rcx
imul   $0xe10,(%rcx),%ecx
sub    %ecx,%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
mov    -0x20(%rbp),%rax
imul   $0xe10,(%rax),%eax
sub    %eax,%ecx
mov    -0x18(%rbp),%rax
imul   $0x3c,(%rax),%eax
sub    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_tempo>:
movslq %edi,%r8
imul   $0xffffffff91a2b3c5,%r8,%rdi
shr    $0x20,%rdi
add    %r8d,%edi
mov    %edi,%eax
shr    $0x1f,%eax
sar    $0xb,%edi
add    %eax,%edi
mov    %edi,(%rcx)
imul   $0xfffff1f0,%edi,%eax
add    %r8d,%eax
cltq
imul   $0xffffffff88888889,%rax,%rdi
shr    $0x20,%rdi
add    %edi,%eax
mov    %eax,%edi
shr    $0x1f,%edi
sar    $0x5,%eax
add    %edi,%eax
mov    %eax,(%rdx)
imul   $0xfffff1f0,(%rcx),%ecx
imul   $0xffffffc4,%eax,%eax
add    %r8d,%eax
add    %ecx,%eax
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define void @calc_tempo(i32 %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i32, i32* %5
%10 = sdiv i32 %9, 3600
%11 = load i32*, i32** %8
store i32 %10, i32* %11
%12 = load i32, i32* %5
%13 = load i32*, i32** %8
%14 = load i32, i32* %13
%15 = mul nsw i32 %14, 3600
%16 = sub nsw i32 %12, %15
%17 = sdiv i32 %16, 60
%18 = load i32*, i32** %7
store i32 %17, i32* %18
%19 = load i32, i32* %5
%20 = load i32*, i32** %8
%21 = load i32, i32* %20
%22 = mul nsw i32 %21, 3600
%23 = sub nsw i32 %19, %22
%24 = load i32*, i32** %7
%25 = load i32, i32* %24
%26 = mul nsw i32 %25, 60
%27 = sub nsw i32 %23, %26
%28 = load i32*, i32** %6
store i32 %27, i32* %28
ret void
}

LLVM IR (-O2):
define void @calc_tempo(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture %3) {
%5 = sdiv i32 %0, 3600
store i32 %5, i32* %3
%6 = mul nsw i32 %5, -3600
%7 = add i32 %6, %0
%8 = sdiv i32 %7, 60
store i32 %8, i32* %2
%9 = load i32, i32* %3
%10 = mul i32 %9, -3600
%11 = mul nsw i32 %8, -60
%12 = add i32 %11, %0
%13 = add i32 %12, %10
store i32 %13, i32* %1
ret void
}
void ASN1_STRING_print(void) {}


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

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

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

LLVM IR (-O2):
define void @ASN1_STRING_print() {
ret void
}
int is_sorted(int array[], int length) {
  int i;
  for (i = 0; i < length - 1; ++i) {
    if (array[i] > array[i + 1]) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_sorted>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1163 <is_sorted+0x63>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jle    1150 <is_sorted+0x50>
movl   $0x0,-0x4(%rbp)
jmp    116a <is_sorted+0x6a>
jmp    1155 <is_sorted+0x55>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <is_sorted+0x12>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_sorted>:
add    $0xffffffff,%esi
xor    %eax,%eax
test   %esi,%esi
cmovle %eax,%esi
nopw   0x0(%rax,%rax,1)
cmp    %rax,%rsi
je     1128 <is_sorted+0x28>
mov    (%rdi,%rax,4),%ecx
lea    0x1(%rax),%rdx
cmp    0x4(%rdi,%rax,4),%ecx
mov    %rdx,%rax
jle    1110 <is_sorted+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @is_sorted(i32* nocapture %0, i32 %1) {
%3 = add i32 %1, -1
%4 = call i32 @llvm.smax.i32(i32 %3, i32 0)
%5 = zext i32 %4 to i64
br label %6
6: ; preds = %9, %2
%7 = phi i64 [ %12, %9 ], [ 0, %2 ]
%8 = icmp eq i64 %7, %5
br i1 %8, label %16, label %9
9: ; preds = %6
%10 = getelementptr inbounds i32, i32* %0, i64 %7
%11 = load i32, i32* %10
%12 = add nuw nsw i64 %7, 1
%13 = getelementptr inbounds i32, i32* %0, i64 %12
%14 = load i32, i32* %13
%15 = icmp sgt i32 %11, %14
br i1 %15, label %16, label %6
16: ; preds = %6, %9
%17 = phi i32 [ 0, %9 ], [ 1, %6 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
void strcat(char *s, char *t) {
  while (*s) {
    ++s;
  }
  strcpy(s, t);
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     113e <strcat+0x2e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1120 <strcat+0x10>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat>:
add    $0xffffffffffffffff,%rdi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpb   $0x0,0x1(%rdi)
lea    0x1(%rdi),%rdi
jne    1120 <strcat+0x10>
jmp    1030 <strcpy@plt>

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

LLVM IR (-O2):
define void @strcat(i8* %0, i8* %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3
%9 = tail call i32 @strcpy(i8* %4, i8* %1)
ret void
}
int main(int argc, const char *argv[]) {
  int i;
  double fact[6];
  fact[0] = 1.0;
  for (i = 1; i < 6; ++i) {
    fact[i] = fact[i - 1] * i;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xee6(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x6,-0x14(%rbp)
jge    115f <main+0x5f>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0x50(%rbp,%rax,8),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movslq -0x14(%rbp),%rax
movsd  %xmm0,-0x50(%rbp,%rax,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <main+0x26>
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**
%6 = alloca i32
%7 = alloca [6 x double]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = getelementptr inbounds [6 x double], [6 x double]* %7, i64 0, i64 0
store double 1.000000e+00, double* %8
store i32 1, i32* %6
br label %9
9: ; preds = %24, %2
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 6
br i1 %11, label %12, label %27
12: ; preds = %9
%13 = load i32, i32* %6
%14 = sub nsw i32 %13, 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [6 x double], [6 x double]* %7, i64 0, i64 %15
%17 = load double, double* %16
%18 = load i32, i32* %6
%19 = sitofp i32 %18 to double
%20 = fmul double %17, %19
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [6 x double], [6 x double]* %7, i64 0, i64 %22
store double %20, double* %23
br label %24
24: ; preds = %12
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %9
27: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
int str_partition() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @str_partition() {
ret i32 0
}
/* Variables and functions */
double sqrt(double const);
double vector_magnitude_3d(const double v[3]) {
  return sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
}


x86 assembly (clang, -O0):
<vector_magnitude_3d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector_magnitude_3d>:
movsd  (%rdi),%xmm1
movsd  0x8(%rdi),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1141 <vector_magnitude_3d+0x31>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @vector_magnitude_3d(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
%5 = load double, double* %4
%6 = load double*, double** %2
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = load double*, double** %2
%10 = getelementptr inbounds double, double* %9, i64 1
%11 = load double, double* %10
%12 = load double*, double** %2
%13 = getelementptr inbounds double, double* %12, i64 1
%14 = load double, double* %13
%15 = fmul double %11, %14
%16 = call double @llvm.fmuladd.f64(double %5, double %8, double %15)
%17 = load double*, double** %2
%18 = getelementptr inbounds double, double* %17, i64 2
%19 = load double, double* %18
%20 = load double*, double** %2
%21 = getelementptr inbounds double, double* %20, i64 2
%22 = load double, double* %21
%23 = call double @llvm.fmuladd.f64(double %19, double %22, double %16)
%24 = call double @sqrt(double %23)
ret double %24
}

LLVM IR (-O2):
define double @vector_magnitude_3d(double* nocapture %0) {
%2 = load double, double* %0
%3 = getelementptr inbounds double, double* %0, i64 1
%4 = load double, double* %3
%5 = fmul double %4, %4
%6 = tail call double @llvm.fmuladd.f64(double %2, double %2, double %5)
%7 = getelementptr inbounds double, double* %0, i64 2
%8 = load double, double* %7
%9 = tail call double @llvm.fmuladd.f64(double %8, double %8, double %6)
%10 = tail call double @sqrt(double %9)
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ string_move(char *);
void main() {
  char str[] = "*abcnd* adfadf* dd****adf";
  printf("%s\n", str);
  string_move(str);
  printf("%s\n", str);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%ax
mov    %ax,-0x8(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <string_move@plt>
lea    -0x20(%rbp),%rsi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movups 0xedc(%rip),%xmm0
movups %xmm0,0xa(%rsp)
movaps 0xec6(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xed5(%rip),%r14
mov    %rsp,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <string_move@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.str = [26 x i8] c"*abcnd* adfadf* dd****adf\00"
@.str = [4 x i8] c"%s\0A\00"
define void @main() {
%1 = alloca [26 x i8]
%2 = bitcast [26 x i8]* %1 to i8*
%3 = getelementptr inbounds [26 x i8], [26 x i8]* %1, i64 0, i64 0
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [26 x i8], [26 x i8]* %1, i64 0, i64 0
%6 = call i32 @string_move(i8* %5)
%7 = getelementptr inbounds [26 x i8], [26 x i8]* %1, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
ret void
}

LLVM IR (-O2):
@__const.main.str = [26 x i8] c"*abcnd* adfadf* dd****adf\00"
@.str = [4 x i8] c"%s\0A\00"
define void @main() {
%1 = alloca [26 x i8]
%2 = getelementptr inbounds [26 x i8], [26 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @string_move(i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
typedef int /*<<< orphan*/ now;

/* Variables and functions */
unsigned int UCHAR_MAX;
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
unsigned int time_seed() {
  time_t now = time(NULL);
  unsigned char *p = (unsigned char *)(&now);
  unsigned seed = 0;
  size_t i;
  for (i = 0; i < sizeof(now); i++) {
    seed = seed * (UCHAR_MAX + 2U) + p[i];
  }
  return seed;
}


x86 assembly (clang, -O0):
<time_seed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x4,-0x20(%rbp)
jae    117a <time_seed+0x6a>
mov    -0x14(%rbp),%eax
mov    0x2ea0(%rip),%rcx
mov    (%rcx),%ecx
add    $0x2,%ecx
imul   %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    113b <time_seed+0x2b>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_seed>:
push   %rax
xor    %edi,%edi
call   1030 <time@plt>
mov    %eax,%ecx
movzbl %al,%edx
movzbl %ah,%esi
shr    $0x10,%eax
shr    $0x18,%ecx
mov    0x2ec3(%rip),%rdi
mov    (%rdi),%edi
add    $0x2,%edi
imul   %edi,%edx
add    %edx,%esi
imul   %edi,%esi
movzbl %al,%eax
add    %esi,%eax
imul   %edi,%eax
add    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@UCHAR_MAX = global i32 0
define i32 @time_seed() {
%1 = tail call i32 @time(i32* null)
%2 = lshr i32 %1, 8
%3 = lshr i32 %1, 16
%4 = lshr i32 %1, 24
%5 = load i32, i32* @UCHAR_MAX
%6 = add i32 %5, 2
%7 = and i32 %1, 255
%8 = mul i32 %6, %7
%9 = and i32 %2, 255
%10 = add i32 %8, %9
%11 = mul i32 %6, %10
%12 = and i32 %3, 255
%13 = add i32 %11, %12
%14 = mul i32 %6, %13
%15 = add i32 %14, %4
ret i32 %15
}
char *langRomTypeFmpak() { return "FMPAK"; }


x86 assembly (clang, -O0):
<langRomTypeFmpak>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<langRomTypeFmpak>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"FMPAK\00"
define i8* @langRomTypeFmpak() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"FMPAK\00"
define i8* @langRomTypeFmpak() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
long long calc_blsi_u64(long long src1, long long src2) {
  return (-src1) & (src2);
}


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

x86 assembly (clang, -O2):
<calc_blsi_u64>:
mov    %rdi,%rax
neg    %rax
and    %rsi,%rax
ret

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

LLVM IR (-O2):
define i64 @calc_blsi_u64(i64 %0, i64 %1) {
%3 = sub nsw i64 0, %0
%4 = and i64 %3, %1
ret i64 %4
}
void sync_before_release(void) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ fwrite(void *, int, size_t, int /*<<< orphan*/ *);
void writecb(void *data, size_t data_len, void *arg) {
  FILE *file = (FILE *)arg;
  fwrite(data, 1, data_len, file);
}


x86 assembly (clang, -O0):
<writecb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fwrite@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writecb>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    $0x1,%esi
jmp    1030 <fwrite@plt>

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

LLVM IR (-O2):
define void @writecb(i8* nocapture %0, i64 %1, i8* nocapture %2) {
%4 = bitcast i8* %2 to i32*
%5 = tail call i32 @fwrite(i8* %0, i32 1, i64 %1, i32* %4)
ret void
}
/* Variables and functions */
char *ckmalloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *savestr(char *s) {
  char *p;
  p = ckmalloc(strlen(s) + 1);
  strcpy(p, s);
  return p;
}


x86 assembly (clang, -O0):
<savestr>:
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   1050 <ckmalloc@plt>
mov    %rax,-0x10(%rbp)
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):
<savestr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <ckmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @savestr(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* @ckmalloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %2
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @savestr(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @ckmalloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Variables and functions */
char *appaserver_error_get_filename(char *);
char *appaserver_get_error_filename(char *application_name) {
  return appaserver_error_get_filename(application_name);
}


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

x86 assembly (clang, -O2):
<appaserver_get_error_filename>:
jmp    1030 <appaserver_error_get_filename@plt>

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

LLVM IR (-O2):
define i8* @appaserver_get_error_filename(i8* %0) {
%2 = tail call i8* @appaserver_error_get_filename(i8* %0)
ret i8* %2
}
unsigned int __attribute__((no)) test(int shift_size) {
  unsigned long long res = ~0;
  return res << shift_size;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movq   $0xffffffffffffffff,-0x10(%rbp)
ff
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    %cl,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
mov    %edi,%ecx
mov    $0xffffffffffffffff,%rax
shl    %cl,%rax
ret

LLVM IR (-O0):
define i32 @test(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
store i64 -1, i64* %3
%4 = load i64, i64* %3
%5 = load i32, i32* %2
%6 = zext i32 %5 to i64
%7 = shl i64 %4, %6
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @test(i32 %0) {
%2 = zext i32 %0 to i64
%3 = shl nsw i64 -1, %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Com_DPrintf(char *, size_t);
void *malloc(size_t);
void *Memory_malloc(size_t size) {
  void *ptr;
  ptr = malloc(size);
  if (ptr != ((void *)0)) {
    return ptr;
  }
  Com_DPrintf("[Memory_malloc]: Could not allocate %d bytes\n", size);
  return ((void *)0);
}


x86 assembly (clang, -O0):
<Memory_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1151 <Memory_malloc+0x31>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1169 <Memory_malloc+0x49>
mov    -0x10(%rbp),%rsi
lea    0xea4(%rip),%rdi
call   1040 <Com_DPrintf@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Memory_malloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <Memory_malloc+0x23>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
call   1040 <Com_DPrintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [46 x i8] c"[Memory_malloc]: Could not allocate %d bytes\0A\00"
define i8* @Memory_malloc(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %3
%5 = load i64, i64* %3
%6 = call i8* @malloc(i64 %5)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i8*, i8** %4
store i8* %10, i8** %2
br label %14
11: ; preds = %1
%12 = load i64, i64* %3
%13 = call i32 @Com_DPrintf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i64 %12)
store i8* null, i8** %2
br label %14
14: ; preds = %11, %9
%15 = load i8*, i8** %2
ret i8* %15
}

LLVM IR (-O2):
@.str = [46 x i8] c"[Memory_malloc]: Could not allocate %d bytes\0A\00"
define noalias i8* @Memory_malloc(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 @Com_DPrintf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i64 %0)
br label %6
6: ; preds = %1, %4
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ test_cascade3();
int main(int argc, char *argv[]) { test_cascade3(); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_cascade3@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test_cascade3()
ret i32 0
}
char *strchr(const char *p, int ch) {
  for (;; ++p) {
    if (*p == ch)
      return ((char *)p);
    if (!*p)
      return ((char *)0);
  }
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    1128 <strchr+0x28>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1158 <strchr+0x58>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1142 <strchr+0x42>
movq   $0x0,-0x8(%rbp)
jmp    1158 <strchr+0x58>
jmp    1147 <strchr+0x47>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110b <strchr+0xb>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
movsbl (%rdi),%ecx
cmp    %esi,%ecx
je     1120 <strchr+0x20>
nopw   0x0(%rax,%rax,1)
test   %cl,%cl
je     1121 <strchr+0x21>
movsbl 0x1(%rax),%ecx
add    $0x1,%rax
cmp    %esi,%ecx
jne    1110 <strchr+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, %1
br i1 %5, label %15, label %6
6: ; preds = %2, %10
%7 = phi i8 [ %12, %10 ], [ %3, %2 ]
%8 = phi i8* [ %11, %10 ], [ %0, %2 ]
%9 = icmp eq i8 %7, 0
br i1 %9, label %15, label %10
10: ; preds = %6
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, %1
br i1 %14, label %15, label %6
15: ; preds = %10, %6, %2
%16 = phi i8* [ %0, %2 ], [ null, %6 ], [ %11, %10 ]
ret i8* %16
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ warning_util(char *);
void *free_util(void *ptr) {
  if (ptr == NULL)
    warning_util("Call to free_util with null pointer");
  else {
    free(ptr);
    ptr = NULL;
  }
  return ptr;
}


x86 assembly (clang, -O0):
<free_util>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <free_util+0x28>
lea    0xec2(%rip),%rdi
call   1040 <warning_util@plt>
jmp    1159 <free_util+0x39>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_util>:
push   %rax
test   %rdi,%rdi
je     112d <free_util+0xd>
call   1030 <free@plt>
jmp    1139 <free_util+0x19>
lea    0xecc(%rip),%rdi
call   1040 <warning_util@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Call to free_util with null pointer\00"
define i8* @free_util(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 @warning_util(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %10
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i32 @free(i8* %8)
store i8* null, i8** %2
br label %10
10: ; preds = %7, %5
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
@.str = [36 x i8] c"Call to free_util with null pointer\00"
define noalias i8* @free_util(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @warning_util(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %7
5: ; preds = %1
%6 = tail call i32 @free(i8* %0)
br label %7
7: ; preds = %5, %3
ret i8* null
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ test1();
int /*<<< orphan*/ test2();
int /*<<< orphan*/ test3();
int /*<<< orphan*/ test4();
int main(int argc, const char *argv[]) {
  test1();
  test2();
  test3();
  test4();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <test1@plt>
mov    $0x0,%al
call   1060 <test2@plt>
mov    $0x0,%al
call   1030 <test3@plt>
mov    $0x0,%al
call   1050 <test4@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <test1@plt>
xor    %eax,%eax
call   1060 <test2@plt>
xor    %eax,%eax
call   1030 <test3@plt>
xor    %eax,%eax
call   1050 <test4@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @test1()
%7 = call i32 (...) @test2()
%8 = call i32 (...) @test3()
%9 = call i32 (...) @test4()
%10 = load i32, i32* @EXIT_SUCCESS
ret i32 %10
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test1()
%4 = tail call i32 (...) @test2()
%5 = tail call i32 (...) @test3()
%6 = tail call i32 (...) @test4()
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}
int foo(int i, int j, struct Mutex *mu) {
  int *q;
  int t = *q;
  *q = 4;
  return t;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x4,(%rax)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
%struct.Mutex = type opaque
define i32 @foo(i32 %0, i32 %1, %struct.Mutex* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.Mutex*
%7 = alloca i32*
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store %struct.Mutex* %2, %struct.Mutex** %6
%9 = load i32*, i32** %7
%10 = load i32, i32* %9
store i32 %10, i32* %8
%11 = load i32*, i32** %7
store i32 4, i32* %11
%12 = load i32, i32* %8
ret i32 %12
}

LLVM IR (-O2):
unsigned int str_hash(const void *s) {
  const char *str = (const char *)s;
  unsigned int hash = 0;
  int c;
  while ((c = *str++))
    hash = c + (hash << 6) + (hash << 16) - hash;
  return hash;
}


x86 assembly (clang, -O0):
<str_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
je     1153 <str_hash+0x53>
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
shl    $0x6,%ecx
add    %ecx,%eax
mov    -0x14(%rbp),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1117 <str_hash+0x17>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1127 <str_hash+0x27>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
imul   $0x1003f,%eax,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <str_hash+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @str_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %9, %4 ], [ %0, %1 ]
%7 = phi i32 [ %11, %4 ], [ 0, %1 ]
%8 = sext i8 %5 to i32
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = mul i32 %7, 65599
%11 = add i32 %10, %8
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 0, %1 ], [ %11, %4 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("Usage: ./a.out group_addr group_port\n");
  exit(errno);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"Usage: ./a.out group_addr group_port\0A\00"
@errno = global i32 0
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @errno
%3 = call i32 @exit(i32 %2)
unreachable
}

LLVM IR (-O2):
@errno = global i32 0
@str = [37 x i8] c"Usage: ./a.out group_addr group_port\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @errno
%3 = tail call i32 @exit(i32 %2)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ foo_unlock();
void fn2(int i) {
  foo_unlock();
  i++;
}


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

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

LLVM IR (-O0):
define void @fn2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @foo_unlock()
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
store i32 %5, i32* %2
ret void
}

LLVM IR (-O2):
define void @fn2(i32 %0) {
%2 = tail call i32 (...) @foo_unlock()
ret void
}
int Q_isalpha(int c) {
  if (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'))) {
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<Q_isalpha>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x61,-0x8(%rbp)
jl     111b <Q_isalpha+0x1b>
cmpl   $0x7a,-0x8(%rbp)
jle    112f <Q_isalpha+0x2f>
cmpl   $0x41,-0x8(%rbp)
jl     113b <Q_isalpha+0x3b>
cmpl   $0x5a,-0x8(%rbp)
jg     113b <Q_isalpha+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1142 <Q_isalpha+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q_isalpha>:
and    $0xffffffdf,%edi
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @Q_isalpha(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 97
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 122
br i1 %8, label %15, label %9
9: ; preds = %6, %1
%10 = load i32, i32* %3
%11 = icmp sge i32 %10, 65
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i32, i32* %3
%14 = icmp sle i32 %13, 90
br i1 %14, label %15, label %16
15: ; preds = %12, %6
store i32 1, i32* %2
br label %17
16: ; preds = %12, %9
store i32 0, i32* %2
br label %17
17: ; preds = %16, %15
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @Q_isalpha(i32 %0) {
%2 = and i32 %0, -33
%3 = add i32 %2, -65
%4 = icmp ult i32 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
int CheckEnd() {
  int i = 0x12345678;
  char *c = (char *)&i;
  return (*c == 0x12);
}


x86 assembly (clang, -O0):
<CheckEnd>:
push   %rbp
mov    %rsp,%rbp
movl   $0x12345678,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x12,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @CheckEnd() {
%1 = alloca i32
%2 = alloca i8*
store i32 305419896, i32* %1
%3 = bitcast i32* %1 to i8*
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 18
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @CheckEnd() {
ret i32 0
}
/* Type definitions */
typedef unsigned char const uint16_t;

/* Variables and functions */
uint16_t get_uint16_le(const unsigned char *ptr) {
  return ptr[0] | (ptr[1] << 8);
}


x86 assembly (clang, -O0):
<get_uint16_le>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_uint16_le>:
mov    (%rdi),%al
ret

LLVM IR (-O0):
define zeroext i8 @get_uint16_le(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = shl i32 %10, 8
%12 = or i32 %6, %11
%13 = trunc i32 %12 to i8
ret i8 %13
}

LLVM IR (-O2):
define zeroext i8 @get_uint16_le(i8* nocapture %0) {
%2 = load i8, i8* %0
ret i8 %2
}
unsigned char next_input_uchar(const unsigned char *const input, int ilen,
                               int *i) {
  if (*i >= ilen) {
    return 0;
  }
  return input[(*i)++];
}


x86 assembly (clang, -O0):
<next_input_uchar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
cmp    -0x14(%rbp),%eax
jl     1127 <next_input_uchar+0x27>
movb   $0x0,-0x1(%rbp)
jmp    1141 <next_input_uchar+0x41>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rdx
mov    (%rdx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,(%rdx)
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_input_uchar>:
movslq (%rdx),%rax
cmp    %esi,%eax
jge    1110 <next_input_uchar+0x10>
lea    0x1(%rax),%ecx
mov    %ecx,(%rdx)
mov    (%rdi,%rax,1),%al
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define zeroext i8 @next_input_uchar(i8* nocapture %0, i32 %1, i32* nocapture %2) {
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, %1
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = add nsw i32 %4, 1
store i32 %7, i32* %2
%8 = sext i32 %4 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
br label %11
11: ; preds = %3, %6
%12 = phi i8 [ %10, %6 ], [ 0, %3 ]
ret i8 %12
}
/* Variables and functions */
int /*<<< orphan*/ makesubtree(unsigned int, int /*<<< orphan*/);
int /*<<< orphan*/ op_rename(int /*<<< orphan*/, int);
int /*<<< orphan*/ op_sync();
int /*<<< orphan*/ writeemptyfile(int);
void wl_renamesubtree(void) {
  unsigned testcode = 251;
  makesubtree(testcode, 0);
  writeemptyfile(2);
  op_sync();
  op_rename(0, 1);
}


x86 assembly (clang, -O0):
<wl_renamesubtree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xfb,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1030 <makesubtree@plt>
mov    $0x2,%edi
call   1040 <writeemptyfile@plt>
mov    $0x0,%al
call   1050 <op_sync@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1060 <op_rename@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wl_renamesubtree>:
push   %rax
mov    $0xfb,%edi
xor    %esi,%esi
call   1030 <makesubtree@plt>
mov    $0x2,%edi
call   1040 <writeemptyfile@plt>
xor    %eax,%eax
call   1050 <op_sync@plt>
xor    %edi,%edi
mov    $0x1,%esi
pop    %rax
jmp    1060 <op_rename@plt>

LLVM IR (-O0):
define void @wl_renamesubtree() {
%1 = alloca i32
store i32 251, i32* %1
%2 = load i32, i32* %1
%3 = call i32 @makesubtree(i32 %2, i32 0)
%4 = call i32 @writeemptyfile(i32 2)
%5 = call i32 (...) @op_sync()
%6 = call i32 @op_rename(i32 0, i32 1)
ret void
}

LLVM IR (-O2):
define void @wl_renamesubtree() {
%1 = tail call i32 @makesubtree(i32 251, i32 0)
%2 = tail call i32 @writeemptyfile(i32 2)
%3 = tail call i32 (...) @op_sync()
%4 = tail call i32 @op_rename(i32 0, i32 1)
ret void
}
/* Type definitions */
typedef int mode_t;

/* Variables and functions */
bool hasperm(mode_t mode, int type, int perm) {
  return ((mode >> (type * 3)) & perm) == perm;
}


x86 assembly (clang, -O0):
<hasperm>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
imul   $0x3,-0x8(%rbp),%ecx
sar    %cl,%eax
and    -0xc(%rbp),%eax
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hasperm>:
lea    (%rsi,%rsi,2),%ecx
sar    %cl,%edi
not    %edi
xor    %eax,%eax
test   %edi,%edx
sete   %al
ret

LLVM IR (-O0):
define i32 @hasperm(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = mul nsw i32 %8, 3
%10 = ashr i32 %7, %9
%11 = load i32, i32* %6
%12 = and i32 %10, %11
%13 = load i32, i32* %6
%14 = icmp eq i32 %12, %13
%15 = zext i1 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
define i32 @hasperm(i32 %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %1, 3
%5 = ashr i32 %0, %4
%6 = and i32 %5, %2
%7 = icmp eq i32 %6, %2
%8 = zext i1 %7 to i32
ret i32 %8
}
void f0(int i, long j, long long k) {}


x86 assembly (clang, -O0):
<f0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f0(i32 %0, i64 %1, i64 %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
store i32 %0, i32* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
ret void
}

LLVM IR (-O2):
define void @f0(i32 %0, i64 %1, i64 %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fail(char *);
void *realloc(void *, long);
void *safe_realloc(void *in_memory, long in_new_size) {
  void *out_memory;
  out_memory = realloc(in_memory, in_new_size);
  if (!out_memory)
    fail("Out of memory");
  return out_memory;
}


x86 assembly (clang, -O0):
<safe_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1158 <safe_realloc+0x38>
lea    0xead(%rip),%rdi
call   1030 <fail@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_realloc>:
push   %rbx
call   1040 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <safe_realloc+0x1a>
lea    0xecb(%rip),%rdi
call   1030 <fail@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"Out of memory\00"
define noalias i8* @safe_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @fail(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ err(int, char *);
void *malloc(size_t);
void *xmalloc(size_t size) {
  void *rv;
  if ((rv = malloc(size)) == NULL)
    err(1, "xmalloc");
  return rv;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1154 <xmalloc+0x34>
mov    $0x1,%edi
lea    0xeb1(%rip),%rsi
call   1030 <err@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [8 x i8] c"xmalloc\00"
define i8* @xmalloc(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 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @err(i32 1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
@.str = [8 x i8] c"xmalloc\00"
define noalias i8* @xmalloc(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 @err(i32 1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}