xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void show_usage() {
  printf("Usage: show { status | targets | interfaces | access-lists } \n");
}


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

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

LLVM IR (-O0):
@.str = [63 x i8] c"Usage: show { status | targets | interfaces | access-lists } \0A\00"
define void @show_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [62 x i8] c"Usage: show { status | targets | interfaces | access-lists } \00"
define void @show_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ power(int, int);
int /*<<< orphan*/ printf(char *, int, int /*<<< orphan*/, int,
                          int /*<<< orphan*/);
int main(void) {
  int i;
  for (i = 0; i <= 15; ++i)
    printf("2^%2d = %6ld,(-3)^%2d = %10d\n", i, power(2, i), i, power(-3, i));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xf,-0x8(%rbp)
jg     118f <main+0x6f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    $0x2,%edi
call   1030 <power@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    $0xfffffffd,%edi
call   1030 <power@plt>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    %eax,%r8d
lea    0xe84(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %ebx,%ebx
lea    0xed3(%rip),%r14
nopl   (%rax)
mov    $0x2,%edi
mov    %ebx,%esi
call   1030 <power@plt>
mov    %eax,%ebp
mov    $0xfffffffd,%edi
mov    %ebx,%esi
call   1030 <power@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x10,%ebx
jne    1130 <main+0x10>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [30 x i8] c"2^%2d = %6ld,(-3)^%2d = %10d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %6, %1 ]
%3 = tail call i32 @power(i32 2, i32 %2)
%4 = tail call i32 @power(i32 -3, i32 %2)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3, i32 %2, i32 %4)
%6 = add nuw nsw i32 %2, 1
%7 = icmp eq i32 %6, 16
br i1 %7, label %8, label %1
8: ; preds = %1
ret i32 0
}
put_byte(offset, byte_value) long offset;
int byte_value;
{
  char buff[512];
  read_block((unsigned)(offset / 512), buff);
  buff[(unsigned)(offset % 512)] = byte_value;
  write_block((unsigned)(offset / 512), buff);
}


