xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ OCSP_CRLID;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
int /*<<< orphan*/ ASN1_item_free(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ OCSP_CRLID_it;
void OCSP_CRLID_free(OCSP_CRLID *a) {
  ASN1_item_free((ASN1_VALUE *)a, &OCSP_CRLID_it);
}


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

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

LLVM IR (-O0):
@OCSP_CRLID_it = global i32 0
define void @OCSP_CRLID_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_CRLID_it)
ret void
}

LLVM IR (-O2):
@OCSP_CRLID_it = global i32 0
define void @OCSP_CRLID_free(i32* %0) {
%2 = tail call i32 @ASN1_item_free(i32* %0, i32* @OCSP_CRLID_it)
ret void
}
void TCPWM_1_RestoreConfig(void) {}


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

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

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

LLVM IR (-O2):
define void @TCPWM_1_RestoreConfig() {
ret void
}
/* Type definitions */
struct memorycontainer {
  int dummy;
};

/* Variables and functions */
struct memorycontainer *
createUnaryGeneralMathsExpression(struct memorycontainer *, int);
struct memorycontainer *
createCeilExpression(struct memorycontainer *expression) {
  return createUnaryGeneralMathsExpression(expression, 0x000B);
}


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

x86 assembly (clang, -O2):
<createCeilExpression>:
mov    $0xb,%esi
jmp    1030 <createUnaryGeneralMathsExpression@plt>

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

LLVM IR (-O2):
%struct.memorycontainer = type { i32 }
define %struct.memorycontainer* @createCeilExpression(%struct.memorycontainer* %0) {
%2 = tail call %struct.memorycontainer* @createUnaryGeneralMathsExpression(%struct.memorycontainer* %0, i32 11)
ret %struct.memorycontainer* %2
}
void test_6792488(void) { int x = 0x3ff0000000000000U; }


