xunge/DecIR huggingface dataset:
/* Variables and functions */
int cbuf(int, int, int);
cbuf15(int f, int n) { return (cbuf(f, n, 15)); }


x86 assembly (clang, -O0):
<cbuf15>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0xf,%edx
call   1030 <cbuf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbuf15>:
mov    $0xf,%edx
jmp    1030 <cbuf@plt>

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

LLVM IR (-O2):
define i32 @cbuf15(i32 %0, i32 %1) {
%3 = tail call i32 @cbuf(i32 %0, i32 %1, i32 15)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ puts(char *);
int main() {
  char string[10];
  gets(string);
  puts(string);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rdi
call   1040 <gets@plt>
lea    -0xe(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <gets@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = call i32 @gets(i8* %3)
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = call i32 @puts(i8* %5)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @gets(i8* %2)
%4 = call i32 @puts(i8* %2)
ret i32 0
}
unsigned int count_set_bits(unsigned long long bitmap) {
  unsigned int count = 0;
  for (; bitmap; bitmap &= bitmap - 1)
    ++count;
  return count;
}


x86 assembly (clang, -O0):
<count_set_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1138 <count_set_bits+0x38>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
sub    $0x1,%rax
and    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    110f <count_set_bits+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_set_bits>:
xor    %eax,%eax
test   %rdi,%rdi
je     111c <count_set_bits+0x1c>
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
lea    -0x1(%rdi),%rcx
and    %rcx,%rdi
jne    1110 <count_set_bits+0x10>
ret

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

LLVM IR (-O2):
define i32 @count_set_bits(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = phi i64 [ %8, %3 ], [ %0, %1 ]
%6 = add i32 %4, 1
%7 = add i64 %5, -1
%8 = and i64 %7, %5
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %11
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int UP3D_GetParameter(int);
int32_t UP3D_GetMotorState(int motor) {
  if ((motor < 1) || (motor > 4))
    return -1;
  int32_t state = UP3D_GetParameter(0x02 + motor - 1);
  if ((state < 0) || (state > 5))
    state = 6;
  return state;
}


x86 assembly (clang, -O0):
<UP3D_GetMotorState>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     112f <UP3D_GetMotorState+0x1f>
cmpl   $0x4,-0x8(%rbp)
jle    113b <UP3D_GetMotorState+0x2b>
movl   $0xffffffff,-0x4(%rbp)
jmp    116d <UP3D_GetMotorState+0x5d>
mov    -0x8(%rbp),%edi
add    $0x2,%edi
sub    $0x1,%edi
call   1030 <UP3D_GetParameter@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1160 <UP3D_GetMotorState+0x50>
cmpl   $0x5,-0xc(%rbp)
jle    1167 <UP3D_GetMotorState+0x57>
movl   $0x6,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UP3D_GetMotorState>:
lea    -0x5(%rdi),%ecx
mov    $0xffffffff,%eax
cmp    $0xfffffffc,%ecx
jb     1137 <UP3D_GetMotorState+0x27>
push   %rax
add    $0x1,%edi
call   1030 <UP3D_GetParameter@plt>
mov    %eax,%ecx
cmp    $0x6,%eax
mov    $0x6,%eax
cmovb  %ecx,%eax
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define i32 @UP3D_GetMotorState(i32 %0) {
%2 = add i32 %0, -5
%3 = icmp ult i32 %2, -4
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = add nuw nsw i32 %0, 1
%6 = tail call i32 @UP3D_GetParameter(i32 %5)
%7 = icmp ult i32 %6, 6
%8 = select i1 %7, i32 %6, i32 6
br label %9
9: ; preds = %1, %4
%10 = phi i32 [ %8, %4 ], [ -1, %1 ]
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ putc(int, int /*<<< orphan*/ *);
int write_int24(FILE *out, int value) {
  putc(value & 0xff, out);
  putc((value >> 8) & 0xff, out);
  putc((value >> 16) & 0xff, out);
  return 0;
}


x86 assembly (clang, -O0):
<write_int24>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
and    $0xff,%edi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
mov    -0xc(%rbp),%edi
sar    $0x8,%edi
and    $0xff,%edi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
mov    -0xc(%rbp),%edi
sar    $0x10,%edi
and    $0xff,%edi
mov    -0x8(%rbp),%rsi
call   1030 <putc@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_int24>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
movzbl %bl,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
movzbl %bh,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
shr    $0x10,%ebx
movzbl %bl,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @write_int24(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 = and i32 %5, 255
%7 = load i32*, i32** %3
%8 = call i32 @putc(i32 %6, i32* %7)
%9 = load i32, i32* %4
%10 = ashr i32 %9, 8
%11 = and i32 %10, 255
%12 = load i32*, i32** %3
%13 = call i32 @putc(i32 %11, i32* %12)
%14 = load i32, i32* %4
%15 = ashr i32 %14, 16
%16 = and i32 %15, 255
%17 = load i32*, i32** %3
%18 = call i32 @putc(i32 %16, i32* %17)
ret i32 0
}

LLVM IR (-O2):
define i32 @write_int24(i32* nocapture %0, i32 %1) {
%3 = and i32 %1, 255
%4 = tail call i32 @putc(i32 %3, i32* %0)
%5 = lshr i32 %1, 8
%6 = and i32 %5, 255
%7 = tail call i32 @putc(i32 %6, i32* %0)
%8 = lshr i32 %1, 16
%9 = and i32 %8, 255
%10 = tail call i32 @putc(i32 %9, i32* %0)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ strlen(char *);
uint8_t opdi_int32_to_str(int32_t value, char *msgBuf) {
  snprintf(msgBuf, 11, "%d", value);
  return strlen(msgBuf);
}


x86 assembly (clang, -O0):
<opdi_int32_to_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    $0xb,%esi
lea    0xebe(%rip),%rdx
call   1040 <snprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opdi_int32_to_str>:
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ecx
lea    0xed3(%rip),%rdx
mov    %rsi,%rdi
mov    $0xb,%esi
call   1040 <snprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <strlen@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @opdi_int32_to_str(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i32, i32* %3
%7 = call i32 @snprintf(i8* %5, i32 11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
ret i32 %9
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @opdi_int32_to_str(i32 %0, i8* %1) {
%3 = tail call i32 @snprintf(i8* %1, i32 11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%4 = tail call i32 @strlen(i8* %1)
ret i32 %4
}
void foo396() {}


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

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

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

LLVM IR (-O2):
define void @foo396() {
ret void
}
int f1(int j, char *b, long long i) { return j + b[i]; }


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
movsbl (%rsi,%rdx,1),%eax
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @f1(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = getelementptr inbounds i8, i8* %8, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = add nsw i32 %7, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @f1(i32 %0, i8* nocapture %1, i64 %2) {
%4 = getelementptr inbounds i8, i8* %1, i64 %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = add nsw i32 %6, %0
ret i32 %7
}
int ufshpb_prep(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) { return 0; }


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

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

LLVM IR (-O0):
%struct.ufs_hba = type opaque
%struct.ufshcd_lrb = type opaque
define i32 @ufshpb_prep(%struct.ufs_hba* %0, %struct.ufshcd_lrb* %1) {
%3 = alloca %struct.ufs_hba*
%4 = alloca %struct.ufshcd_lrb*
store %struct.ufs_hba* %0, %struct.ufs_hba** %3
store %struct.ufshcd_lrb* %1, %struct.ufshcd_lrb** %4
ret i32 0
}

LLVM IR (-O2):
%struct.ufs_hba = type opaque
%struct.ufshcd_lrb = type opaque
define i32 @ufshpb_prep(%struct.ufs_hba* nocapture readnone %0, %struct.ufshcd_lrb* nocapture readnone %1) {
ret i32 0
}
double double_add(double a, double b) { return a + b; }


x86 assembly (clang, -O0):
<double_add>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_add>:
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @double_add(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fadd double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @double_add(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main(void) {
  unsigned int x = 10;
  while (x >= 10) {
    x += 2;
  }
  assert(1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jb     113e <main+0x2e>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %2
%5 = icmp uge i32 %4, 10
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* %2
%8 = add i32 %7, 2
store i32 %8, i32* %2
br label %3
9: ; preds = %3
%10 = call i32 @assert(i32 1)
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 0
}
unsigned short int f37(unsigned short int x, unsigned int y) {
  return (x >> y) | (x << (8 * 2 - y));
}


x86 assembly (clang, -O0):
<f37>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
movzwl -0x2(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
movzwl -0x2(%rbp),%edx
mov    $0x10,%ecx
sub    -0x8(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f37>:
mov    %esi,%ecx
mov    %edi,%eax
ror    %cl,%ax
ret

LLVM IR (-O0):
define zeroext i16 @f37(i16 zeroext %0, i32 %1) {
%3 = alloca i16
%4 = alloca i32
store i16 %0, i16* %3
store i32 %1, i32* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = load i32, i32* %4
%8 = ashr i32 %6, %7
%9 = load i16, i16* %3
%10 = zext i16 %9 to i32
%11 = load i32, i32* %4
%12 = sub i32 16, %11
%13 = shl i32 %10, %12
%14 = or i32 %8, %13
%15 = trunc i32 %14 to i16
ret i16 %15
}

LLVM IR (-O2):
define zeroext i16 @f37(i16 zeroext %0, i32 %1) {
%3 = trunc i32 %1 to i16
%4 = tail call i16 @llvm.fshr.i16(i16 %0, i16 %0, i16 %3)
ret i16 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ readUInt32(void const *);
int32_t bsonValueToInt32(const void *valuePtr) { return readUInt32(valuePtr); }


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

x86 assembly (clang, -O2):
<bsonValueToInt32>:
jmp    1030 <readUInt32@plt>

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

LLVM IR (-O2):
define i32 @bsonValueToInt32(i8* %0) {
%2 = tail call i32 @readUInt32(i8* %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
int get_while_eof(const char *input_name) {
  int while_eof;
  FILE *input;
  input = fopen(input_name, "r");
  fscanf(input, "%d", &while_eof);
  fclose(input);
  return while_eof;
}


x86 assembly (clang, -O0):
<get_while_eof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xea7(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <fscanf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_while_eof>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xeb7(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rax,%rdi
call   1040 <fscanf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @get_while_eof(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %4
%7 = load i32*, i32** %4
%8 = call i32 @fscanf(i32* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = load i32*, i32** %4
%10 = call i32 @fclose(i32* %9)
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @get_while_eof(i8* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @fscanf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = call i32 @fclose(i32* %4)
%7 = load i32, i32* %2
ret i32 %7
}
/* Variables and functions */
char getchar();
void leggistringa(char *buffer) {
  int i = 0;
  char car;
  while ((car = getchar()) != '\n')
    buffer[i++] = car;
  buffer[i] = '\0';
}


x86 assembly (clang, -O0):
<leggistringa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0xd(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     1156 <leggistringa+0x46>
mov    -0xd(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0xc(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1123 <leggistringa+0x13>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leggistringa>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
je     1145 <leggistringa+0x35>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
jne    1130 <leggistringa+0x20>
mov    %ebx,%ebx
movb   $0x0,(%r14,%rbx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @leggistringa(i8* nocapture writeonly %0) {
%2 = tail call signext i8 (...) @getchar()
%3 = icmp eq i8 %2, 10
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8 [ %9, %4 ], [ %2, %1 ]
%7 = add nuw i64 %5, 1
%8 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 %6, i8* %8
%9 = tail call signext i8 (...) @getchar()
%10 = icmp eq i8 %9, 10
br i1 %10, label %11, label %4
11: ; preds = %4
%12 = and i64 %7, 4294967295
br label %13
13: ; preds = %11, %1
%14 = phi i64 [ 0, %1 ], [ %12, %11 ]
%15 = getelementptr inbounds i8, i8* %0, i64 %14
store i8 0, i8* %15
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void printArray(int *arr) {
  for (int i = 0; i < 26; i++) {
    printf("arr[%4d] = %d\n", i, arr[i]);
  }
}


x86 assembly (clang, -O0):
<printArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x1a,-0xc(%rbp)
jge    1155 <printArray+0x45>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <printArray+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArray>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0xedf(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%edx
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x1a,%rbx
jne    1130 <printArray+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [15 x i8] c"arr[%4d] = %d\0A\00"
define void @printArray(i32* nocapture %0) {
br label %3
2: ; preds = %3
ret void
3: ; preds = %1, %3
%4 = phi i64 [ 0, %1 ], [ %9, %3 ]
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = trunc i64 %4 to i32
%8 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %6)
%9 = add nuw nsw i64 %4, 1
%10 = icmp eq i64 %9, 26
br i1 %10, label %2, label %3
}
/* Type definitions */
struct jx {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ advance_object_iter(struct jx *, void **);
struct jx *jx_get_value(void **);
struct jx *jx_iterate_values(struct jx *j, void **i) {
  advance_object_iter(j, i);
  return jx_get_value(i);
}


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

x86 assembly (clang, -O2):
<jx_iterate_values>:
push   %rbx
mov    %rsi,%rbx
call   1040 <advance_object_iter@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <jx_get_value@plt>

LLVM IR (-O0):
%struct.jx = type { i32 }
define %struct.jx* @jx_iterate_values(%struct.jx* %0, i8** %1) {
%3 = alloca %struct.jx*
%4 = alloca i8**
store %struct.jx* %0, %struct.jx** %3
store i8** %1, i8*** %4
%5 = load %struct.jx*, %struct.jx** %3
%6 = load i8**, i8*** %4
%7 = call i32 @advance_object_iter(%struct.jx* %5, i8** %6)
%8 = load i8**, i8*** %4
%9 = call %struct.jx* @jx_get_value(i8** %8)
ret %struct.jx* %9
}

LLVM IR (-O2):
%struct.jx = type { i32 }
define %struct.jx* @jx_iterate_values(%struct.jx* %0, i8** %1) {
%3 = tail call i32 @advance_object_iter(%struct.jx* %0, i8** %1)
%4 = tail call %struct.jx* @jx_get_value(i8** %1)
ret %struct.jx* %4
}
void DrawPointBmp(unsigned short *buffer, int x, int y, unsigned short color) {
  int idx;
  idx = x + y * 640;
  buffer[idx] = color;
}


x86 assembly (clang, -O0):
<DrawPointBmp>:
push   %rbp
mov    %rsp,%rbp
mov    %cx,%ax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
mov    -0xc(%rbp),%eax
imul   $0x280,-0x10(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x12(%rbp),%dx
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dx,(%rax,%rcx,2)
pop    %rbp
ret

x86 assembly (clang, -O2):
<DrawPointBmp>:
lea    (%rdx,%rdx,4),%eax
shl    $0x7,%eax
add    %esi,%eax
cltq
mov    %cx,(%rdi,%rax,2)
ret

LLVM IR (-O0):
define void @DrawPointBmp(i16* %0, i32 %1, i32 %2, i16 zeroext %3) {
%5 = alloca i16*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i16
%9 = alloca i32
store i16* %0, i16** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i16 %3, i16* %8
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = mul nsw i32 %11, 640
%13 = add nsw i32 %10, %12
store i32 %13, i32* %9
%14 = load i16, i16* %8
%15 = load i16*, i16** %5
%16 = load i32, i32* %9
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i16, i16* %15, i64 %17
store i16 %14, i16* %18
ret void
}

LLVM IR (-O2):
define void @DrawPointBmp(i16* nocapture writeonly %0, i32 %1, i32 %2, i16 zeroext %3) {
%5 = mul nsw i32 %2, 640
%6 = add nsw i32 %5, %1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i16, i16* %0, i64 %7
store i16 %3, i16* %8
ret void
}
long Double_to_MINUS_long(double x) { return (long)x; }


x86 assembly (clang, -O0):
<Double_to_MINUS_long>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Double_to_MINUS_long>:
cvttsd2si %xmm0,%rax
ret

LLVM IR (-O0):
define i64 @Double_to_MINUS_long(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i64
ret i64 %4
}

LLVM IR (-O2):
define i64 @Double_to_MINUS_long(double %0) {
%2 = fptosi double %0 to i64
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ ft_putllong_fd(long long, int);
void ft_putllong(long long n) { ft_putllong_fd(n, 1); }


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

x86 assembly (clang, -O2):
<ft_putllong>:
mov    $0x1,%esi
jmp    1030 <ft_putllong_fd@plt>

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

LLVM IR (-O2):
define void @ft_putllong(i64 %0) {
%2 = tail call i32 @ft_putllong_fd(i64 %0, i32 1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ PTRACE_SYSCALL;
int /*<<< orphan*/ ptrace(int /*<<< orphan*/, int /*<<< orphan*/,
                          int /*<<< orphan*/, int /*<<< orphan*/);
void syscall_continue(pid_t pid) { ptrace(PTRACE_SYSCALL, pid, 0, 0); }


x86 assembly (clang, -O0):
<syscall_continue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <ptrace@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscall_continue>:
mov    %edi,%esi
mov    0x2ebf(%rip),%rax
mov    (%rax),%edi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <ptrace@plt>

LLVM IR (-O0):
@PTRACE_SYSCALL = global i32 0
define void @syscall_continue(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @PTRACE_SYSCALL
%4 = load i32, i32* %2
%5 = call i32 @ptrace(i32 %3, i32 %4, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
@PTRACE_SYSCALL = global i32 0
define void @syscall_continue(i32 %0) {
%2 = load i32, i32* @PTRACE_SYSCALL
%3 = tail call i32 @ptrace(i32 %2, i32 %0, i32 0, i32 0)
ret void
}
/* Type definitions */
struct __res_state {
  int retry;
};

/* Variables and functions */
struct __res_state *__res_state();
struct __res_state _res;
int /*<<< orphan*/ abort();
void do_test(struct __res_state *resp) {
  if (resp != &_res || resp != __res_state())
    abort();
  if (_res.retry != 12)
    abort();
}


x86 assembly (clang, -O0):
<do_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2eb5(%rip),%rax
cmp    %rax,-0x8(%rbp)
jne    115c <do_test+0x3c>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <__res_state@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
je     1163 <do_test+0x43>
mov    $0x0,%al
call   1030 <abort@plt>
mov    0x2e7e(%rip),%rax
cmpl   $0xc,(%rax)
je     117a <do_test+0x5a>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_test>:
push   %rax
cmp    0x2ec0(%rip),%rdi
jne    1148 <do_test+0x28>
xor    %eax,%eax
call   1040 <__res_state@plt>
cmp    0x2eb0(%rip),%rax
jne    1148 <do_test+0x28>
mov    0x2ea7(%rip),%rax
cmpl   $0xc,(%rax)
jne    1148 <do_test+0x28>
pop    %rax
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
%struct.__res_state = type { i32 }
@_res = global %struct.__res_state zeroinitializer
define void @do_test(%struct.__res_state* %0) {
%2 = alloca %struct.__res_state*
store %struct.__res_state* %0, %struct.__res_state** %2
%3 = load %struct.__res_state*, %struct.__res_state** %2
%4 = icmp ne %struct.__res_state* %3, @_res
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = load %struct.__res_state*, %struct.__res_state** %2
%7 = call %struct.__res_state* (...) @__res_state()
%8 = icmp ne %struct.__res_state* %6, %7
br i1 %8, label %9, label %11
9: ; preds = %5, %1
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %5
%12 = load i32, i32* getelementptr inbounds (%struct.__res_state, %struct.__res_state* @_res, i32 0, i32 0)
%13 = icmp ne i32 %12, 12
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %11
ret void
}

LLVM IR (-O2):
%struct.__res_state = type { i32 }
@_res = global %struct.__res_state zeroinitializer
define void @do_test(%struct.__res_state* readnone %0) {
%2 = icmp eq %struct.__res_state* %0, @_res
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call %struct.__res_state* (...) @__res_state()
%5 = icmp eq %struct.__res_state* %4, @_res
br i1 %5, label %8, label %6
6: ; preds = %3, %1
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %3
%9 = load i32, i32* getelementptr inbounds (%struct.__res_state, %struct.__res_state* @_res, i64 0, i32 0)
%10 = icmp eq i32 %9, 12
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i32 (...) @abort()
unreachable
13: ; preds = %8
ret void
}
int is_extended(unsigned char sys_type) {
  return (sys_type == 0x5 || sys_type == 0xf || sys_type == 0x85);
}


x86 assembly (clang, -O0):
<is_extended>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x5,%ecx
mov    %al,-0x2(%rbp)
je     113d <is_extended+0x3d>
movzbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xf,%ecx
mov    %al,-0x2(%rbp)
je     113d <is_extended+0x3d>
movzbl -0x1(%rbp),%eax
cmp    $0x85,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_extended>:
mov    $0x1,%eax
cmp    $0x5,%dil
je     1111 <is_extended+0x11>
cmp    $0xf,%dil
jne    1112 <is_extended+0x12>
ret
xor    %eax,%eax
cmp    $0x85,%dil
sete   %al
ret

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

LLVM IR (-O2):
define i32 @is_extended(i8 zeroext %0) {
switch i8 %0, label %2 [
i8 15, label %5
i8 5, label %5
]
2: ; preds = %1
%3 = icmp eq i8 %0, -123
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ]
ret i32 %6
}
/* Type definitions */
struct dpx_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dpx_link(struct dpx_t *);
int /*<<< orphan*/ dpx_open(struct dpx_t *, char const *, int);
void dpx_olink(struct dpx_t *dpx, const char *path, int mode) {
  dpx_open(dpx, path, mode);
  dpx_link(dpx);
}


x86 assembly (clang, -O0):
<dpx_olink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <dpx_open@plt>
mov    -0x8(%rbp),%rdi
call   1030 <dpx_link@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dpx_olink>:
push   %rbx
mov    %rdi,%rbx
call   1040 <dpx_open@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <dpx_link@plt>

LLVM IR (-O0):
%struct.dpx_t = type { i32 }
define void @dpx_olink(%struct.dpx_t* %0, i8* %1, i32 %2) {
%4 = alloca %struct.dpx_t*
%5 = alloca i8*
%6 = alloca i32
store %struct.dpx_t* %0, %struct.dpx_t** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load %struct.dpx_t*, %struct.dpx_t** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @dpx_open(%struct.dpx_t* %7, i8* %8, i32 %9)
%11 = load %struct.dpx_t*, %struct.dpx_t** %4
%12 = call i32 @dpx_link(%struct.dpx_t* %11)
ret void
}

LLVM IR (-O2):
%struct.dpx_t = type { i32 }
define void @dpx_olink(%struct.dpx_t* %0, i8* %1, i32 %2) {
%4 = tail call i32 @dpx_open(%struct.dpx_t* %0, i8* %1, i32 %2)
%5 = tail call i32 @dpx_link(%struct.dpx_t* %0)
ret void
}
int hex2dec(char val) {
  switch (val) {
  case '0' ... '9':
    return val - '0';
  case 'a' ... 'f':
    return val - 'a' + 10;
  }
  assert(0);
}


x86 assembly (clang, -O0):
<hex2dec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffffd0,%eax
sub    $0xa,%eax
jb     114a <hex2dec+0x3a>
jmp    1136 <hex2dec+0x26>
mov    -0xc(%rbp),%eax
add    $0xffffff9f,%eax
sub    $0x6,%eax
jb     1159 <hex2dec+0x49>
jmp    116b <hex2dec+0x5b>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <hex2dec+0x64>
movsbl -0x5(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <hex2dec+0x64>
xor    %edi,%edi
mov    $0x0,%al
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex2dec>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%eax
jae    1119 <hex2dec+0x9>
ret
lea    -0x61(%rdi),%eax
cmp    $0x6,%eax
jae    1127 <hex2dec+0x17>
add    $0xffffffa9,%edi
mov    %edi,%eax
ret
push   %rax
xor    %edi,%edi
xor    %eax,%eax
call   1030 <assert@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @hex2dec(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %15 [
i32 48, label %6
i32 49, label %6
i32 50, label %6
i32 51, label %6
i32 52, label %6
i32 53, label %6
i32 54, label %6
i32 55, label %6
i32 56, label %6
i32 57, label %6
i32 97, label %10
i32 98, label %10
i32 99, label %10
i32 100, label %10
i32 101, label %10
i32 102, label %10
]
6: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
%9 = sub nsw i32 %8, 48
store i32 %9, i32* %2
br label %17
10: ; preds = %1, %1, %1, %1, %1, %1
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = sub nsw i32 %12, 97
%14 = add nsw i32 %13, 10
store i32 %14, i32* %2
br label %17
15: ; preds = %1
%16 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 0)
br label %17
17: ; preds = %15, %10, %6
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @hex2dec(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %7 [
i32 48, label %3
i32 49, label %3
i32 50, label %3
i32 51, label %3
i32 52, label %3
i32 53, label %3
i32 54, label %3
i32 55, label %3
i32 56, label %3
i32 57, label %3
i32 97, label %5
i32 98, label %5
i32 99, label %5
i32 100, label %5
i32 101, label %5
i32 102, label %5
]
3: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
%4 = add nsw i32 %2, -48
br label %9
5: ; preds = %1, %1, %1, %1, %1, %1
%6 = add nsw i32 %2, -87
br label %9
7: ; preds = %1
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 0)
br label %9
9: ; preds = %7, %5, %3
%10 = phi i32 [ undef, %7 ], [ %6, %5 ], [ %4, %3 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ ft_ft(int *);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int nbr;
  nbr = 3;
  printf("Before call, nbr: %i\n", nbr);
  ft_ft(&nbr);
  printf("After call, nbr: %i\n", nbr);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1040 <ft_ft@plt>
mov    -0x8(%rbp),%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x3,0x4(%rsp)
lea    0xed0(%rip),%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
lea    0x4(%rsp),%rdi
call   1040 <ft_ft@plt>
mov    0x4(%rsp),%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Before call, nbr: %i\0A\00"
@.str.1 = [21 x i8] c"After call, nbr: %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 3, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @ft_ft(i32* %2)
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Before call, nbr: %i\0A\00"
@.str.1 = [21 x i8] c"After call, nbr: %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 3, i32* %1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 3)
%4 = call i32 @ft_ft(i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
char *calloc(int, int);
char *copy_string(char *, char *);
char *prepend_string(char *add, char *base) {
  char *ret = calloc(4096, sizeof(char));
  copy_string(copy_string(ret, add), base);
  return ret;
}


x86 assembly (clang, -O0):
<prepend_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1000,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <copy_string@plt>
mov    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <copy_string@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prepend_string>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x1000,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <copy_string@plt>
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <copy_string@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @prepend_string(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = call i8* @calloc(i32 4096, i32 1)
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = load i8*, i8** %3
%9 = call i8* @copy_string(i8* %7, i8* %8)
%10 = load i8*, i8** %4
%11 = call i8* @copy_string(i8* %9, i8* %10)
%12 = load i8*, i8** %5
ret i8* %12
}

LLVM IR (-O2):
define i8* @prepend_string(i8* %0, i8* %1) {
%3 = tail call dereferenceable_or_null(4096) i8* @calloc(i32 4096, i32 1)
%4 = tail call i8* @copy_string(i8* %3, i8* %0)
%5 = tail call i8* @copy_string(i8* %4, i8* %1)
ret i8* %3
}
/* Variables and functions */
int send_message(size_t, int /*<<< orphan*/ *, int /*<<< orphan*/);
int continue_send(size_t conn) { return send_message(conn, NULL, 0); }


x86 assembly (clang, -O0):
<continue_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1030 <send_message@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @continue_send(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @send_message(i64 %3, i32* null, i32 0)
ret i32 %4
}

LLVM IR (-O2):
define i32 @continue_send(i64 %0) {
%2 = tail call i32 @send_message(i64 %0, i32* null, i32 0)
ret i32 %2
}
double f4_sum_pre_double_long(double v0, long v) { return v0 + ((double)(v)); }


x86 assembly (clang, -O0):
<f4_sum_pre_double_long>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4_sum_pre_double_long>:
cvtsi2sd %rdi,%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @f4_sum_pre_double_long(double %0, i64 %1) {
%3 = alloca double
%4 = alloca i64
store double %0, double* %3
store i64 %1, i64* %4
%5 = load double, double* %3
%6 = load i64, i64* %4
%7 = sitofp i64 %6 to double
%8 = fadd double %5, %7
ret double %8
}

LLVM IR (-O2):
define double @f4_sum_pre_double_long(double %0, i64 %1) {
%3 = sitofp i64 %1 to double
%4 = fadd double %3, %0
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ qs(int *, int /*<<< orphan*/, int);
void quicksort(int array[], int n) { qs(array, 0, n - 1); }


x86 assembly (clang, -O0):
<quicksort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <qs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicksort>:
lea    -0x1(%rsi),%edx
xor    %esi,%esi
jmp    1030 <qs@plt>

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

LLVM IR (-O2):
define void @quicksort(i32* %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = tail call i32 @qs(i32* %0, i32 0, i32 %3)
ret void
}
unsigned char check_range_reg_in(int start, int end) { return 1; }


x86 assembly (clang, -O0):
<check_range_reg_in>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define zeroext i8 @check_range_reg_in(i32 %0, i32 %1) {
ret i8 1
}
/* Variables and functions */
unsigned char getchar();
unsigned char getch() { return getchar(); }


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

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

LLVM IR (-O0):
define zeroext i8 @getch() {
%1 = call zeroext i8 (...) @getchar()
ret i8 %1
}

LLVM IR (-O2):
define zeroext i8 @getch() {
%1 = tail call zeroext i8 (...) @getchar()
ret i8 %1
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *catstr(char *dir, char *file) {
  char *fullname = malloc(strlen(dir) + strlen(file) + 2);
  strcpy(fullname, dir);
  strcat(fullname, file);
  return fullname;
}


x86 assembly (clang, -O0):
<catstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
add    %rax,%rdi
add    $0x2,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<catstr>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    (%r15,%rax,1),%rdi
add    $0x2,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @catstr(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
%7 = call i64 @strlen(i8* %6)
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
%10 = add nsw i64 %7, %9
%11 = add nsw i64 %10, 2
%12 = call i8* @malloc(i64 %11)
store i8* %12, i8** %5
%13 = load i8*, i8** %5
%14 = load i8*, i8** %3
%15 = call i32 @strcpy(i8* %13, i8* %14)
%16 = load i8*, i8** %5
%17 = load i8*, i8** %4
%18 = call i32 @strcat(i8* %16, i8* %17)
%19 = load i8*, i8** %5
ret i8* %19
}

LLVM IR (-O2):
define i8* @catstr(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add i64 %3, 2
%6 = add i64 %5, %4
%7 = tail call i8* @malloc(i64 %6)
%8 = tail call i32 @strcpy(i8* %7, i8* %0)
%9 = tail call i32 @strcat(i8* %7, i8* %1)
ret i8* %7
}
const char *TA_GetVersionTime(void) { return "19:27:03"; }


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

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

LLVM IR (-O0):
@.str = [9 x i8] c"19:27:03\00"
define i8* @TA_GetVersionTime() {
ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [9 x i8] c"19:27:03\00"
define i8* @TA_GetVersionTime() {
ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ dup(int);
int t_dummies() {
  int fildes;
  fildes = 3;
  dup(fildes);
}


x86 assembly (clang, -O0):
<t_dummies>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x3,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <dup@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_dummies>:
mov    $0x3,%edi
jmp    1030 <dup@plt>

LLVM IR (-O0):
define i32 @t_dummies() {
%1 = alloca i32
%2 = alloca i32
store i32 3, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @dup(i32 %3)
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
define i32 @t_dummies() {
%1 = tail call i32 @dup(i32 3)
ret i32 undef
}
/* Type definitions */
struct dentry {
  int dummy;
};

/* Variables and functions */
int destroy_dentry(struct dentry *);
int dentry_unlink(struct dentry *dentry) { return destroy_dentry(dentry); }


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

x86 assembly (clang, -O2):
<dentry_unlink>:
jmp    1030 <destroy_dentry@plt>

LLVM IR (-O0):
%struct.dentry = type { i32 }
define i32 @dentry_unlink(%struct.dentry* %0) {
%2 = alloca %struct.dentry*
store %struct.dentry* %0, %struct.dentry** %2
%3 = load %struct.dentry*, %struct.dentry** %2
%4 = call i32 @destroy_dentry(%struct.dentry* %3)
ret i32 %4
}

LLVM IR (-O2):
%struct.dentry = type { i32 }
define i32 @dentry_unlink(%struct.dentry* %0) {
%2 = tail call i32 @destroy_dentry(%struct.dentry* %0)
ret i32 %2
}