xunge/DecIR huggingface dataset:
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1138 <gcd+0x28>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1152 <gcd+0x42>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
cqto
idivq  -0x18(%rbp)
mov    %rdx,%rsi
call   1030 <gcd@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %rdi,%rax
test   %rsi,%rsi
je     1135 <gcd+0x35>
mov    %rsi,%rdx
jmp    111d <gcd+0x1d>
nopl   (%rax)
cqto
idiv   %rcx
mov    %rcx,%rax
test   %rdx,%rdx
je     1132 <gcd+0x32>
mov    %rdx,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
jne    1110 <gcd+0x10>
xor    %edx,%edx
div    %ecx
jmp    1115 <gcd+0x15>
mov    %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @gcd(i64 %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %7, %4 ], [ %1, %2 ]
%6 = phi i64 [ %5, %4 ], [ %0, %2 ]
%7 = srem i64 %6, %5
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i64 [ %0, %2 ], [ %5, %4 ]
ret i64 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ OCSP_BASICRESP;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
int /*<<< orphan*/ ASN1_item_free(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ OCSP_BASICRESP_it;
void OCSP_BASICRESP_free(OCSP_BASICRESP *a) {
  ASN1_item_free((ASN1_VALUE *)a, &OCSP_BASICRESP_it);
}


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

x86 assembly (clang, -O2):
<OCSP_BASICRESP_free>:
mov    0x2ed1(%rip),%rsi
jmp    1030 <ASN1_item_free@plt>

LLVM IR (-O0):
@OCSP_BASICRESP_it = global i32 0
define void @OCSP_BASICRESP_free(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @ASN1_item_free(i32* %3, i32* @OCSP_BASICRESP_it)
ret void
}

LLVM IR (-O2):
@OCSP_BASICRESP_it = global i32 0
define void @OCSP_BASICRESP_free(i32* %0) {
%2 = tail call i32 @ASN1_item_free(i32* %0, i32* @OCSP_BASICRESP_it)
ret void
}
void turn_left(int *ant_pos) { ant_pos[2] = (ant_pos[2] - 1) & 3; }


x86 assembly (clang, -O0):
<turn_left>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%ecx
sub    $0x1,%ecx
and    $0x3,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<turn_left>:
mov    0x8(%rdi),%eax
add    $0xffffffff,%eax
and    $0x3,%eax
mov    %eax,0x8(%rdi)
ret

LLVM IR (-O0):
define void @turn_left(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 2
%5 = load i32, i32* %4
%6 = sub nsw i32 %5, 1
%7 = and i32 %6, 3
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 2
store i32 %7, i32* %9
ret void
}

LLVM IR (-O2):
define void @turn_left(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load i32, i32* %2
%4 = add i32 %3, 3
%5 = and i32 %4, 3
store i32 %5, i32* %2
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int portin(int);
uint16_t portin16(uint16_t portnum) {
  return ((uint16_t)portin(portnum) | (uint16_t)(portin(portnum + 1) << 8));
}


x86 assembly (clang, -O0):
<portin16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <portin@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
add    $0x1,%edi
call   1030 <portin@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
shl    $0x8,%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<portin16>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1030 <portin@plt>
mov    %eax,%ebp
add    $0x1,%ebx
mov    %ebx,%edi
call   1030 <portin@plt>
shl    $0x8,%eax
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @portin16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @portin(i32 %3)
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
%7 = call i32 @portin(i32 %6)
%8 = shl i32 %7, 8
%9 = or i32 %4, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @portin16(i32 %0) {
%2 = tail call i32 @portin(i32 %0)
%3 = add nsw i32 %0, 1
%4 = tail call i32 @portin(i32 %3)
%5 = shl i32 %4, 8
%6 = or i32 %5, %2
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ pciconfig_read(unsigned char, unsigned char, unsigned int,
                                  int, unsigned long *);
long pci_config_read_long(unsigned char bus, unsigned char dev, int func,
                          unsigned cmd) {
  unsigned long retval;
  pciconfig_read(bus, dev << 3, cmd, 4, &retval);
  return retval;
}


x86 assembly (clang, -O0):
<pci_config_read_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    %edx,-0x8(%rbp)
mov    %ecx,-0xc(%rbp)
mov    -0x1(%rbp),%sil
movzbl -0x2(%rbp),%eax
shl    $0x3,%eax
mov    -0xc(%rbp),%edx
mov    $0x4,%ecx
lea    -0x18(%rbp),%r8
movzbl %sil,%edi
movzbl %al,%esi
call   1030 <pciconfig_read@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pci_config_read_long>:
push   %rax
shl    $0x3,%sil
movzbl %sil,%esi
mov    %rsp,%r8
mov    %ecx,%edx
mov    $0x4,%ecx
call   1030 <pciconfig_read@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @pci_config_read_long(i8 zeroext %0, i8 zeroext %1, i32 %2, i32 %3) {
%5 = alloca i8
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
store i8 %0, i8* %5
store i8 %1, i8* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i8, i8* %5
%11 = load i8, i8* %6
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 3
%14 = trunc i32 %13 to i8
%15 = load i32, i32* %8
%16 = call i32 @pciconfig_read(i8 zeroext %10, i8 zeroext %14, i32 %15, i32 4, i64* %9)
%17 = load i64, i64* %9
ret i64 %17
}

LLVM IR (-O2):
define i64 @pci_config_read_long(i8 zeroext %0, i8 zeroext %1, i32 %2, i32 %3) {
%5 = alloca i64
%6 = bitcast i64* %5 to i8*
%7 = shl i8 %1, 3
%8 = call i32 @pciconfig_read(i8 zeroext %0, i8 zeroext %7, i32 %3, i32 4, i64* %5)
%9 = load i64, i64* %5
ret i64 %9
}
void BGRAToUVRow_Any_SSSE3() {}


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

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

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

LLVM IR (-O2):
define void @BGRAToUVRow_Any_SSSE3() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_array(int n, int *ar) {
  for (int i = 0; i < n; i++) {
    printf("%d ", ar[i]);
  }
}


x86 assembly (clang, -O0):
<print_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1157 <print_array+0x47>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <print_array+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1145 <print_array+0x35>
mov    %rsi,%r15
mov    %edi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <print_array+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define void @print_array(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %4
%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 @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
ret void
}

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


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

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

LLVM IR (-O0):
define i32 @WebPGetDemuxVersion() {
ret i32 514
}

LLVM IR (-O2):
define i32 @WebPGetDemuxVersion() {
ret i32 514
}
/* Variables and functions */
float lin_inter(float, float, float);
float smooth_inter(float x, float y, float s) {
  return (lin_inter(x, y, s * s * (3 - 2 * s)));
}


x86 assembly (clang, -O0):
<smooth_inter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
mulss  -0xc(%rbp),%xmm2
movss  -0xc(%rbp),%xmm4
addss  %xmm4,%xmm4
movss  0xeb4(%rip),%xmm3
subss  %xmm4,%xmm3
mulss  %xmm3,%xmm2
call   1030 <lin_inter@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smooth_inter>:
movaps %xmm2,%xmm4
mulss  %xmm2,%xmm4
addss  %xmm2,%xmm2
movss  0xedd(%rip),%xmm3
subss  %xmm2,%xmm3
mulss  %xmm4,%xmm3
movaps %xmm3,%xmm2
jmp    1030 <lin_inter@plt>

LLVM IR (-O0):
define float @smooth_inter(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = load float, float* %6
%10 = load float, float* %6
%11 = fmul float %9, %10
%12 = load float, float* %6
%13 = call float @llvm.fmuladd.f32(float -2.000000e+00, float %12, float 3.000000e+00)
%14 = fmul float %11, %13
%15 = call float @lin_inter(float %7, float %8, float %14)
ret float %15
}

LLVM IR (-O2):
define float @smooth_inter(float %0, float %1, float %2) {
%4 = fmul float %2, %2
%5 = tail call float @llvm.fmuladd.f32(float %2, float -2.000000e+00, float 3.000000e+00)
%6 = fmul float %4, %5
%7 = tail call float @lin_inter(float %0, float %1, float %6)
ret float %7
}
/* Variables and functions */
int /*<<< orphan*/ printmsg(char *, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char *);
void printturn(int turn) {
  char msg[80];
  sprintf(msg, "It's %s's turn",
          turn ? "\x1b[31m"
                 "\x1b[1m"
                 "red"
                 "\x1b[0m"
               : "\x1b[32m"
                 "\x1b[1m"
                 "green"
                 "\x1b[0m");
  printmsg(msg, 0);
}


x86 assembly (clang, -O0):
<printturn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x4(%rbp),%ecx
lea    0xee7(%rip),%rdx
lea    0xecf(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xeb2(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
call   1030 <printmsg@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printturn>:
push   %rbx
sub    $0x50,%rsp
test   %edi,%edi
lea    0xef2(%rip),%rax
lea    0xeda(%rip),%rdx
cmove  %rax,%rdx
lea    0xec0(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printmsg@plt>
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"It's %s's turn\00"
@.str.1 = [17 x i8] c"\1B[31m\1B[1mred\1B[0m\00"
@.str.2 = [19 x i8] c"\1B[32m\1B[1mgreen\1B[0m\00"
define void @printturn(i32 %0) {
%2 = alloca i32
%3 = alloca [80 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0)
%9 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%11 = call i32 @printmsg(i8* %10, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"It's %s's turn\00"
@.str.1 = [17 x i8] c"\1B[31m\1B[1mred\1B[0m\00"
@.str.2 = [19 x i8] c"\1B[32m\1B[1mgreen\1B[0m\00"
define void @printturn(i32 %0) {
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0)
%6 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = call i32 @printmsg(i8* %3, i32 0)
ret void
}
double OP_BitOr(double op1, double op2) {
  return (double)((long int)op1 | (long int)op2);
}


x86 assembly (clang, -O0):
<OP_BitOr>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
cvttsd2si -0x8(%rbp),%rax
cvttsd2si -0x10(%rbp),%rcx
or     %rcx,%rax
cvtsi2sd %rax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<OP_BitOr>:
cvttsd2si %xmm0,%rax
cvttsd2si %xmm1,%rcx
or     %rax,%rcx
xorps  %xmm0,%xmm0
cvtsi2sd %rcx,%xmm0
ret

LLVM IR (-O0):
define double @OP_BitOr(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 = fptosi double %5 to i64
%7 = load double, double* %4
%8 = fptosi double %7 to i64
%9 = or i64 %6, %8
%10 = sitofp i64 %9 to double
ret double %10
}

LLVM IR (-O2):
define double @OP_BitOr(double %0, double %1) {
%3 = fptosi double %0 to i64
%4 = fptosi double %1 to i64
%5 = or i64 %4, %3
%6 = sitofp i64 %5 to double
ret double %6
}
/* Variables and functions */
bool is_channel(const char *channel) {
  return *channel == '#' || *channel == '+' || *channel == '!' ||
         *channel == '&';
}


x86 assembly (clang, -O0):
<is_channel>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x23,%ecx
mov    %al,-0x9(%rbp)
je     1157 <is_channel+0x57>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x2b,%ecx
mov    %al,-0x9(%rbp)
je     1157 <is_channel+0x57>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x21,%ecx
mov    %al,-0x9(%rbp)
je     1157 <is_channel+0x57>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x26,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_channel>:
movzbl (%rdi),%ecx
cmp    $0x2b,%rcx
ja     111f <is_channel+0x1f>
mov    $0x1,%eax
movabs $0x80a00000000,%rdx
bt     %rcx,%rdx
jae    111f <is_channel+0x1f>
ret
xor    %eax,%eax
cmp    $0x26,%cl
sete   %al
ret

LLVM IR (-O0):
define i32 @is_channel(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 35
br i1 %6, label %22, label %7
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 43
br i1 %11, label %22, label %12
12: ; preds = %7
%13 = load i8*, i8** %2
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 33
br i1 %16, label %22, label %17
17: ; preds = %12
%18 = load i8*, i8** %2
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 38
br label %22
22: ; preds = %17, %12, %7, %1
%23 = phi i1 [ true, %12 ], [ true, %7 ], [ true, %1 ], [ %21, %17 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @is_channel(i8* nocapture %0) {
%2 = load i8, i8* %0
switch i8 %2, label %3 [
i8 35, label %6
i8 43, label %6
i8 33, label %6
]
3: ; preds = %1
%4 = icmp eq i8 %2, 38
%5 = zext i1 %4 to i32
br label %6
6: ; preds = %1, %1, %1, %3
%7 = phi i32 [ 1, %1 ], [ %5, %3 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %7
}
int fn1(int a, int b) {
  int tem1 = a & b;
  int tem2 = a ^ b;
  return tem1 | tem2;
}


x86 assembly (clang, -O0):
<fn1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
or     -0x10(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fn1(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = and i32 %7, %8
store i32 %9, i32* %5
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = xor i32 %10, %11
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = or i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @fn1(i32 %0, i32 %1) {
%3 = or i32 %1, %0
ret i32 %3
}
int hash(int key, unsigned int size) { return key % size; }


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    %edi,%eax
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @hash(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 = urem i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @hash(i32 %0, i32 %1) {
%3 = urem i32 %0, %1
ret i32 %3
}
/* Variables and functions */
int detectPresence(char *);
scalar_t__ graphicMode();
int qarmaPresent() {
  static int lQarmaPresent = -1;
  if (lQarmaPresent < 0) {
    lQarmaPresent = detectPresence("qarma");
  }
  return lQarmaPresent && graphicMode();
}


x86 assembly (clang, -O0):
<qarmaPresent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cmpl   $0x0,0x2f01(%rip)
jge    1147 <qarmaPresent+0x27>
lea    0xec4(%rip),%rdi
call   1040 <detectPresence@plt>
mov    %eax,0x2ee9(%rip)
xor    %eax,%eax
cmpl   $0x0,0x2ee0(%rip)
mov    %al,-0x1(%rbp)
je     116a <qarmaPresent+0x4a>
mov    $0x0,%al
call   1030 <graphicMode@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qarmaPresent>:
push   %rax
mov    0x2f09(%rip),%eax
test   %eax,%eax
js     1143 <qarmaPresent+0x23>
test   %eax,%eax
je     1159 <qarmaPresent+0x39>
xor    %eax,%eax
call   1030 <graphicMode@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret
lea    0xeb6(%rip),%rdi
call   1040 <detectPresence@plt>
mov    %eax,0x2edb(%rip)
test   %eax,%eax
jne    112f <qarmaPresent+0xf>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@qarmaPresent.lQarmaPresent = internal global i32 -1
@.str = [6 x i8] c"qarma\00"
define i32 @qarmaPresent() {
%1 = load i32, i32* @qarmaPresent.lQarmaPresent
%2 = icmp slt i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @detectPresence(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %4, i32* @qarmaPresent.lQarmaPresent
br label %5
5: ; preds = %3, %0
%6 = load i32, i32* @qarmaPresent.lQarmaPresent
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = call i64 (...) @graphicMode()
%10 = icmp ne i64 %9, 0
br label %11
11: ; preds = %8, %5
%12 = phi i1 [ false, %5 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
@qarmaPresent.lQarmaPresent = internal unnamed_addr global i32 -1
@.str = [6 x i8] c"qarma\00"
define i32 @qarmaPresent() {
%1 = load i32, i32* @qarmaPresent.lQarmaPresent
%2 = icmp slt i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @detectPresence(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %4, i32* @qarmaPresent.lQarmaPresent
br label %5
5: ; preds = %3, %0
%6 = phi i32 [ %4, %3 ], [ %1, %0 ]
%7 = icmp eq i32 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %5
%9 = tail call i64 (...) @graphicMode()
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %8, %5
%13 = phi i32 [ 0, %5 ], [ %11, %8 ]
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ x;

/* Variables and functions */
int clzl(unsigned long);
unsigned long round_up_to_power_of_2(unsigned long x) {
  return 1UL << ((sizeof(x) << 3) - clzl(x - 1UL));
}


x86 assembly (clang, -O0):
<round_up_to_power_of_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
sub    $0x1,%rdi
call   1030 <clzl@plt>
cltq
mov    $0x40,%ecx
sub    %rax,%rcx
mov    $0x1,%eax
shl    %cl,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_up_to_power_of_2>:
push   %rax
add    $0xffffffffffffffff,%rdi
call   1030 <clzl@plt>
neg    %al
mov    $0x1,%edx
mov    %eax,%ecx
shl    %cl,%rdx
mov    %rdx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @round_up_to_power_of_2(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sub i64 %3, 1
%5 = call i32 @clzl(i64 %4)
%6 = sext i32 %5 to i64
%7 = sub i64 64, %6
%8 = shl i64 1, %7
ret i64 %8
}

LLVM IR (-O2):
define i64 @round_up_to_power_of_2(i64 %0) {
%2 = add i64 %0, -1
%3 = tail call i32 @clzl(i64 %2)
%4 = sext i32 %3 to i64
%5 = sub nsw i64 64, %4
%6 = shl nuw i64 1, %5
ret i64 %6
}
unsigned max(unsigned a, unsigned b) {
  if (a > b)
    return a;
  return b;
}


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jbe    1121 <max+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <max+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
mov    %esi,%eax
cmp    %esi,%edi
cmova  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @max(i32 %0, i32 %1) {
%3 = icmp ugt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int detect();
int /*<<< orphan*/ printf(char *);
void get_subarchitecture(void) {
  if (detect() == 2) {
    printf("LOONGSON3A");
  } else if (detect() == 3) {
    printf("LOONGSON3B");
  } else {
    printf("SICORTEX");
  }
}


x86 assembly (clang, -O0):
<get_subarchitecture>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <detect@plt>
cmp    $0x2,%eax
jne    1145 <get_subarchitecture+0x25>
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
jmp    1177 <get_subarchitecture+0x57>
mov    $0x0,%al
call   1040 <detect@plt>
cmp    $0x3,%eax
jne    1166 <get_subarchitecture+0x46>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
jmp    1172 <get_subarchitecture+0x52>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
jmp    1177 <get_subarchitecture+0x57>
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_subarchitecture>:
push   %rax
xor    %eax,%eax
call   1040 <detect@plt>
cmp    $0x2,%eax
jne    113a <get_subarchitecture+0x1a>
lea    0xecc(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>
xor    %eax,%eax
call   1040 <detect@plt>
cmp    $0x3,%eax
lea    0xec0(%rip),%rax
lea    0xec4(%rip),%rdi
cmove  %rax,%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"LOONGSON3A\00"
@.str.1 = [11 x i8] c"LOONGSON3B\00"
@.str.2 = [9 x i8] c"SICORTEX\00"
define void @get_subarchitecture() {
%1 = call i32 (...) @detect()
%2 = icmp eq i32 %1, 2
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %13
5: ; preds = %0
%6 = call i32 (...) @detect()
%7 = icmp eq i32 %6, 3
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %12
10: ; preds = %5
%11 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
br label %13
13: ; preds = %12, %3
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"LOONGSON3A\00"
@.str.1 = [11 x i8] c"LOONGSON3B\00"
@.str.2 = [9 x i8] c"SICORTEX\00"
define void @get_subarchitecture() {
%1 = tail call i32 (...) @detect()
%2 = icmp eq i32 %1, 2
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = tail call i32 (...) @detect()
%5 = icmp eq i32 %4, 3
%6 = select i1 %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0)
br label %7
7: ; preds = %3, %0
%8 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %0 ], [ %6, %3 ]
%9 = tail call i32 @printf(i8* dereferenceable(1) %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("hello world\n");
  return -1;
}


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"hello world\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@str = [12 x i8] c"hello world\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 -1
}
/* Variables and functions */
unsigned int _mm_getcsr();
unsigned int getSSEStateX86(void) { return _mm_getcsr(); }


x86 assembly (clang, -O0):
<getSSEStateX86>:
push   %rbp
mov    %rsp,%rbp
lea    -0x4(%rbp),%rax
stmxcsr (%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSSEStateX86>:
stmxcsr -0x4(%rsp)
mov    -0x4(%rsp),%eax
ret

LLVM IR (-O0):
define i32 @getSSEStateX86() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @getSSEStateX86() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = load i32, i32* %1
ret i32 %3
}
/* Variables and functions */
int MAP_ANONYMOUS;
int MAP_PRIVATE;
int PROT_READ;
int PROT_WRITE;
void *mmap(int /*<<< orphan*/ *, size_t, int, int, int, int /*<<< orphan*/);
void *memhook_test_lib_call_mmap(size_t size) {
  return mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS,
              -1, 0);
}


x86 assembly (clang, -O0):
<memhook_test_lib_call_mmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    0x2ed1(%rip),%rax
mov    (%rax),%edx
mov    0x2ea0(%rip),%rax
or     (%rax),%edx
mov    0x2e8f(%rip),%rax
mov    (%rax),%ecx
mov    0x2e9e(%rip),%rax
or     (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1030 <mmap@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memhook_test_lib_call_mmap>:
mov    0x2ee1(%rip),%rax
mov    0x2eb2(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2e9f(%rip),%rax
mov    0x2eb0(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %rdi,%rsi
xor    %edi,%edi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
jmp    1030 <mmap@plt>

LLVM IR (-O0):
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_ANONYMOUS = global i32 0
define i8* @memhook_test_lib_call_mmap(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = load i32, i32* @PROT_READ
%5 = load i32, i32* @PROT_WRITE
%6 = or i32 %4, %5
%7 = load i32, i32* @MAP_PRIVATE
%8 = load i32, i32* @MAP_ANONYMOUS
%9 = or i32 %7, %8
%10 = call i8* @mmap(i32* null, i64 %3, i32 %6, i32 %9, i32 -1, i32 0)
ret i8* %10
}

LLVM IR (-O2):
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_ANONYMOUS = global i32 0
define i8* @memhook_test_lib_call_mmap(i64 %0) {
%2 = load i32, i32* @PROT_READ
%3 = load i32, i32* @PROT_WRITE
%4 = or i32 %3, %2
%5 = load i32, i32* @MAP_PRIVATE
%6 = load i32, i32* @MAP_ANONYMOUS
%7 = or i32 %6, %5
%8 = tail call i8* @mmap(i32* null, i64 %0, i32 %4, i32 %7, i32 -1, i32 0)
ret i8* %8
}
/* Type definitions */
typedef int /*<<< orphan*/ A;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int threeSumClosest(int *, int, int);
int main(int argc, char **argv) {
  int A[] = {1, 2, 4, 8, 16, 32, 64, 128};
  printf("input%d output:%d \n", 82,
         threeSumClosest(A, sizeof(A) / sizeof(int), 82));
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x8,%esi
mov    $0x52,%edx
call   1030 <threeSumClosest@plt>
mov    %eax,%edx
lea    0xea2(%rip),%rdi
mov    $0x52,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x8,%esi
mov    $0x52,%edx
call   1030 <threeSumClosest@plt>
lea    0xecc(%rip),%rdi
mov    $0x52,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.A = [8 x i32] [i32 1, i32 2, i32 4, i32 8, i32 16, i32 32, i32 64, i32 128]
@.str = [20 x i8] c"input%d output:%d \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [8 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [8 x i32]* %6 to i8*
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%9 = call i32 @threeSumClosest(i32* %8, i32 8, i32 82)
%10 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 82, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.A = [8 x i32] [i32 1, i32 2, i32 4, i32 8, i32 16, i32 32, i32 64, i32 128]
@.str = [20 x i8] c"input%d output:%d \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [8 x i32]
%4 = bitcast [8 x i32]* %3 to i8*
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%6 = call i32 @threeSumClosest(i32* %5, i32 8, i32 82)
%7 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 82, i32 %6)
ret i32 0
}
/* Variables and functions */
scalar_t__ calloc(int, int);
void *GC_malloc_atomic(int x) {
  void *p = (void *)calloc(sizeof(char), x);
  return p;
}


x86 assembly (clang, -O0):
<GC_malloc_atomic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x1,%edi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @GC_malloc_atomic(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i64 @calloc(i32 1, i32 %4)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %3
%7 = load i8*, i8** %3
ret i8* %7
}

LLVM IR (-O2):
define i8* @GC_malloc_atomic(i32 %0) {
%2 = tail call i64 @calloc(i32 1, i32 %0)
%3 = inttoptr i64 %2 to i8*
ret i8* %3
}
void call_interrupt(struct bootapp_callback_params *params) { (void)params; }


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

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

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

LLVM IR (-O2):
%struct.bootapp_callback_params = type opaque
define void @call_interrupt(%struct.bootapp_callback_params* nocapture %0) {
ret void
}
__attribute__((always_)) int devtmpfs_delete_node(struct device *dev) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.device = type opaque
define i32 @devtmpfs_delete_node(%struct.device* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
char *calloc(size_t, int);
int /*<<< orphan*/ strncpy(char *, char *, size_t);
char *strutil_substring(char *original, size_t start, size_t end) {
  char *substring = calloc((end - start) + 1, sizeof(char));
  strncpy(substring, original + start, end - start);
  return substring;
}


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

x86 assembly (clang, -O2):
<strutil_substring>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
sub    %rsi,%rbx
lea    0x1(%rbx),%rdi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%r12
add    %r14,%r15
mov    %rax,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <strncpy@plt>
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strutil_substring(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i64, i64* %6
%9 = load i64, i64* %5
%10 = sub i64 %8, %9
%11 = add i64 %10, 1
%12 = call i8* @calloc(i64 %11, i32 1)
store i8* %12, i8** %7
%13 = load i8*, i8** %7
%14 = load i8*, i8** %4
%15 = load i64, i64* %5
%16 = getelementptr inbounds i8, i8* %14, i64 %15
%17 = load i64, i64* %6
%18 = load i64, i64* %5
%19 = sub i64 %17, %18
%20 = call i32 @strncpy(i8* %13, i8* %16, i64 %19)
%21 = load i8*, i8** %7
ret i8* %21
}

LLVM IR (-O2):
define i8* @strutil_substring(i8* %0, i64 %1, i64 %2) {
%4 = sub i64 %2, %1
%5 = add i64 %4, 1
%6 = tail call i8* @calloc(i64 %5, i32 1)
%7 = getelementptr inbounds i8, i8* %0, i64 %1
%8 = tail call i32 @strncpy(i8* %6, i8* %7, i64 %4)
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ fork();
int main() {
  while (1)
    fork();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <fork@plt>
jmp    111f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <fork@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %2
%3 = call i32 (...) @fork()
br label %2
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 (...) @fork()
br label %1
}
/* Type definitions */
typedef scalar_t__ pid_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ kill(scalar_t__, int);
scalar_t__ waitpid(scalar_t__, int *, int /*<<< orphan*/);
int signal_and_wait(pid_t pid, int signal) {
  kill(pid, signal);
  int status;
  pid_t wpid = waitpid(pid, &status, 0);
  assert(wpid == pid);
  return status;
}


x86 assembly (clang, -O0):
<signal_and_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <kill@plt>
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1050 <waitpid@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signal_and_wait>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1040 <kill@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %edx,%edx
call   1050 <waitpid@plt>
xor    %edi,%edi
cmp    %rbx,%rax
sete   %dil
call   1030 <assert@plt>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @signal_and_wait(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
store i64 %0, i64* %3
store i32 %1, i32* %4
%7 = load i64, i64* %3
%8 = load i32, i32* %4
%9 = call i32 @kill(i64 %7, i32 %8)
%10 = load i64, i64* %3
%11 = call i64 @waitpid(i64 %10, i32* %5, i32 0)
store i64 %11, i64* %6
%12 = load i64, i64* %6
%13 = load i64, i64* %3
%14 = icmp eq i64 %12, %13
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load i32, i32* %5
ret i32 %17
}

LLVM IR (-O2):
define i32 @signal_and_wait(i64 %0, i32 %1) {
%3 = alloca i32
%4 = tail call i32 @kill(i64 %0, i32 %1)
%5 = bitcast i32* %3 to i8*
%6 = call i64 @waitpid(i64 %0, i32* %3, i32 0)
%7 = icmp eq i64 %6, %0
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i32, i32* %3
ret i32 %10
}
void wvline() {}


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

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

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

LLVM IR (-O2):
define void @wvline() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sleep(int);
void child_code(int i) {
  sleep(i);
  printf("Hello from child %d.\n", i);
  exit(i);
}


x86 assembly (clang, -O0):
<child_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <sleep@plt>
mov    -0x4(%rbp),%esi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<child_code>:
push   %rbx
mov    %edi,%ebx
call   1050 <sleep@plt>
lea    0xec1(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Hello from child %d.\0A\00"
define void @child_code(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @sleep(i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %2
%8 = call i32 @exit(i32 %7)
unreachable
}

LLVM IR (-O2):
@.str = [22 x i8] c"Hello from child %d.\0A\00"
define void @child_code(i32 %0) {
%2 = tail call i32 @sleep(i32 %0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %0)
%4 = tail call i32 @exit(i32 %0)
unreachable
}
int test_imm_AEint16_mem(short *val) {
  return ((*val) & (-0xAE << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_AEint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0xffffff52,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_AEint16_mem>:
movzwl (%rdi),%eax
test   $0xff52,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_AEint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -174
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void I420Interpolate() {}


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

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

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

LLVM IR (-O2):
define void @I420Interpolate() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ egg_secure_free_full(char *, int);
int /*<<< orphan*/ egg_secure_strclear(char *);
void egg_secure_strfree(char *str) {
  egg_secure_strclear(str);
  egg_secure_free_full(str, 0x0001);
}


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

x86 assembly (clang, -O2):
<egg_secure_strfree>:
push   %rbx
mov    %rdi,%rbx
call   1040 <egg_secure_strclear@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
pop    %rbx
jmp    1030 <egg_secure_free_full@plt>

LLVM IR (-O0):
define void @egg_secure_strfree(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @egg_secure_strclear(i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @egg_secure_free_full(i8* %5, i32 1)
ret void
}

LLVM IR (-O2):
define void @egg_secure_strfree(i8* %0) {
%2 = tail call i32 @egg_secure_strclear(i8* %0)
%3 = tail call i32 @egg_secure_free_full(i8* %0, i32 1)
ret void
}
unsigned char read_bit(unsigned char reg) { return ((reg & 0b00100000) >> 5); }


x86 assembly (clang, -O0):
<read_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x20,%eax
sar    $0x5,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_bit>:
mov    %edi,%eax
shr    $0x5,%al
and    $0x1,%al
ret

LLVM IR (-O0):
define zeroext i8 @read_bit(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, 32
%6 = ashr i32 %5, 5
%7 = trunc i32 %6 to i8
ret i8 %7
}

LLVM IR (-O2):
define zeroext i8 @read_bit(i8 zeroext %0) {
%2 = lshr i8 %0, 5
%3 = and i8 %2, 1
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Filip Piorski");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"Filip Piorski\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Filip Piorski\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *malloc(int);
int main(void) {
  int i;
  void *p = malloc(177);
  for (i = 0; i < 2; i++)
    free(p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xb1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1165 <main+0x45>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <main+0x24>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i8* @malloc(i32 177)
store i8* %4, i8** %3
store i32 0, i32* %2
br label %5
5: ; preds = %11, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %14
8: ; preds = %5
%9 = load i8*, i8** %3
%10 = call i32 @free(i8* %9)
br label %11
11: ; preds = %8
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %5
14: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call dereferenceable_or_null(177) i8* @malloc(i32 177)
%2 = tail call i32 @free(i8* %1)
%3 = tail call i32 @free(i8* %1)
ret i32 0
}