x86 assembly (clang, -O0):
<test_6792488>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @test_6792488() {
ret void
}
/* Variables and functions */
int mystery(unsigned int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, unsigned int *);
int main() {
  unsigned x;
  printf("Enter an integer: ");
  scanf("%u", &x);
  printf("The result is %d\n", mystery(x));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1050 <mystery@plt>
mov    %eax,%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edi
call   1050 <mystery@plt>
lea    0xeb6(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter an integer: \00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [18 x i8] c"The result is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = call i32 @mystery(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter an integer: \00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [18 x i8] c"The result is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @mystery(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char s[100];
  scanf("%s", s);
  printf("%s", s);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
lea    0xed2(%rip),%rbx
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
void pathconN_nm7_decref(void) {}


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

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

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

LLVM IR (-O2):
define void @pathconN_nm7_decref() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ supcon_putp(unsigned int, char);
void supcon_putx(unsigned int num) { supcon_putp(num, 'a'); }


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

x86 assembly (clang, -O2):
<supcon_putx>:
mov    $0x61,%esi
jmp    1030 <supcon_putp@plt>

LLVM IR (-O0):
define void @supcon_putx(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @supcon_putp(i32 %3, i8 signext 97)
ret void
}

LLVM IR (-O2):
define void @supcon_putx(i32 %0) {
%2 = tail call i32 @supcon_putp(i32 %0, i8 signext 97)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ RecursiveReturn();
int /*<<< orphan*/ TXTOUT(char *);
void EndLIST() {
  TXTOUT("@end itemize\n");
  RecursiveReturn();
}


x86 assembly (clang, -O0):
<EndLIST>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <TXTOUT@plt>
mov    $0x0,%al
call   1040 <RecursiveReturn@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<EndLIST>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <TXTOUT@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <RecursiveReturn@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"@end itemize\0A\00"
define void @EndLIST() {
%1 = call i32 @TXTOUT(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @RecursiveReturn()
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"@end itemize\0A\00"
define void @EndLIST() {
%1 = tail call i32 @TXTOUT(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @RecursiveReturn()
ret void
}
long long f7(void) {
  unsigned int a = 0x80000000;
  return (a & 0x80000000) ? 0x380000000LL : 0LL;
}


x86 assembly (clang, -O0):
<f7>:
push   %rbp
mov    %rsp,%rbp
movl   $0x80000000,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x80000000,%edx
xor    %eax,%eax
movabs $0x380000000,%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f7>:
movabs $0x380000000,%rax
ret

LLVM IR (-O0):
define i64 @f7() {
%1 = alloca i32
store i32 -2147483648, i32* %1
%2 = load i32, i32* %1
%3 = and i32 %2, -2147483648
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i64 15032385536, i64 0
ret i64 %6
}

LLVM IR (-O2):
define i64 @f7() {
ret i64 15032385536
}
int main(void) {
  while (1)
    ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
jmp    110b <main+0xb>

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

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

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
br label %1
}
float add10(float n, float m, int a, int b, float o, float p, int c, int d,
            float q, float k) {
  return n + m + a + b + o + p + c + d + q + k;
}


x86 assembly (clang, -O0):
<add10>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  %xmm3,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
movss  %xmm4,-0x24(%rbp)
movss  %xmm5,-0x28(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
addss  %xmm1,%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
addss  %xmm1,%xmm0
addss  -0x14(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
cvtsi2ssl -0x1c(%rbp),%xmm1
addss  %xmm1,%xmm0
cvtsi2ssl -0x20(%rbp),%xmm1
addss  %xmm1,%xmm0
addss  -0x24(%rbp),%xmm0
addss  -0x28(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<add10>:
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2ss %edi,%xmm1
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2ss %esi,%xmm1
addss  %xmm1,%xmm0
addss  %xmm2,%xmm0
xorps  %xmm1,%xmm1
cvtsi2ss %edx,%xmm1
addss  %xmm3,%xmm0
xorps  %xmm2,%xmm2
cvtsi2ss %ecx,%xmm2
addss  %xmm1,%xmm0
addss  %xmm2,%xmm0
addss  %xmm4,%xmm0
addss  %xmm5,%xmm0
ret

LLVM IR (-O0):
define float @add10(float %0, float %1, i32 %2, i32 %3, float %4, float %5, i32 %6, i32 %7, float %8, float %9) {
%11 = alloca float
%12 = alloca float
%13 = alloca i32
%14 = alloca i32
%15 = alloca float
%16 = alloca float
%17 = alloca i32
%18 = alloca i32
%19 = alloca float
%20 = alloca float
store float %0, float* %11
store float %1, float* %12
store i32 %2, i32* %13
store i32 %3, i32* %14
store float %4, float* %15
store float %5, float* %16
store i32 %6, i32* %17
store i32 %7, i32* %18
store float %8, float* %19
store float %9, float* %20
%21 = load float, float* %11
%22 = load float, float* %12
%23 = fadd float %21, %22
%24 = load i32, i32* %13
%25 = sitofp i32 %24 to float
%26 = fadd float %23, %25
%27 = load i32, i32* %14
%28 = sitofp i32 %27 to float
%29 = fadd float %26, %28
%30 = load float, float* %15
%31 = fadd float %29, %30
%32 = load float, float* %16
%33 = fadd float %31, %32
%34 = load i32, i32* %17
%35 = sitofp i32 %34 to float
%36 = fadd float %33, %35
%37 = load i32, i32* %18
%38 = sitofp i32 %37 to float
%39 = fadd float %36, %38
%40 = load float, float* %19
%41 = fadd float %39, %40
%42 = load float, float* %20
%43 = fadd float %41, %42
ret float %43
}

LLVM IR (-O2):
define float @add10(float %0, float %1, i32 %2, i32 %3, float %4, float %5, i32 %6, i32 %7, float %8, float %9) {
%11 = fadd float %0, %1
%12 = sitofp i32 %2 to float
%13 = fadd float %11, %12
%14 = sitofp i32 %3 to float
%15 = fadd float %13, %14
%16 = fadd float %15, %4
%17 = fadd float %16, %5
%18 = sitofp i32 %6 to float
%19 = fadd float %17, %18
%20 = sitofp i32 %7 to float
%21 = fadd float %19, %20
%22 = fadd float %21, %8
%23 = fadd float %22, %9
ret float %23
}
/* Type definitions */
struct kvm_userspace_memory_region {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ KVM_SET_USER_MEMORY_REGION;
int ioctl(int, int /*<<< orphan*/, struct kvm_userspace_memory_region const *);
int kvm_set_user_memory_region(
    int fd, const struct kvm_userspace_memory_region *region) {
  return ioctl(fd, KVM_SET_USER_MEMORY_REGION, region);
}


x86 assembly (clang, -O0):
<kvm_set_user_memory_region>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb7(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rdx
call   1030 <ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kvm_set_user_memory_region>:
mov    %rsi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%esi
jmp    1030 <ioctl@plt>

LLVM IR (-O0):
%struct.kvm_userspace_memory_region = type { i32 }
@KVM_SET_USER_MEMORY_REGION = global i32 0
define i32 @kvm_set_user_memory_region(i32 %0, %struct.kvm_userspace_memory_region* %1) {
%3 = alloca i32
%4 = alloca %struct.kvm_userspace_memory_region*
store i32 %0, i32* %3
store %struct.kvm_userspace_memory_region* %1, %struct.kvm_userspace_memory_region** %4
%5 = load i32, i32* %3
%6 = load i32, i32* @KVM_SET_USER_MEMORY_REGION
%7 = load %struct.kvm_userspace_memory_region*, %struct.kvm_userspace_memory_region** %4
%8 = call i32 @ioctl(i32 %5, i32 %6, %struct.kvm_userspace_memory_region* %7)
ret i32 %8
}

LLVM IR (-O2):
%struct.kvm_userspace_memory_region = type { i32 }
@KVM_SET_USER_MEMORY_REGION = global i32 0
define i32 @kvm_set_user_memory_region(i32 %0, %struct.kvm_userspace_memory_region* %1) {
%3 = load i32, i32* @KVM_SET_USER_MEMORY_REGION
%4 = tail call i32 @ioctl(i32 %0, i32 %3, %struct.kvm_userspace_memory_region* %1)
ret i32 %4
}
void *atomic_fetch_voidptr(void **var) { return __atomic_load_n(var, 5); }


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

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

LLVM IR (-O0):
define i8* @atomic_fetch_voidptr(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = bitcast i8** %4 to i64*
%6 = bitcast i8** %3 to i64*
%7 = load atomic i64, i64* %5 seq_cst
store i64 %7, i64* %6
%8 = bitcast i64* %6 to i8**
%9 = load i8*, i8** %8
ret i8* %9
}

LLVM IR (-O2):
define i8* @atomic_fetch_voidptr(i8** nocapture %0) {
%2 = bitcast i8** %0 to i64*
%3 = load atomic i64, i64* %2 seq_cst
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ u_int32_t;
struct hostent {
  char *h_name;
};
typedef int /*<<< orphan*/ addr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
struct hostent *gethostbyaddr(char *, int, int /*<<< orphan*/);
char *inet_name(u_int32_t addr) {
  struct hostent *e;
  e = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET);
  return e ? e->h_name : 0;
}


x86 assembly (clang, -O0):
<inet_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
mov    0x2ec2(%rip),%rax
mov    (%rax),%edx
mov    $0x4,%esi
call   1030 <gethostbyaddr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1151 <inet_name+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    115c <inet_name+0x4c>
xor    %eax,%eax
mov    %rax,-0x18(%rbp)
jmp    115c <inet_name+0x4c>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inet_name>:
push   %rax
mov    %edi,0x4(%rsp)
mov    0x2ecc(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
call   1030 <gethostbyaddr@plt>
test   %rax,%rax
je     1137 <inet_name+0x27>
mov    (%rax),%rax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.hostent = type { i8* }
@AF_INET = global i32 0
define i8* @inet_name(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.hostent*
store i32 %0, i32* %2
%4 = bitcast i32* %2 to i8*
%5 = load i32, i32* @AF_INET
%6 = call %struct.hostent* @gethostbyaddr(i8* %4, i32 4, i32 %5)
store %struct.hostent* %6, %struct.hostent** %3
%7 = load %struct.hostent*, %struct.hostent** %3
%8 = icmp ne %struct.hostent* %7, null
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load %struct.hostent*, %struct.hostent** %3
%11 = getelementptr inbounds %struct.hostent, %struct.hostent* %10, i32 0, i32 0
%12 = load i8*, i8** %11
br label %14
13: ; preds = %1
br label %14
14: ; preds = %13, %9
%15 = phi i8* [ %12, %9 ], [ null, %13 ]
ret i8* %15
}

LLVM IR (-O2):
%struct.hostent = type { i8* }
@AF_INET = global i32 0
define i8* @inet_name(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @AF_INET
%5 = call %struct.hostent* @gethostbyaddr(i8* %3, i32 4, i32 %4)
%6 = icmp eq %struct.hostent* %5, null
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = getelementptr inbounds %struct.hostent, %struct.hostent* %5, i64 0, i32 0
%9 = load i8*, i8** %8
br label %10
10: ; preds = %1, %7
%11 = phi i8* [ %9, %7 ], [ null, %1 ]
ret i8* %11
}
/* Type definitions */
struct sched_param {
  int dummy;
};
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int pthread_attr_getschedparam(const pthread_attr_t *attr,
                               struct sched_param *param) {
  return 1;
}


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

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

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

LLVM IR (-O2):
%struct.sched_param = type { i32 }
define i32 @pthread_attr_getschedparam(i32* nocapture readnone %0, %struct.sched_param* nocapture readnone %1) {
ret i32 1
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
void QEIIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags) {
  ;
  (*((volatile unsigned long *)(ui32Base + 0x00000020))) &= ~(ui32IntFlags);
}


x86 assembly (clang, -O0):
<QEIIntDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
xor    $0xffffffffffffffff,%rdx
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%rcx
and    %rdx,%rcx
mov    %rcx,0x20(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<QEIIntDisable>:
mov    %rdi,-0x8(%rsp)
mov    %rsi,-0x10(%rsp)
mov    -0x10(%rsp),%rax
not    %rax
mov    -0x8(%rsp),%rcx
and    %rax,0x20(%rcx)
ret

LLVM IR (-O0):
define void @QEIIntDisable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store volatile i64 %0, i64* %3
store volatile i64 %1, i64* %4
%5 = load volatile i64, i64* %4
%6 = xor i64 %5, -1
%7 = load volatile i64, i64* %3
%8 = add i64 %7, 32
%9 = inttoptr i64 %8 to i64*
%10 = load volatile i64, i64* %9
%11 = and i64 %10, %6
store volatile i64 %11, i64* %9
ret void
}

LLVM IR (-O2):
define void @QEIIntDisable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store volatile i64 %0, i64* %3
store volatile i64 %1, i64* %4
%5 = load volatile i64, i64* %4
%6 = xor i64 %5, -1
%7 = load volatile i64, i64* %3
%8 = add i64 %7, 32
%9 = inttoptr i64 %8 to i64*
%10 = load volatile i64, i64* %9
%11 = and i64 %10, %6
store volatile i64 %11, i64* %9
ret void
}
int out(int x, int y) { return x < 0 || y < 0 || x >= 8 || y >= 8; }


x86 assembly (clang, -O0):
<out>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x9(%rbp)
jl     1141 <out+0x41>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jl     1141 <out+0x41>
mov    $0x1,%al
cmpl   $0x8,-0x4(%rbp)
mov    %al,-0x9(%rbp)
jge    1141 <out+0x41>
cmpl   $0x8,-0x8(%rbp)
setge  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<out>:
mov    %esi,%eax
or     %edi,%eax
sets   %al
cmp    $0x8,%edi
setge  %cl
or     %al,%cl
cmp    $0x8,%esi
setge  %al
or     %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @out(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 = icmp slt i32 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 0
br i1 %9, label %16, label %10
10: ; preds = %7
%11 = load i32, i32* %3
%12 = icmp sge i32 %11, 8
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i32, i32* %4
%15 = icmp sge i32 %14, 8
br label %16
16: ; preds = %13, %10, %7, %2
%17 = phi i1 [ true, %10 ], [ true, %7 ], [ true, %2 ], [ %15, %13 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @out(i32 %0, i32 %1) {
%3 = or i32 %1, %0
%4 = icmp slt i32 %3, 0
%5 = icmp sgt i32 %0, 7
%6 = or i1 %5, %4
%7 = icmp sgt i32 %1, 7
%8 = or i1 %7, %6
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ int8_t;
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ atol(char *);
int64_t ll_atol(int8_t *s) { return atol((char *)s); }


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

x86 assembly (clang, -O2):
<ll_atol>:
jmp    1030 <atol@plt>

LLVM IR (-O0):
define i32 @ll_atol(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = bitcast i32* %3 to i8*
%5 = call i32 @atol(i8* %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @ll_atol(i32* nocapture %0) {
%2 = bitcast i32* %0 to i8*
%3 = tail call i32 @atol(i8* %2)
ret i32 %3
}
unsigned long ieee_sw_to_fpcr(unsigned long sw) {
  unsigned long fpcw;
  fpcw = (sw & ((1 << 17) | (1 << 18) | (1 << 19) | (1 << 20) | (1 << 21)))
         << 35;
  fpcw |= sw & ((1 << 17) | (1 << 18) | (1 << 19) | (1 << 20) | (1 << 21))
              ? (1UL << 63)
              : 0;
  fpcw |= (~sw & ((1 << 1) | (1 << 2) | (1 << 3))) << 48;
  fpcw |= (~sw & ((1 << 4) | (1 << 5))) << 57;
  return fpcw;
}


x86 assembly (clang, -O0):
<ieee_sw_to_fpcr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0x3e0000,%rax
shl    $0x23,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
and    $0x3e0000,%rdx
xor    %eax,%eax
movabs $0x8000000000000000,%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
xor    $0xffffffffffffffff,%rax
and    $0xe,%rax
shl    $0x30,%rax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
xor    $0xffffffffffffffff,%rax
and    $0x30,%rax
shl    $0x39,%rax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ieee_sw_to_fpcr>:
mov    %edi,%eax
and    $0x3e0000,%eax
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
shl    $0x23,%rax
shl    $0x3f,%rcx
or     %rax,%rcx
not    %rdi
mov    %edi,%eax
and    $0xe,%eax
shl    $0x30,%rax
or     %rcx,%rax
and    $0x30,%edi
shl    $0x39,%rdi
or     %rdi,%rax
ret

LLVM IR (-O0):
define i64 @ieee_sw_to_fpcr(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = and i64 %4, 4063232
%6 = shl i64 %5, 35
store i64 %6, i64* %3
%7 = load i64, i64* %2
%8 = and i64 %7, 4063232
%9 = icmp ne i64 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i64 -9223372036854775808, i64 0
%12 = load i64, i64* %3
%13 = or i64 %12, %11
store i64 %13, i64* %3
%14 = load i64, i64* %2
%15 = xor i64 %14, -1
%16 = and i64 %15, 14
%17 = shl i64 %16, 48
%18 = load i64, i64* %3
%19 = or i64 %18, %17
store i64 %19, i64* %3
%20 = load i64, i64* %2
%21 = xor i64 %20, -1
%22 = and i64 %21, 48
%23 = shl i64 %22, 57
%24 = load i64, i64* %3
%25 = or i64 %24, %23
store i64 %25, i64* %3
%26 = load i64, i64* %3
ret i64 %26
}

LLVM IR (-O2):
define i64 @ieee_sw_to_fpcr(i64 %0) {
%2 = and i64 %0, 4063232
%3 = shl nuw nsw i64 %2, 35
%4 = icmp eq i64 %2, 0
%5 = select i1 %4, i64 0, i64 -9223372036854775808
%6 = or i64 %5, %3
%7 = xor i64 %0, -1
%8 = shl i64 %7, 48
%9 = and i64 %8, 3940649673949184
%10 = or i64 %6, %9
%11 = shl i64 %7, 57
%12 = and i64 %11, 6917529027641081856
%13 = or i64 %10, %12
ret i64 %13
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
short f0(short);
short f1(short);
int main() {
  int flag;
  short a;
  short res0, res1;
  if (flag)
    a = 1;
  else
    a = 1;
  res0 = f0(a);
  res1 = f1(a);
  assert(res0 == res1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1154 <main+0x24>
movw   $0x1,-0xa(%rbp)
jmp    115a <main+0x2a>
movw   $0x1,-0xa(%rbp)
movswl -0xa(%rbp),%edi
call   1030 <f0@plt>
mov    %ax,-0xc(%rbp)
movswl -0xa(%rbp),%edi
call   1050 <f1@plt>
mov    %ax,-0xe(%rbp)
movswl -0xc(%rbp),%eax
movswl -0xe(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
call   1030 <f0@plt>
mov    %eax,%ebx
mov    $0x1,%edi
call   1050 <f1@plt>
xor    %edi,%edi
cmp    %ax,%bx
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i16
%4 = alloca i16
%5 = alloca i16
store i32 0, i32* %1
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %0
store i16 1, i16* %3
br label %10
9: ; preds = %0
store i16 1, i16* %3
br label %10
10: ; preds = %9, %8
%11 = load i16, i16* %3
%12 = call signext i16 @f0(i16 signext %11)
store i16 %12, i16* %4
%13 = load i16, i16* %3
%14 = call signext i16 @f1(i16 signext %13)
store i16 %14, i16* %5
%15 = load i16, i16* %4
%16 = sext i16 %15 to i32
%17 = load i16, i16* %5
%18 = sext i16 %17 to i32
%19 = icmp eq i32 %16, %18
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call signext i16 @f0(i16 signext 1)
%2 = tail call signext i16 @f1(i16 signext 1)
%3 = icmp eq i16 %1, %2
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
ret i32 0
}
void INT_Excep_PERIB_INTB165(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_PERIB_INTB165() {
ret void
}
/* Variables and functions */
int bobMcBob();
int main(void) { return bobMcBob() != 42; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <bobMcBob@plt>
cmp    $0x2a,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <bobMcBob@plt>
xor    %ecx,%ecx
cmp    $0x2a,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @bobMcBob()
%3 = icmp ne i32 %2, 42
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @bobMcBob()
%2 = icmp ne i32 %1, 42
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef size_t ssize_t;

/* Variables and functions */
int /*<<< orphan*/ eprintf(char *);
size_t write(int, void const *, size_t);
ssize_t ewrite(int fd, const void *buf, size_t n) {
  ssize_t r;
  if ((r = write(fd, buf, n)) != n)
    eprintf("write:");
  return r;
}


x86 assembly (clang, -O0):
<ewrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <write@plt>
mov    %rax,-0x20(%rbp)
cmp    -0x18(%rbp),%rax
je     115d <ewrite+0x3d>
lea    0xea8(%rip),%rdi
call   1040 <eprintf@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ewrite>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
call   1030 <write@plt>
mov    %rax,%r14
cmp    %rbx,%rax
je     1140 <ewrite+0x20>
lea    0xec5(%rip),%rdi
call   1040 <eprintf@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"write:\00"
define i64 @ewrite(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i64 @write(i32 %0, i8* %1, i64 %2)
%5 = icmp eq i64 %4, %2
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @eprintf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ errx(int, char *);
void usage(void) {
  errx(1, "Usage: lguest [--verbose] "
          "[--sharenet=<filename>|--tunnet=(<ipaddr>|bridge:<bridgename>)\n"
          "|--block=<filename>|--initrd=<filename>]...\n"
          "<mem-in-mb> vmlinux [args...]");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
lea    0xee0(%rip),%rsi
call   1030 <errx@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
lea    0xee9(%rip),%rsi
mov    $0x1,%edi
jmp    1030 <errx@plt>

LLVM IR (-O0):
@.str = [163 x i8] c"Usage: lguest [--verbose] [--sharenet=<filename>|--tunnet=(<ipaddr>|bridge:<bridgename>)\0A|--block=<filename>|--initrd=<filename>]...\0A<mem-in-mb> vmlinux [args...]\00"
define void @usage() {
%1 = call i32 @errx(i32 1, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [163 x i8] c"Usage: lguest [--verbose] [--sharenet=<filename>|--tunnet=(<ipaddr>|bridge:<bridgename>)\0A|--block=<filename>|--initrd=<filename>]...\0A<mem-in-mb> vmlinux [args...]\00"
define void @usage() {
%1 = tail call i32 @errx(i32 1, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void *realloc(void *, size_t);
void *fw_realloc(void *ptr, size_t size) {
  void *p;
  if ((p = realloc(ptr, size)) == NULL) {
    perror("ipchains: realloc failed");
    exit(1);
  }
  return p;
}


x86 assembly (clang, -O0):
<fw_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1171 <fw_realloc+0x41>
lea    0xe9e(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fw_realloc>:
push   %rax
call   1030 <realloc@plt>
test   %rax,%rax
je     113d <fw_realloc+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [25 x i8] c"ipchains: realloc failed\00"
define noalias i8* @fw_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
ret i8* %3
}
int isblank(int c) {
  if (c == ' ' || c == '\t')
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isblank>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
je     111b <isblank+0x1b>
cmpl   $0x9,-0x8(%rbp)
jne    1127 <isblank+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <isblank+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isblank>:
cmp    $0x20,%edi
sete   %al
cmp    $0x9,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @isblank(i32 %0) {
%2 = icmp eq i32 %0, 32
%3 = icmp eq i32 %0, 9
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fib(unsigned int *, int);
int /*<<< orphan*/ myprint(unsigned int *, int);
int main() {
  unsigned int buf[10];
  fib(buf, 10);
  myprint(buf, 10);
  return (1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1040 <fib@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1030 <myprint@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <fib@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <myprint@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @fib(i32* %3, i32 10)
%5 = call i32 @myprint(i32* %3, i32 10)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, void *);
int iface1_ver1_constructor(void *context) {
  printf("A - version 1 constructor context %p\n", context);
  return (0);
}


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

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

LLVM IR (-O0):
@.str = [38 x i8] c"A - version 1 constructor context %p\0A\00"
define i32 @iface1_ver1_constructor(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"A - version 1 constructor context %p\0A\00"
define i32 @iface1_ver1_constructor(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 0
}
int _strlen(const char *s) {
  int Len;
  Len = 0;
  if (s == 0) {
    return 0;
  }
  do {
    if (*s == 0) {
      break;
    }
    Len++;
    s++;
  } while (1);
  return Len;
}


x86 assembly (clang, -O0):
<_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1126 <_strlen+0x26>
movl   $0x0,-0x4(%rbp)
jmp    116a <_strlen+0x6a>
jmp    112b <_strlen+0x2b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1140 <_strlen+0x40>
jmp    1164 <_strlen+0x64>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    112b <_strlen+0x2b>
jmp    1164 <_strlen+0x64>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_strlen>:
xor    %eax,%eax
test   %rdi,%rdi
je     111b <_strlen+0x1b>
cmpb   $0x0,(%rdi)
je     111b <_strlen+0x1b>
xor    %eax,%eax
xchg   %ax,%ax
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <_strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @_strlen(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3, %6
%7 = phi i32 [ %9, %6 ], [ 0, %3 ]
%8 = phi i8* [ %10, %6 ], [ %0, %3 ]
%9 = add nuw nsw i32 %7, 1
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %3, %1
%14 = phi i32 [ 0, %1 ], [ 0, %3 ], [ %9, %6 ]
ret i32 %14
}
/* Variables and functions */
int add(int, int);
int my_thumb(int);
int my_thumb2(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ test_branch_instructions();
int main() {
  int n = my_thumb(12);
  printf("result:%08x\n", n);
  n = my_thumb2(12);
  printf("result:%08x\n", n);
  n = add(12, 144);
  printf("result:%08x\n", n);
  test_branch_instructions();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xc,%edi
call   1060 <my_thumb@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe8a(%rip),%rdi
call   1050 <printf@plt>
mov    $0xc,%edi
call   1070 <my_thumb2@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe6e(%rip),%rdi
call   1050 <printf@plt>
mov    $0xc,%edi
mov    $0x90,%esi
call   1030 <add@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe4d(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <test_branch_instructions@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xc,%edi
call   1060 <my_thumb@plt>
lea    0xe9e(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0xc,%edi
call   1070 <my_thumb2@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0xc,%edi
mov    $0x90,%esi
call   1030 <add@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <test_branch_instructions@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"result:%08x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @my_thumb(i32 12)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @my_thumb2(i32 12)
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 @add(i32 12, i32 144)
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 (...) @test_branch_instructions()
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"result:%08x\0A\00"
define i32 @main() {
%1 = tail call i32 @my_thumb(i32 12)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @my_thumb2(i32 12)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @add(i32 12, i32 144)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 (...) @test_branch_instructions()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void fail(char *message) {
  fprintf(stderr, "%s\n", message);
  exit(10);
}


x86 assembly (clang, -O0):
<fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xa,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fail>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xa,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @fail(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 10)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @fail(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 10)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ sysCall(int, int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
void sysGetChar(char *ch) { sysCall(2, (uint64_t)ch, 0, 0, 0, 0); }


x86 assembly (clang, -O0):
<sysGetChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%esi
mov    $0x2,%edi
xor    %r9d,%r9d
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
call   1030 <sysCall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sysGetChar>:
mov    %rdi,%rsi
mov    $0x2,%edi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
jmp    1030 <sysCall@plt>

LLVM IR (-O0):
define void @sysGetChar(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i32
%5 = call i32 @sysCall(i32 2, i32 %4, i32 0, i32 0, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @sysGetChar(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i32 @sysCall(i32 2, i32 %3, i32 0, i32 0, i32 0, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CDROMEJECT;
int O_NONBLOCK;
int O_RDONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/);
int open(char *, int);
void ioctl_load(void) {
  int fd = open("/dev/cdrom", O_RDONLY | O_NONBLOCK);
  if (fd <= 0)
    return;
  ioctl(fd, CDROMEJECT);
  close(fd);
}


x86 assembly (clang, -O0):
<ioctl_load>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
mov    0x2ea0(%rip),%rax
or     (%rax),%esi
lea    0xeaf(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     1168 <ioctl_load+0x38>
jmp    1181 <ioctl_load+0x51>
mov    -0x4(%rbp),%edi
mov    0x2e5e(%rip),%rax
mov    (%rax),%esi
call   1030 <ioctl@plt>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ioctl_load>:
push   %rbx
mov    0x2ea8(%rip),%rax
mov    0x2ea9(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    0xeb6(%rip),%rdi
call   1050 <open@plt>
test   %eax,%eax
jle    116d <ioctl_load+0x3d>
mov    %eax,%ebx
mov    0x2e74(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1030 <ioctl@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <close@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"/dev/cdrom\00"
@O_RDONLY = global i32 0
@O_NONBLOCK = global i32 0
@CDROMEJECT = global i32 0
define void @ioctl_load() {
%1 = alloca i32
%2 = load i32, i32* @O_RDONLY
%3 = load i32, i32* @O_NONBLOCK
%4 = or i32 %2, %3
%5 = call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %4)
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = icmp sle i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %0
br label %15
9: ; preds = %0
%10 = load i32, i32* %1
%11 = load i32, i32* @CDROMEJECT
%12 = call i32 @ioctl(i32 %10, i32 %11)
%13 = load i32, i32* %1
%14 = call i32 @close(i32 %13)
br label %15
15: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"/dev/cdrom\00"
@O_RDONLY = global i32 0
@O_NONBLOCK = global i32 0
@CDROMEJECT = global i32 0
define void @ioctl_load() {
%1 = load i32, i32* @O_RDONLY
%2 = load i32, i32* @O_NONBLOCK
%3 = or i32 %2, %1
%4 = tail call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = icmp slt i32 %4, 1
br i1 %5, label %10, label %6
6: ; preds = %0
%7 = load i32, i32* @CDROMEJECT
%8 = tail call i32 @ioctl(i32 %4, i32 %7)
%9 = tail call i32 @close(i32 %4)
br label %10
10: ; preds = %0, %6
ret void
}
/* Variables and functions */
int strcmp(char const *, char const *);
int CompareStringsGivenPointers(const char **ptrs1, const char **ptrs2) {
  return strcmp(*ptrs1, *ptrs2);
}


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

x86 assembly (clang, -O2):
<CompareStringsGivenPointers>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @CompareStringsGivenPointers(i8** %0, i8** %1) {
%3 = alloca i8**
%4 = alloca i8**
store i8** %0, i8*** %3
store i8** %1, i8*** %4
%5 = load i8**, i8*** %3
%6 = load i8*, i8** %5
%7 = load i8**, i8*** %4
%8 = load i8*, i8** %7
%9 = call i32 @strcmp(i8* %6, i8* %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @CompareStringsGivenPointers(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(1) %4)
ret i32 %5
}