xunge/DecIR huggingface dataset:
/* Variables and functions */
float ldexp(double, long);
float _float32_unpack(long val) {
  double mant = val & 0x1fffff;
  int sign = val & 0x80000000;
  long exp = (val & 0x7fe00000L) >> 21;
  if (sign)
    mant = -mant;
  return (ldexp(mant, exp - (21 - 1) - 768));
}


x86 assembly (clang, -O0):
<_float32_unpack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0x1fffff,%rax
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movabs $0x80000000,%rax
and    -0x8(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
and    $0x7fe00000,%rax
sar    $0x15,%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     117e <_float32_unpack+0x6e>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x20(%rbp),%rdi
sub    $0x14,%rdi
sub    $0x300,%rdi
call   1030 <ldexp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_float32_unpack>:
mov    %edi,%eax
and    $0x1fffff,%eax
cvtsi2sd %eax,%xmm0
mov    %edi,%eax
and    $0x80000000,%eax
test   %rax,%rax
je     112f <_float32_unpack+0x1f>
xorpd  0xed1(%rip),%xmm0
shr    $0x15,%edi
and    $0x3ff,%edi
add    $0xfffffffffffffcec,%rdi
jmp    1030 <ldexp@plt>

LLVM IR (-O0):
define float @_float32_unpack(i64 %0) {
%2 = alloca i64
%3 = alloca double
%4 = alloca i32
%5 = alloca i64
store i64 %0, i64* %2
%6 = load i64, i64* %2
%7 = and i64 %6, 2097151
%8 = sitofp i64 %7 to double
store double %8, double* %3
%9 = load i64, i64* %2
%10 = and i64 %9, 2147483648
%11 = trunc i64 %10 to i32
store i32 %11, i32* %4
%12 = load i64, i64* %2
%13 = and i64 %12, 2145386496
%14 = ashr i64 %13, 21
store i64 %14, i64* %5
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %1
%18 = load double, double* %3
%19 = fneg double %18
store double %19, double* %3
br label %20
20: ; preds = %17, %1
%21 = load double, double* %3
%22 = load i64, i64* %5
%23 = sub nsw i64 %22, 20
%24 = sub nsw i64 %23, 768
%25 = call float @ldexp(double %21, i64 %24)
ret float %25
}

LLVM IR (-O2):
define float @_float32_unpack(i64 %0) {
%2 = and i64 %0, 2097151
%3 = sitofp i64 %2 to double
%4 = and i64 %0, 2147483648
%5 = icmp eq i64 %4, 0
%6 = fneg double %3
%7 = select i1 %5, double %3, double %6
%8 = lshr i64 %0, 21
%9 = and i64 %8, 1023
%10 = add nsw i64 %9, -788
%11 = tail call float @ldexp(double %7, i64 %10)
ret float %11
}
short int to16bit(c1, c2)
int c1, c2;
{ return ((c1 & 0xff) << 8) + (c2 & 0xff); }


x86 assembly (clang, -O0):
<to16bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%ecx
and    $0xff,%ecx
add    %ecx,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<to16bit>:
shl    $0x8,%edi
movzbl %sil,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define signext i16 @to16bit(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 = and i32 %5, 255
%7 = shl i32 %6, 8
%8 = load i32, i32* %4
%9 = and i32 %8, 255
%10 = add nsw i32 %7, %9
%11 = trunc i32 %10 to i16
ret i16 %11
}

LLVM IR (-O2):
define signext i16 @to16bit(i32 %0, i32 %1) {
%3 = shl i32 %0, 8
%4 = and i32 %1, 255
%5 = or i32 %4, %3
%6 = trunc i32 %5 to i16
ret i16 %6
}
int test_imm_4Aint64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x4A << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_4Aint64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x10,%rdx
and    $0x4a,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_4Aint64_midword_mem>:
testb  $0x4a,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_4Aint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 16
%6 = and i64 %5, 74
%7 = icmp ne i64 %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_4Aint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 4849664
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int is_branchregimm(int opcode) { return opcode == 1; }


x86 assembly (clang, -O0):
<is_branchregimm>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_branchregimm>:
xor    %eax,%eax
cmp    $0x1,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @is_branchregimm(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @is_branchregimm(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ errExit(char *);
scalar_t__ shmat(int const, int /*<<< orphan*/ *, int /*<<< orphan*/);
int *get_ptr_to_shm(const int shm_id) {
  int *temp;
  temp = (int *)shmat(shm_id, NULL, 0);
  if (!temp)
    errExit("shmatt()failed\n");
  return (temp);
}


x86 assembly (clang, -O0):
<get_ptr_to_shm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <shmat@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <get_ptr_to_shm+0x34>
lea    0xeb1(%rip),%rdi
call   1030 <errExit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ptr_to_shm>:
push   %rbx
xor    %esi,%esi
xor    %edx,%edx
call   1040 <shmat@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113e <get_ptr_to_shm+0x1e>
lea    0xec7(%rip),%rdi
call   1030 <errExit@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"shmatt()failed\0A\00"
define i32* @get_ptr_to_shm(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i64 @shmat(i32 %4, i32* null, i32 0)
%6 = inttoptr i64 %5 to i32*
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = icmp ne i32* %7, null
br i1 %8, label %11, label %9
9: ; preds = %1
%10 = call i32 @errExit(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
%12 = load i32*, i32** %3
ret i32* %12
}

LLVM IR (-O2):
@.str = [16 x i8] c"shmatt()failed\0A\00"
define i32* @get_ptr_to_shm(i32 %0) {
%2 = tail call i64 @shmat(i32 %0, i32* null, i32 0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @errExit(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = inttoptr i64 %2 to i32*
ret i32* %7
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
extern void sys_sleep(int secs) { sleep(secs); }


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

x86 assembly (clang, -O2):
<sys_sleep>:
jmp    1030 <sleep@plt>

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

LLVM IR (-O2):
define void @sys_sleep(i32 %0) {
%2 = tail call i32 @sleep(i32 %0)
ret void
}
void foo_1_1_2_2_1_1_2_2_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_1_2_2_1_1_2_2_2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("\nThis is a sample project\n");
  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 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [26 x i8] c"\0AThis is a sample project\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t swab_16(uint16_t v) { return (v >> 8) | ((v & 0xff) << 8); }


x86 assembly (clang, -O0):
<swab_16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swab_16>:
mov    %edi,%ecx
sar    $0x8,%ecx
shl    $0x8,%edi
movzwl %di,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @swab_16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 8
%5 = load i32, i32* %2
%6 = and i32 %5, 255
%7 = shl i32 %6, 8
%8 = or i32 %4, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @swab_16(i32 %0) {
%2 = ashr i32 %0, 8
%3 = shl i32 %0, 8
%4 = and i32 %3, 65280
%5 = or i32 %4, %2
ret i32 %5
}
int h(short b) { return b; }


x86 assembly (clang, -O0):
<h>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @h(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @h(i16 signext %0) {
%2 = sext i16 %0 to i32
ret i32 %2
}
int execute_umask() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_umask() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int O_NONBLOCK;
int fcntl(int, int /*<<< orphan*/, ...);
int xyz_sock_noblock(int sockfd) {
  int flag;
  flag = fcntl(sockfd, F_GETFL);
  return fcntl(sockfd, F_SETFL, flag | O_NONBLOCK);
}


x86 assembly (clang, -O0):
<xyz_sock_noblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eab(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   1030 <fcntl@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e9d(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
mov    0x2ea1(%rip),%rax
or     (%rax),%edx
mov    $0x0,%al
call   1030 <fcntl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xyz_sock_noblock>:
push   %rbx
mov    %edi,%ebx
mov    0x2eb6(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
call   1030 <fcntl@plt>
mov    0x2eae(%rip),%rcx
mov    (%rcx),%esi
mov    0x2eb5(%rip),%rcx
or     (%rcx),%eax
mov    %ebx,%edi
mov    %eax,%edx
xor    %eax,%eax
pop    %rbx
jmp    1030 <fcntl@plt>

LLVM IR (-O0):
@F_GETFL = global i32 0
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
define i32 @xyz_sock_noblock(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @F_GETFL
%6 = call i32 (i32, i32, ...) @fcntl(i32 %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = load i32, i32* @F_SETFL
%9 = load i32, i32* %3
%10 = load i32, i32* @O_NONBLOCK
%11 = or i32 %9, %10
%12 = call i32 (i32, i32, ...) @fcntl(i32 %7, i32 %8, i32 %11)
ret i32 %12
}

LLVM IR (-O2):
@F_GETFL = global i32 0
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
define i32 @xyz_sock_noblock(i32 %0) {
%2 = load i32, i32* @F_GETFL
%3 = tail call i32 (i32, i32, ...) @fcntl(i32 %0, i32 %2)
%4 = load i32, i32* @F_SETFL
%5 = load i32, i32* @O_NONBLOCK
%6 = or i32 %5, %3
%7 = tail call i32 (i32, i32, ...) @fcntl(i32 %0, i32 %4, i32 %6)
ret i32 %7
}
/* Variables and functions */
int next();
int example(void) {
  next();
  next();
  return next();
}


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

x86 assembly (clang, -O2):
<example>:
push   %rax
xor    %eax,%eax
call   1030 <next@plt>
xor    %eax,%eax
call   1030 <next@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <next@plt>

LLVM IR (-O0):
define i32 @example() {
%1 = call i32 (...) @next()
%2 = call i32 (...) @next()
%3 = call i32 (...) @next()
ret i32 %3
}

LLVM IR (-O2):
define i32 @example() {
%1 = tail call i32 (...) @next()
%2 = tail call i32 (...) @next()
%3 = tail call i32 (...) @next()
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int sprintf(char *, char *, char *);
char *strerror(int /*<<< orphan*/);
int get_error_str(char *strptr) {
  return sprintf(strptr, "%s", strerror(errno));
}


x86 assembly (clang, -O0):
<get_error_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    -0x10(%rbp),%rdi
mov    %rax,%rdx
lea    0xeb0(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_error_str>:
push   %rbx
mov    %rdi,%rbx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <stpcpy@plt>
sub    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@errno = global i32 0
define i32 @get_error_str(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @errno
%5 = call i8* @strerror(i32 %4)
%6 = call i32 @sprintf(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 %6
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @get_error_str(i8* %0) {
%2 = load i32, i32* @errno
%3 = tail call i8* @strerror(i32 %2)
%4 = tail call i8* @stpcpy(i8* %0, i8* %3)
%5 = ptrtoint i8* %4 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
%8 = trunc i64 %7 to i32
ret i32 %8
}
void DisableInterrupts() { *(volatile unsigned int *)(0xffffffb0 + 0x0) = 0; }


x86 assembly (clang, -O0):
<DisableInterrupts>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffb0,%eax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<DisableInterrupts>:
mov    $0xffffffb0,%eax
movl   $0x0,(%rax)
ret

LLVM IR (-O0):
define void @DisableInterrupts() {
store volatile i32 0, i32* inttoptr (i64 4294967216 to i32*)
ret void
}

LLVM IR (-O2):
define void @DisableInterrupts() {
store volatile i32 0, i32* inttoptr (i64 4294967216 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(char *, char *);
int match(char *st1, char *st2) {
  if (!strcmp(st1, st2))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<match>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1142 <match+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1149 <match+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match>:
push   %rax
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @match(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
int bic(int x, int m) { return x & (~m); }


x86 assembly (clang, -O0):
<bic>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bic>:
mov    %esi,%eax
not    %eax
and    %edi,%eax
ret

LLVM IR (-O0):
define i32 @bic(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 = xor i32 %6, -1
%8 = and i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @bic(i32 %0, i32 %1) {
%3 = xor i32 %1, -1
%4 = and i32 %3, %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int half_word_swap(int);
int multiply_and_accumulate(int, int, int);
int rxround(double);
int main(void) {
  if (half_word_swap(0x12345678) != 0x34127856)
    abort();
  ;
  if (multiply_and_accumulate(0x111, 0x222, 0x333) != 0x70007)
    abort();
  ;
  if (rxround(0.5) != 1)
    abort();
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x12345678,%edi
call   1050 <half_word_swap@plt>
cmp    $0x34127856,%eax
je     116b <main+0x2b>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x111,%edi
mov    $0x222,%esi
mov    $0x333,%edx
call   1040 <multiply_and_accumulate@plt>
cmp    $0x70007,%eax
je     1191 <main+0x51>
mov    $0x0,%al
call   1030 <abort@plt>
movsd  0xe67(%rip),%xmm0
call   1060 <rxround@plt>
cmp    $0x1,%eax
je     11ae <main+0x6e>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x12345678,%edi
call   1050 <half_word_swap@plt>
cmp    $0x34127856,%eax
jne    1183 <main+0x43>
mov    $0x111,%edi
mov    $0x222,%esi
mov    $0x333,%edx
call   1040 <multiply_and_accumulate@plt>
cmp    $0x70007,%eax
jne    1183 <main+0x43>
movsd  0xe8b(%rip),%xmm0
call   1060 <rxround@plt>
cmp    $0x1,%eax
jne    1183 <main+0x43>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @half_word_swap(i32 305419896)
%3 = icmp ne i32 %2, 873625686
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i32 @multiply_and_accumulate(i32 273, i32 546, i32 819)
%8 = icmp ne i32 %7, 458759
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %6
%12 = call i32 @rxround(double 5.000000e-01)
%13 = icmp ne i32 %12, 1
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @half_word_swap(i32 305419896)
%2 = icmp eq i32 %1, 873625686
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @multiply_and_accumulate(i32 273, i32 546, i32 819)
%7 = icmp eq i32 %6, 458759
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %5
%11 = tail call i32 @rxround(double 5.000000e-01)
%12 = icmp eq i32 %11, 1
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 (...) @abort()
unreachable
15: ; preds = %10
ret i32 0
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int *ptr_one;
  ptr_one = (int *)malloc(sizeof(int));
  if (ptr_one == 0) {
    printf("ERROR: Out of memory\n");
    return 1;
  }
  *ptr_one = 25;
  printf("%d\n", *ptr_one);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1162 <main+0x42>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1187 <main+0x67>
mov    -0x10(%rbp),%rax
movl   $0x19,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x4,%edi
call   1050 <malloc@plt>
test   %rax,%rax
je     115d <main+0x2d>
movl   $0x19,(%rax)
lea    0xeb3(%rip),%rdi
xor    %ebx,%ebx
mov    $0x19,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    116e <main+0x3e>
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"ERROR: Out of memory\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i64 @malloc(i32 4)
%4 = inttoptr i64 %3 to i32*
store i32* %4, i32** %2
%5 = load i32*, i32** %2
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %14
9: ; preds = %0
%10 = load i32*, i32** %2
store i32 25, i32* %10
%11 = load i32*, i32** %2
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
store i32 0, i32* %1
br label %14
14: ; preds = %9, %7
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
@str = [21 x i8] c"ERROR: Out of memory\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 4)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %8
5: ; preds = %0
%6 = inttoptr i64 %1 to i32*
store i32 25, i32* %6
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 25)
br label %8
8: ; preds = %5, %3
%9 = phi i32 [ 1, %3 ], [ 0, %5 ]
ret i32 %9
}
float v2dprod(const float *a, const float *b) {
  return a[0] * b[0] + a[1] * b[1];
}


x86 assembly (clang, -O0):
<v2dprod>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulss  0x4(%rax),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<v2dprod>:
movss  0x4(%rdi),%xmm1
mulss  0x4(%rsi),%xmm1
movss  (%rdi),%xmm0
mulss  (%rsi),%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @v2dprod(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %3
%6 = getelementptr inbounds float, float* %5, i64 0
%7 = load float, float* %6
%8 = load float*, float** %4
%9 = getelementptr inbounds float, float* %8, i64 0
%10 = load float, float* %9
%11 = load float*, float** %3
%12 = getelementptr inbounds float, float* %11, i64 1
%13 = load float, float* %12
%14 = load float*, float** %4
%15 = getelementptr inbounds float, float* %14, i64 1
%16 = load float, float* %15
%17 = fmul float %13, %16
%18 = call float @llvm.fmuladd.f32(float %7, float %10, float %17)
ret float %18
}

LLVM IR (-O2):
define float @v2dprod(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
%5 = getelementptr inbounds float, float* %0, i64 1
%6 = load float, float* %5
%7 = getelementptr inbounds float, float* %1, i64 1
%8 = load float, float* %7
%9 = fmul float %6, %8
%10 = tail call float @llvm.fmuladd.f32(float %3, float %4, float %9)
ret float %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sub();
void dummy() {
  printf("Hello");
  printf("World");
  sub();
}


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"Hello\00"
@.str.1 = [6 x i8] c"World\00"
define void @dummy() {
%1 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (...) @sub()
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"Hello\00"
@.str.1 = [6 x i8] c"World\00"
define void @dummy() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (...) @sub()
ret void
}
int get_sum(int a, int b, int c) { return a + b + c; }


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

x86 assembly (clang, -O2):
<get_sum>:
lea    (%rdi,%rsi,1),%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @get_sum(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = add nsw i32 %7, %8
%10 = load i32, i32* %6
%11 = add nsw i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @get_sum(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, %0
%5 = add nsw i32 %4, %2
ret i32 %5
}
/* Variables and functions */
scalar_t__ is_from(char const, char const *);
const char *skip_sign(const char *str) {
  static const char signs[] = "+-";
  if (str) {
    if (is_from(*str, signs))
      str++;
  }
  return str;
}


x86 assembly (clang, -O0):
<skip_sign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1155 <skip_sign+0x45>
mov    -0x8(%rbp),%rax
lea    0xece(%rip),%rsi
movsbl (%rax),%edi
call   1030 <is_from@plt>
cmp    $0x0,%rax
je     1150 <skip_sign+0x40>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1155 <skip_sign+0x45>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_sign>:
push   %rbx
test   %rdi,%rdi
je     1132 <skip_sign+0x22>
mov    %rdi,%rbx
movsbl (%rdi),%edi
lea    0xedd(%rip),%rsi
call   1030 <is_from@plt>
cmp    $0x1,%rax
sbb    $0xffffffffffffffff,%rbx
jmp    1134 <skip_sign+0x24>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@skip_sign.signs = internal constant [3 x i8] c"+-\00"
define i8* @skip_sign(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = tail call i64 @is_from(i8 signext %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @skip_sign.signs, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = getelementptr i8, i8* %0, i64 %7
br label %9
9: ; preds = %3, %1
%10 = phi i8* [ null, %1 ], [ %8, %3 ]
ret i8* %10
}
void glmGenerateIdentityMatrix2f(float m[4]) {
  m[0] = 1;
  m[2] = 0;
  m[1] = 0;
  m[3] = 1;
}


x86 assembly (clang, -O0):
<glmGenerateIdentityMatrix2f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  0xeec(%rip),%xmm0
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  0xec4(%rip),%xmm0
movss  %xmm0,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmGenerateIdentityMatrix2f>:
movaps 0xef9(%rip),%xmm0
movups %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @glmGenerateIdentityMatrix2f(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = getelementptr inbounds float, float* %3, i64 0
store float 1.000000e+00, float* %4
%5 = load float*, float** %2
%6 = getelementptr inbounds float, float* %5, i64 2
store float 0.000000e+00, float* %6
%7 = load float*, float** %2
%8 = getelementptr inbounds float, float* %7, i64 1
store float 0.000000e+00, float* %8
%9 = load float*, float** %2
%10 = getelementptr inbounds float, float* %9, i64 3
store float 1.000000e+00, float* %10
ret void
}

LLVM IR (-O2):
define void @glmGenerateIdentityMatrix2f(float* nocapture writeonly %0) {
%2 = bitcast float* %0 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00>, <4 x float>* %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, int, int);
void write_pixel(int r, int g, int b, FILE *file) {
  fprintf(file, "%d %d %d\n", r, g, b);
}


x86 assembly (clang, -O0):
<write_pixel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xec6(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_pixel>:
mov    %edx,%r8d
mov    %esi,%eax
mov    %edi,%edx
lea    0xee2(%rip),%rsi
mov    %rcx,%rdi
mov    %eax,%ecx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"%d %d %d\0A\00"
define void @write_pixel(i32 %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%9 = load i32*, i32** %8
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11, i32 %12)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"%d %d %d\0A\00"
define void @write_pixel(i32 %0, i32 %1, i32 %2, i32* nocapture %3) {
%5 = tail call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mystery(int *, int *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a = 2016, b = 0, c = 4, d = 42;
  mystery(&a, &b);
  if (a < c)
    mystery(&c, &a);
  mystery(&a, &d);
  printf("%d\n", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7e0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x4,-0x10(%rbp)
movl   $0x2a,-0x14(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <mystery@plt>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1171 <main+0x51>
lea    -0x10(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <mystery@plt>
lea    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <mystery@plt>
mov    -0x8(%rbp),%esi
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movl   $0x7e0,0x8(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x4,0x10(%rsp)
movl   $0x2a,0xc(%rsp)
lea    0x8(%rsp),%rdi
lea    0x14(%rsp),%rsi
call   1040 <mystery@plt>
cmpl   $0x3,0x8(%rsp)
jg     1169 <main+0x49>
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1040 <mystery@plt>
lea    0x8(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1040 <mystery@plt>
mov    0x8(%rsp),%esi
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

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


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

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

LLVM IR (-O0):
define i32 @num_diagnostics() {
ret i32 18
}

LLVM IR (-O2):
define i32 @num_diagnostics() {
ret i32 18
}
unsigned int bits_popcount(int x) { return __builtin_popcount(x); }


x86 assembly (clang, -O0):
<bits_popcount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    %ecx,%eax
shr    %eax
and    $0x55555555,%eax
sub    %eax,%ecx
mov    %ecx,%eax
and    $0x33333333,%eax
shr    $0x2,%ecx
and    $0x33333333,%ecx
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x4,%ecx
add    %ecx,%eax
and    $0xf0f0f0f,%eax
imul   $0x1010101,%eax,%eax
shr    $0x18,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bits_popcount>:
mov    %edi,%eax
shr    %eax
and    $0x55555555,%eax
sub    %eax,%edi
mov    %edi,%eax
and    $0x33333333,%eax
shr    $0x2,%edi
and    $0x33333333,%edi
add    %eax,%edi
mov    %edi,%eax
shr    $0x4,%eax
add    %edi,%eax
and    $0xf0f0f0f,%eax
imul   $0x1010101,%eax,%eax
shr    $0x18,%eax
ret

LLVM IR (-O0):
define i32 @bits_popcount(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @llvm.ctpop.i32(i32 %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @bits_popcount(i32 %0) {
%2 = tail call i32 @llvm.ctpop.i32(i32 %0)
ret i32 %2
}
/* Variables and functions */
int generic_test(char const *, char const *, int /*<<< orphan*/, int);
int /*<<< orphan*/ test_title(char *);
int test5(void) {
  const char *rd, *wr;
  rd = wr = "uart16550";
  test_title("Test 5. Back-to-back, small speed");
  return generic_test(rd, wr, 0, 5);
}


x86 assembly (clang, -O0):
<test5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xec6(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xec5(%rip),%rdi
call   1040 <test_title@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
mov    $0x5,%ecx
call   1030 <generic_test@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test5>:
push   %rax
lea    0xee2(%rip),%rdi
call   1040 <test_title@plt>
lea    0xecc(%rip),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
mov    $0x5,%ecx
pop    %rax
jmp    1030 <generic_test@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"uart16550\00"
@.str.1 = [34 x i8] c"Test 5. Back-to-back, small speed\00"
define i32 @test5() {
%1 = alloca i8*
%2 = alloca i8*
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %1
%3 = call i32 @test_title(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%4 = load i8*, i8** %1
%5 = load i8*, i8** %2
%6 = call i32 @generic_test(i8* %4, i8* %5, i32 0, i32 5)
ret i32 %6
}

LLVM IR (-O2):
@.str = [10 x i8] c"uart16550\00"
@.str.1 = [34 x i8] c"Test 5. Back-to-back, small speed\00"
define i32 @test5() {
%1 = tail call i32 @test_title(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @generic_test(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 0, i32 5)
ret i32 %2
}
int f1() {
  static int array = &&label_B - &&label_A;
label_A:
  printf("%d\n", array);
label_B:
  return 0;
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <f1+0x9>
mov    0x2f09(%rip),%esi
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
push   %rax
lea    -0x8(%rip),%rax
lea    0x14(%rip),%rsi
sub    %eax,%esi
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

LLVM IR (-O0):
@f1.array = internal global i32 trunc (i64 sub (i64 ptrtoint (i8* blockaddress(@f1, %4) to i64), i64 ptrtoint (i8* blockaddress(@f1, %1) to i64)) to i32)
@.str = [4 x i8] c"%d\0A\00"
define i32 @f1() {
br label %1
1: ; preds = %0, %5
%2 = load i32, i32* @f1.array
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %4
4: ; preds = %1, %5
ret i32 0
5: ; No predecessors!
indirectbr i8* undef, [label %4, label %1]
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @f1() {
br label %1
1: ; preds = %0
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 trunc (i64 sub (i64 ptrtoint (i8* blockaddress(@f1, %3) to i64), i64 ptrtoint (i8* blockaddress(@f1, %1) to i64)) to i32))
br label %3
3: ; preds = %1
ret i32 0
}
int funcB(int *a, int *b) {
  (*a) = (*a) + (*b);
  return 1;
}


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

x86 assembly (clang, -O2):
<funcB>:
mov    (%rsi),%eax
add    %eax,(%rdi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @funcB(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* %5
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = add nsw i32 %6, %8
%10 = load i32*, i32** %3
store i32 %9, i32* %10
ret i32 1
}

LLVM IR (-O2):
define i32 @funcB(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = add nsw i32 %4, %3
store i32 %5, i32* %0
ret i32 1
}
/* Variables and functions */
size_t KEY_MENU;
int device_toggle_display(volatile char *key_pressed, int key_code) {
  return key_pressed[KEY_MENU];
}


x86 assembly (clang, -O0):
<device_toggle_display>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2eca(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,1),%al
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<device_toggle_display>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%rax
movsbl (%rdi,%rax,1),%eax
ret

LLVM IR (-O0):
@KEY_MENU = global i64 0
define i32 @device_toggle_display(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* @KEY_MENU
%7 = getelementptr inbounds i8, i8* %5, i64 %6
%8 = load volatile i8, i8* %7
%9 = sext i8 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
@KEY_MENU = global i64 0
define i32 @device_toggle_display(i8* %0, i32 %1) {
%3 = load i64, i64* @KEY_MENU
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load volatile i8, i8* %4
%6 = sext i8 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void sigint_handler(int signo) { printf("Caught SIGINT\n"); }


x86 assembly (clang, -O0):
<sigint_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [15 x i8] c"Caught SIGINT\0A\00"
define void @sigint_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [14 x i8] c"Caught SIGINT\00"
define void @sigint_handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
int cmp_inc(int data1, int data2) { return data1 > data2; }


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

x86 assembly (clang, -O2):
<cmp_inc>:
xor    %eax,%eax
cmp    %esi,%edi
setg   %al
ret

LLVM IR (-O0):
define i32 @cmp_inc(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 = icmp sgt i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @cmp_inc(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int getint(int *);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int n = 0;
  int SIGN;
  if ((SIGN = (getint(&n))) == 'a' || SIGN == 'b')
    ;
  printf("%d\n", n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <getint@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x61,%eax
je     1155 <main+0x35>
cmpl   $0x62,-0xc(%rbp)
jne    115a <main+0x3a>
jmp    115a <main+0x3a>
mov    -0x8(%rbp),%esi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%4 = call i32 @getint(i32* %2)
store i32 %4, i32* %3
%5 = icmp eq i32 %4, 97
br i1 %5, label %9, label %6
6: ; preds = %0
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 98
br i1 %8, label %9, label %10
9: ; preds = %6, %0
br label %10
10: ; preds = %9, %6
%11 = load i32, i32* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @getint(i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
scalar_t__ isPalindrome(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char const *argv[]) {
  int i, pal = 0;
  for (i = 900000; i < 998001; i++) {
    if (isPalindrome(i)) {
      pal = i;
    }
  }
  printf("%d\n", pal);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0xdbba0,-0x14(%rbp)
cmpl   $0xf3a71,-0x14(%rbp)
jge    117c <main+0x5c>
mov    -0x14(%rbp),%edi
call   1040 <isPalindrome@plt>
cmp    $0x0,%rax
je     1169 <main+0x49>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    116e <main+0x4e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <main+0x24>
mov    -0x18(%rbp),%esi
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0xdbba0,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1040 <isPalindrome@plt>
test   %rax,%rax
cmovne %ebp,%ebx
add    $0x1,%ebp
cmp    $0xf3a71,%ebp
jne    1130 <main+0x10>
lea    0xeb1(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i32 [ 0, %2 ], [ %8, %3 ]
%5 = phi i32 [ 900000, %2 ], [ %9, %3 ]
%6 = tail call i64 @isPalindrome(i32 %5)
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i32 %4, i32 %5
%9 = add nuw nsw i32 %5, 1
%10 = icmp eq i32 %9, 998001
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}