x86 assembly (clang, -O0):
<put_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x200,%ecx
cqto
idiv   %rcx
mov    %eax,%edi
lea    -0x220(%rbp),%rsi
mov    $0x0,%al
call   1040 <read_block@plt>
mov    -0x14(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    $0x200,%esi
cqto
idiv   %rsi
mov    %edx,%eax
mov    %eax,%eax
mov    %cl,-0x220(%rbp,%rax,1)
mov    -0x10(%rbp),%rax
mov    $0x200,%ecx
cqto
idiv   %rcx
mov    %eax,%edi
lea    -0x220(%rbp),%rsi
mov    $0x0,%al
call   1030 <write_block@plt>
mov    -0x4(%rbp),%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_byte>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0x1ff(%rdi),%rbp
test   %rdi,%rdi
cmovns %rdi,%rbp
shr    $0x9,%rbp
mov    %rsp,%r15
mov    %ebp,%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <read_block@plt>
mov    %ebp,%eax
shl    $0x9,%eax
sub    %eax,%ebx
mov    %r14b,(%rsp,%rbx,1)
mov    %ebp,%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <write_block@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @put_byte(i64 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i32
%6 = alloca [512 x i8]
store i64 %0, i64* %4
store i32 %1, i32* %5
%7 = load i64, i64* %4
%8 = sdiv i64 %7, 512
%9 = trunc i64 %8 to i32
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%11 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @read_block to i32 (i32, i8*, ...)*)(i32 %9, i8* %10)
%12 = load i32, i32* %5
%13 = trunc i32 %12 to i8
%14 = load i64, i64* %4
%15 = srem i64 %14, 512
%16 = trunc i64 %15 to i32
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 %17
store i8 %13, i8* %18
%19 = load i64, i64* %4
%20 = sdiv i64 %19, 512
%21 = trunc i64 %20 to i32
%22 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%23 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @write_block to i32 (i32, i8*, ...)*)(i32 %21, i8* %22)
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @put_byte(i64 %0, i32 %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = sdiv i64 %0, 512
%6 = trunc i64 %5 to i32
%7 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @read_block to i32 (i32, i8*, ...)*)(i32 %6, i8* %4)
%8 = trunc i32 %1 to i8
%9 = srem i64 %0, 512
%10 = and i64 %9, 4294967295
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 %10
store i8 %8, i8* %11
%12 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @write_block to i32 (i32, i8*, ...)*)(i32 %6, i8* %4)
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ wint_t;
struct aFILE {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _get_actual_fp(struct aFILE *);
int /*<<< orphan*/ ungetwc(int /*<<< orphan*/, int /*<<< orphan*/);
wint_t my_ungetwc(wint_t c, struct aFILE *fp) {
  return ungetwc(c, _get_actual_fp(fp));
}


x86 assembly (clang, -O0):
<my_ungetwc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <_get_actual_fp@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
call   1030 <ungetwc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_ungetwc>:
push   %rbx
mov    %edi,%ebx
mov    %rsi,%rdi
call   1040 <_get_actual_fp@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1030 <ungetwc@plt>

LLVM IR (-O0):
%struct.aFILE = type { i32 }
define i32 @my_ungetwc(i32 %0, %struct.aFILE* %1) {
%3 = alloca i32
%4 = alloca %struct.aFILE*
store i32 %0, i32* %3
store %struct.aFILE* %1, %struct.aFILE** %4
%5 = load i32, i32* %3
%6 = load %struct.aFILE*, %struct.aFILE** %4
%7 = call i32 @_get_actual_fp(%struct.aFILE* %6)
%8 = call i32 @ungetwc(i32 %5, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
%struct.aFILE = type { i32 }
define i32 @my_ungetwc(i32 %0, %struct.aFILE* %1) {
%3 = tail call i32 @_get_actual_fp(%struct.aFILE* %1)
%4 = tail call i32 @ungetwc(i32 %0, i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_list(int *l, int size) {
  int c;
  for (c = 0; c < size; c++) {
    printf("%d ", l[c]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <print_list+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_list+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_list>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <print_list+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print_list+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_list(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @print_list(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
void fail(void) { _exit(1); }


x86 assembly (clang, -O0):
<fail>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<fail>:
push   %rax
mov    $0x1,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define void @fail() {
%1 = call i32 @_exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @fail() {
%1 = tail call i32 @_exit(i32 1)
unreachable
}
void dotP(double Ax, double Ay, double Az, double Bx, double By, double Bz,
          double *d) {
  *d = Ax * Bx + Ay * By + Az * Bz;
}


x86 assembly (clang, -O0):
<dotP>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
mov    %rdi,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dotP>:
mulsd  %xmm4,%xmm1
mulsd  %xmm3,%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm5,%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,(%rdi)
ret

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

LLVM IR (-O2):
define void @dotP(double %0, double %1, double %2, double %3, double %4, double %5, double* nocapture writeonly %6) {
%8 = fmul double %1, %4
%9 = tail call double @llvm.fmuladd.f64(double %0, double %3, double %8)
%10 = tail call double @llvm.fmuladd.f64(double %2, double %5, double %9)
store double %10, double* %6
ret void
}
/* Type definitions */
typedef int uLong;

/* Variables and functions */
uLong compressBound(uLong sourceLen) {
  return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + (sourceLen >> 25) +
         13;
}


x86 assembly (clang, -O0):
<compressBound>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0xc,%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0xe,%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0x19,%ecx
add    %ecx,%eax
add    $0xd,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compressBound>:
mov    %edi,%eax
sar    $0xc,%eax
mov    %edi,%ecx
add    %edi,%eax
sar    $0xe,%edi
sar    $0x19,%ecx
add    %edi,%eax
add    %ecx,%eax
add    $0xd,%eax
ret

LLVM IR (-O0):
define i32 @compressBound(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 12
%6 = add nsw i32 %3, %5
%7 = load i32, i32* %2
%8 = ashr i32 %7, 14
%9 = add nsw i32 %6, %8
%10 = load i32, i32* %2
%11 = ashr i32 %10, 25
%12 = add nsw i32 %9, %11
%13 = add nsw i32 %12, 13
ret i32 %13
}

LLVM IR (-O2):
define i32 @compressBound(i32 %0) {
%2 = ashr i32 %0, 12
%3 = ashr i32 %0, 14
%4 = ashr i32 %0, 25
%5 = add i32 %0, 13
%6 = add i32 %5, %2
%7 = add i32 %6, %3
%8 = add i32 %7, %4
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, char const *);
void print_help_warn(const char *limit, const char *def) {
  printf(" -w, --warning=LIMIT\n      Return warning if %s exceeds limit. "
         "Defaults to %s\n",
         limit, def);
}


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

x86 assembly (clang, -O2):
<print_help_warn>:
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [79 x i8] c" -w, --warning=LIMIT\0A Return warning if %s exceeds limit. Defaults to %s\0A\00"
define void @print_help_warn(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [79 x i8] c" -w, --warning=LIMIT\0A Return warning if %s exceeds limit. Defaults to %s\0A\00"
define void @print_help_warn(i8* %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
unsigned __int128 __attribute__((no, noclone)) bar(unsigned long long x) {
  unsigned __int128 y = ~33ULL;
  x >>= 63;
  return y / (x | 1);
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0xffffffffffffffde,-0x30(%rbp)
ff
mov    -0x18(%rbp),%rax
shr    $0x3f,%rax
mov    %rax,-0x18(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
or     $0x1,%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1160 <__udivti3>
mov    %rdx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x30,%rsp
pop    %rbp
ret
nopw   0x0(%rax,%rax,1)

x86 assembly (clang, -O2):
<bar>:
mov    $0xffffffffffffffde,%rax
xor    %edx,%edx
ret

LLVM IR (-O0):
define { i64, i64 } @bar(i64 %0) {
%2 = alloca i128
%3 = alloca i64
%4 = alloca i128
store i64 %0, i64* %3
store i128 18446744073709551582, i128* %4
%5 = load i64, i64* %3
%6 = lshr i64 %5, 63
store i64 %6, i64* %3
%7 = load i128, i128* %4
%8 = load i64, i64* %3
%9 = or i64 %8, 1
%10 = zext i64 %9 to i128
%11 = udiv i128 %7, %10
store i128 %11, i128* %2
%12 = bitcast i128* %2 to { i64, i64 }*
%13 = load { i64, i64 }, { i64, i64 }* %12
ret { i64, i64 } %13
}

LLVM IR (-O2):
define { i64, i64 } @bar(i64 %0) {
ret { i64, i64 } { i64 -34, i64 0 }
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void *calloc(size_t, size_t);
void *xcalloc(size_t nmemb, size_t size) {
  void *p = calloc(nmemb, size);
  if (p == NULL)
    abort();
  return p;
}


x86 assembly (clang, -O0):
<xcalloc>:
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 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1153 <xcalloc+0x33>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcalloc>:
push   %rax
call   1040 <calloc@plt>
test   %rax,%rax
je     112d <xcalloc+0xd>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define noalias i8* @xcalloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %2
ret i8* %3
}
void foo404(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo404(i32 %0) {
ret void
}
int roundup(float input) {
  float remainder;
  int integer_part;
  integer_part = (int)input;
  remainder = input - integer_part;
  if (remainder > 0.1) {
    integer_part++;
  }
  return integer_part;
}


x86 assembly (clang, -O0):
<roundup>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
cvttss2si -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xecb(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1148 <roundup+0x48>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<roundup>:
cvttss2si %xmm0,%ecx
cvttps2dq %xmm0,%xmm1
cvtdq2ps %xmm1,%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
xor    %eax,%eax
ucomisd 0xee3(%rip),%xmm0
seta   %al
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @roundup(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca i32
store float %0, float* %2
%5 = load float, float* %2
%6 = fptosi float %5 to i32
store i32 %6, i32* %4
%7 = load float, float* %2
%8 = load i32, i32* %4
%9 = sitofp i32 %8 to float
%10 = fsub float %7, %9
store float %10, float* %3
%11 = load float, float* %3
%12 = fpext float %11 to double
%13 = fcmp ogt double %12, 1.000000e-01
br i1 %13, label %14, label %17
14: ; preds = %1
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
br label %17
17: ; preds = %14, %1
%18 = load i32, i32* %4
ret i32 %18
}

LLVM IR (-O2):
define i32 @roundup(float %0) {
%2 = fptosi float %0 to i32
%3 = sitofp i32 %2 to float
%4 = fsub float %0, %3
%5 = fpext float %4 to double
%6 = fcmp ogt double %5, 1.000000e-01
%7 = zext i1 %6 to i32
%8 = add nsw i32 %7, %2
ret i32 %8
}
void gtk_widget_get_direction() {}


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

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

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

LLVM IR (-O2):
define void @gtk_widget_get_direction() {
ret void
}
void iio_chrdev_buffer_release(struct iio_dev *indio_dev) {}


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

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

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

LLVM IR (-O2):
%struct.iio_dev = type opaque
define void @iio_chrdev_buffer_release(%struct.iio_dev* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int __original_open64(char const *, int, int /*<<< orphan*/);
int /*<<< orphan*/ lic_fadv_dont(int);
int open64(const char *pathname, int flags, mode_t mode) {
  int ret = -1;
  ret = __original_open64(pathname, flags, mode);
  if (ret != -1)
    lic_fadv_dont(ret);
  return ret;
}


x86 assembly (clang, -O0):
<open64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <__original_open64@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
je     115d <open64+0x3d>
mov    -0x14(%rbp),%edi
call   1030 <lic_fadv_dont@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open64>:
push   %rbx
call   1040 <__original_open64@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
je     1134 <open64+0x14>
mov    %ebx,%edi
call   1030 <lic_fadv_dont@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @open64(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @__original_open64(i8* %0, i32 %1, i32 %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @lic_fadv_dont(i32 %4)
br label %8
8: ; preds = %6, %3
ret i32 %4
}
/* Variables and functions */
int fexists(char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  printf("Result is %d \n", fexists(argv[1]));
  return 0;
}


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    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <fexists@plt>
mov    %eax,%esi
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1030 <fexists@plt>
lea    0xecf(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Result is %d \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @fexists(i8* %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Result is %d \0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @fexists(i8* %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
double AstAlg_dday(int day, int hour, int minute, int second) {
  return (double)(day + hour / 24.0 + minute / 60.0 + second / 3600.0);
}


x86 assembly (clang, -O0):
<AstAlg_dday>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xeee(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xed1(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xeb4(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<AstAlg_dday>:
cvtsi2sd %edi,%xmm1
movd   %ecx,%xmm0
movd   %edx,%xmm2
punpckldq %xmm0,%xmm2
cvtsi2sd %esi,%xmm3
divsd  0xee4(%rip),%xmm3
cvtdq2pd %xmm2,%xmm0
divpd  0xee8(%rip),%xmm0
addsd  %xmm1,%xmm3
addsd  %xmm0,%xmm3
unpckhpd %xmm0,%xmm0
addsd  %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @AstAlg_dday(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 = sitofp i32 %9 to double
%11 = load i32, i32* %6
%12 = sitofp i32 %11 to double
%13 = fdiv double %12, 2.400000e+01
%14 = fadd double %10, %13
%15 = load i32, i32* %7
%16 = sitofp i32 %15 to double
%17 = fdiv double %16, 6.000000e+01
%18 = fadd double %14, %17
%19 = load i32, i32* %8
%20 = sitofp i32 %19 to double
%21 = fdiv double %20, 3.600000e+03
%22 = fadd double %18, %21
ret double %22
}

LLVM IR (-O2):
define double @AstAlg_dday(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sitofp i32 %0 to double
%6 = sitofp i32 %1 to double
%7 = fdiv double %6, 2.400000e+01
%8 = fadd double %7, %5
%9 = insertelement <2 x i32> poison, i32 %2, i64 0
%10 = insertelement <2 x i32> %9, i32 %3, i64 1
%11 = sitofp <2 x i32> %10 to <2 x double>
%12 = fdiv <2 x double> %11, <double 6.000000e+01, double 3.600000e+03>
%13 = extractelement <2 x double> %12, i64 0
%14 = fadd double %8, %13
%15 = extractelement <2 x double> %12, i64 1
%16 = fadd double %14, %15
ret double %16
}
void usbForgetDevices(void) {}


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

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

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

LLVM IR (-O2):
define void @usbForgetDevices() {
ret void
}
void foo525(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo525(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *safe_alloc();
int main() {
  void *a = safe_alloc();
  free(a);
  a = safe_alloc();
  free(a);
  void *b = safe_alloc();
  free(b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <safe_alloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1040 <safe_alloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1040 <safe_alloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i8* (...) @safe_alloc()
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @free(i8* %5)
%7 = call i8* (...) @safe_alloc()
store i8* %7, i8** %2
%8 = load i8*, i8** %2
%9 = call i32 @free(i8* %8)
%10 = call i8* (...) @safe_alloc()
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = call i32 @free(i8* %11)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i8* (...) @safe_alloc()
%2 = tail call i32 @free(i8* %1)
%3 = tail call i8* (...) @safe_alloc()
%4 = tail call i32 @free(i8* %3)
%5 = tail call i8* (...) @safe_alloc()
%6 = tail call i32 @free(i8* %5)
ret i32 0
}
/* Variables and functions */
char *strpbrk(char const *, char *);
int shellneeded(const char *cmd) {
  char *p = strpbrk(cmd, "/ \t\n");
  if (!*p || *p != '/')
    return 1;
  return strpbrk(cmd, "'\"$;|><&{}\n") ? 1 : 0;
}


x86 assembly (clang, -O0):
<shellneeded>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strpbrk@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     114d <shellneeded+0x3d>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     1159 <shellneeded+0x49>
movl   $0x1,-0x4(%rbp)
jmp    117d <shellneeded+0x6d>
mov    -0x10(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1030 <strpbrk@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shellneeded>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <strpbrk@plt>
mov    %rax,%rcx
mov    $0x1,%eax
cmpb   $0x2f,(%rcx)
jne    1147 <shellneeded+0x37>
lea    0xed1(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strpbrk@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"/ \09\0A\00"
@.str.1 = [12 x i8] c"'\22$;|><&{}\0A\00"
define i32 @shellneeded(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strpbrk(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %1
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 47
br i1 %14, label %15, label %16
15: ; preds = %10, %1
store i32 1, i32* %2
br label %22
16: ; preds = %10
%17 = load i8*, i8** %3
%18 = call i8* @strpbrk(i8* %17, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp ne i8* %18, null
%20 = zext i1 %19 to i64
%21 = select i1 %19, i32 1, i32 0
store i32 %21, i32* %2
br label %22
22: ; preds = %16, %15
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
@.str = [5 x i8] c"/ \09\0A\00"
@.str.1 = [12 x i8] c"'\22$;|><&{}\0A\00"
define i32 @shellneeded(i8* %0) {
%2 = tail call i8* @strpbrk(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 47
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = tail call i8* @strpbrk(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp ne i8* %6, null
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ %8, %5 ], [ 1, %1 ]
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
scalar_t__ fwrite(int *, int, int, int /*<<< orphan*/ *);
int putw(int x, FILE *f) { return fwrite(&x, sizeof x, 1, f) ? x : EOF; }


x86 assembly (clang, -O0):
<putw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
lea    -0x4(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
cmp    $0x0,%rax
je     114b <putw+0x3b>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1157 <putw+0x47>
mov    0x2e96(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putw>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rcx
mov    %edi,0xc(%rsp)
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
test   %rax,%rax
jne    113f <putw+0x2f>
mov    0x2ea9(%rip),%rbx
mov    (%rbx),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @putw(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = call i64 @fwrite(i32* %3, i32 4, i32 1, i32* %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* @EOF
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @putw(i32 %0, i32* nocapture %1) {
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i64 @fwrite(i32* %3, i32 4, i32 1, i32* %1)
%5 = icmp eq i64 %4, 0
%6 = load i32, i32* %3
%7 = load i32, i32* @EOF
%8 = select i1 %5, i32 %7, i32 %6
ret i32 %8
}
/* Type definitions */
struct fdi {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ track_pc(struct fdi *, int);
void track_pc_15(struct fdi *fdi) { track_pc(fdi, 15); }


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

x86 assembly (clang, -O2):
<track_pc_15>:
mov    $0xf,%esi
jmp    1030 <track_pc@plt>

LLVM IR (-O0):
%struct.fdi = type { i32 }
define void @track_pc_15(%struct.fdi* %0) {
%2 = alloca %struct.fdi*
store %struct.fdi* %0, %struct.fdi** %2
%3 = load %struct.fdi*, %struct.fdi** %2
%4 = call i32 @track_pc(%struct.fdi* %3, i32 15)
ret void
}

LLVM IR (-O2):
%struct.fdi = type { i32 }
define void @track_pc_15(%struct.fdi* %0) {
%2 = tail call i32 @track_pc(%struct.fdi* %0, i32 15)
ret void
}
/* Variables and functions */
int floor(int);
int parent(int idx) { return (floor(idx / 2)); }


x86 assembly (clang, -O0):
<parent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <floor@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parent>:
mov    %edi,%eax
shr    $0x1f,%eax
add    %eax,%edi
sar    %edi
jmp    1030 <floor@plt>

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

LLVM IR (-O2):
define i32 @parent(i32 %0) {
%2 = sdiv i32 %0, 2
%3 = tail call i32 @floor(i32 %2)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void fprintln(FILE *dst, char **lines, int nlines) {
  int i = 0;
  for (i = 0; i < nlines; i++) {
    fprintf(dst, "%s", lines[i]);
  }
}


x86 assembly (clang, -O0):
<fprintln>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1167 <fprintln+0x57>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xeac(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1131 <fprintln+0x21>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprintln>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
jle    1145 <fprintln+0x35>
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%r12d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
mov    %r15,%rsi
call   1030 <fputs@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <fprintln+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @fprintln(i32* %0, i8** %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
store i32 0, i32* %7
store i32 0, i32* %7
br label %8
8: ; preds = %20, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %6
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %23
12: ; preds = %8
%13 = load i32*, i32** %4
%14 = load i8**, i8*** %5
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %14, i64 %16
%18 = load i8*, i8** %17
%19 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %12
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
store i32 %22, i32* %7
br label %8
23: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @fprintln(i32* nocapture %0, i8** nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %14
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %12, %7 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i32 @fputs(i8* %10, i32* %0)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %6
br i1 %13, label %14, label %7
14: ; preds = %7, %3
ret void
}
int test_imm_1Cuint8_reg(unsigned char val) {
  return ((val) & (0x1C << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_1Cuint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 28
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int interposableFoo() { return 100; }


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

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

LLVM IR (-O0):
define i32 @interposableFoo() {
ret i32 100
}

LLVM IR (-O2):
define i32 @interposableFoo() {
ret i32 100
}
long long int llabs(long long int i) {
  if (i < 0)
    i = -i;
  return i;
}


x86 assembly (clang, -O0):
<llabs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    111d <llabs+0x1d>
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<llabs>:
mov    %rdi,%rax
neg    %rax
cmovs  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @llabs(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i64, i64* %2
%7 = sub nsw i64 0, %6
store i64 %7, i64* %2
br label %8
8: ; preds = %5, %1
%9 = load i64, i64* %2
ret i64 %9
}

LLVM IR (-O2):
define i64 @llabs(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}
char *strcpy(char *dst, const char *src) {
  char *cp = dst;
  while ((*cp++ = *src++))
    ;
  return dst;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1143 <strcpy+0x43>
jmp    1114 <strcpy+0x14>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
unsigned long int power(int a, unsigned int n) {
  return (n == 0) ? 1 : a * power(a, n - 1);
}


x86 assembly (clang, -O0):
<power>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1136 <power+0x26>
mov    $0x1,%eax
mov    %rax,-0x10(%rbp)
jmp    115b <power+0x4b>
movslq -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
call   1030 <power@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
imul   %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<power>:
test   %esi,%esi
je     111b <power+0x1b>
movslq %edi,%rcx
lea    -0x1(%rsi),%eax
mov    %esi,%edx
and    $0x7,%edx
cmp    $0x7,%eax
jae    1121 <power+0x21>
mov    $0x1,%eax
jmp    1155 <power+0x55>
mov    $0x1,%eax
ret
and    $0xfffffff8,%esi
mov    $0x1,%eax
nopl   0x0(%rax)
imul   %rcx,%rax
imul   %rcx,%rax
imul   %rcx,%rax
imul   %rcx,%rax
imul   %rcx,%rax
imul   %rcx,%rax
imul   %rcx,%rax
imul   %rcx,%rax
add    $0xfffffff8,%esi
jne    1130 <power+0x30>
test   %edx,%edx
je     1169 <power+0x69>
nopl   0x0(%rax)
imul   %rcx,%rax
add    $0xffffffff,%edx
jne    1160 <power+0x60>
ret

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

LLVM IR (-O2):
define i64 @power(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %34, label %4
4: ; preds = %2
%5 = sext i32 %0 to i64
%6 = add i32 %1, -1
%7 = and i32 %1, 7
%8 = icmp ult i32 %6, 7
br i1 %8, label %24, label %9
9: ; preds = %4
%10 = and i32 %1, -8
br label %11
11: ; preds = %11, %9
%12 = phi i64 [ 1, %9 ], [ %21, %11 ]
%13 = phi i32 [ 0, %9 ], [ %22, %11 ]
%14 = mul i64 %12, %5
%15 = mul i64 %14, %5
%16 = mul i64 %15, %5
%17 = mul i64 %16, %5
%18 = mul i64 %17, %5
%19 = mul i64 %18, %5
%20 = mul i64 %19, %5
%21 = mul i64 %20, %5
%22 = add i32 %13, 8
%23 = icmp eq i32 %22, %10
br i1 %23, label %24, label %11
24: ; preds = %11, %4
%25 = phi i64 [ undef, %4 ], [ %21, %11 ]
%26 = phi i64 [ 1, %4 ], [ %21, %11 ]
%27 = icmp eq i32 %7, 0
br i1 %27, label %34, label %28
28: ; preds = %24, %28
%29 = phi i64 [ %31, %28 ], [ %26, %24 ]
%30 = phi i32 [ %32, %28 ], [ 0, %24 ]
%31 = mul i64 %29, %5
%32 = add i32 %30, 1
%33 = icmp eq i32 %32, %7
br i1 %33, label %34, label %28
34: ; preds = %24, %28, %2
%35 = phi i64 [ 1, %2 ], [ %25, %24 ], [ %31, %28 ]
ret i64 %35
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void write_little_endian32(uint8_t *buf, uint32_t value) {
  buf[0] = (value >> 0) & 0xFF;
  buf[1] = (value >> 8) & 0xFF;
  buf[2] = (value >> 16) & 0xFF;
  buf[3] = (value >> 24) & 0xFF;
}


x86 assembly (clang, -O0):
<write_little_endian32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x0,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x10,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_little_endian32>:
mov    %esi,%eax
movzbl %al,%ecx
mov    %ecx,(%rdi)
movzbl %ah,%ecx
mov    %ecx,0x4(%rdi)
mov    %esi,%ecx
shr    $0x10,%ecx
movzbl %cl,%ecx
mov    %ecx,0x8(%rdi)
shr    $0x18,%eax
mov    %eax,0xc(%rdi)
ret

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

LLVM IR (-O2):
define void @write_little_endian32(i32* nocapture writeonly %0, i32 %1) {
%3 = and i32 %1, 255
store i32 %3, i32* %0
%4 = lshr i32 %1, 8
%5 = and i32 %4, 255
%6 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %5, i32* %6
%7 = lshr i32 %1, 16
%8 = and i32 %7, 255
%9 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %8, i32* %9
%10 = lshr i32 %1, 24
%11 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %10, i32* %11
ret void
}
void caml_call_gc() {}


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

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

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

LLVM IR (-O2):
define void @caml_call_gc() {
ret void
}