xunge/DecIR huggingface dataset:
/* Type definitions */
struct domainlist {
  int dummy;
};
struct dev_policy {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dev_policy_free(struct dev_policy *);
struct dev_policy *devnum_policy(int);
int /*<<< orphan*/ domain_merge(struct domainlist **, struct dev_policy *,
                                char const *);
void domainlist_add_dev(struct domainlist **dom, int devnum,
                        const char *metadata) {
  struct dev_policy *pol = devnum_policy(devnum);
  domain_merge(dom, pol, metadata);
  dev_policy_free(pol);
}


x86 assembly (clang, -O0):
<domainlist_add_dev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <devnum_policy@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <domain_merge@plt>
mov    -0x20(%rbp),%rdi
call   1040 <dev_policy_free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<domainlist_add_dev>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rdi,%r15
mov    %esi,%edi
call   1050 <devnum_policy@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
mov    %r14,%rdx
call   1030 <domain_merge@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <dev_policy_free@plt>

LLVM IR (-O0):
%struct.domainlist = type { i32 }
%struct.dev_policy = type { i32 }
define void @domainlist_add_dev(%struct.domainlist** %0, i32 %1, i8* %2) {
%4 = alloca %struct.domainlist**
%5 = alloca i32
%6 = alloca i8*
%7 = alloca %struct.dev_policy*
store %struct.domainlist** %0, %struct.domainlist*** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load i32, i32* %5
%9 = call %struct.dev_policy* @devnum_policy(i32 %8)
store %struct.dev_policy* %9, %struct.dev_policy** %7
%10 = load %struct.domainlist**, %struct.domainlist*** %4
%11 = load %struct.dev_policy*, %struct.dev_policy** %7
%12 = load i8*, i8** %6
%13 = call i32 @domain_merge(%struct.domainlist** %10, %struct.dev_policy* %11, i8* %12)
%14 = load %struct.dev_policy*, %struct.dev_policy** %7
%15 = call i32 @dev_policy_free(%struct.dev_policy* %14)
ret void
}

LLVM IR (-O2):
%struct.domainlist = type { i32 }
%struct.dev_policy = type { i32 }
define void @domainlist_add_dev(%struct.domainlist** %0, i32 %1, i8* %2) {
%4 = tail call %struct.dev_policy* @devnum_policy(i32 %1)
%5 = tail call i32 @domain_merge(%struct.domainlist** %0, %struct.dev_policy* %4, i8* %2)
%6 = tail call i32 @dev_policy_free(%struct.dev_policy* %4)
ret void
}
/* Variables and functions */
char *get_architecture() {
  size_t int_size = sizeof(int *);
  if (int_size == 8)
    return "64bit";
  else if (int_size == 4)
    return "32bit";
  else
    return NULL;
}


x86 assembly (clang, -O0):
<get_architecture>:
push   %rbp
mov    %rsp,%rbp
movq   $0x8,-0x10(%rbp)
cmpq   $0x8,-0x10(%rbp)
jne    1127 <get_architecture+0x27>
lea    0xee2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    114a <get_architecture+0x4a>
cmpq   $0x4,-0x10(%rbp)
jne    1142 <get_architecture+0x42>
lea    0xecd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    114a <get_architecture+0x4a>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"64bit\00"
@.str.1 = [6 x i8] c"32bit\00"
define i8* @get_architecture() {
%1 = alloca i8*
%2 = alloca i64
store i64 8, i64* %2
%3 = load i64, i64* %2
%4 = icmp eq i64 %3, 8
br i1 %4, label %5, label %6
5: ; preds = %0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %1
br label %11
6: ; preds = %0
%7 = load i64, i64* %2
%8 = icmp eq i64 %7, 4
br i1 %8, label %9, label %10
9: ; preds = %6
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %11
10: ; preds = %6
store i8* null, i8** %1
br label %11
11: ; preds = %10, %9, %5
%12 = load i8*, i8** %1
ret i8* %12
}

LLVM IR (-O2):
@.str = [6 x i8] c"64bit\00"
define i8* @get_architecture() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ remove_entry(void *);
void safe_free(void *ptr) {
  free(ptr);
  remove_entry(ptr);
}


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

x86 assembly (clang, -O2):
<safe_free>:
push   %rbx
mov    %rdi,%rbx
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <remove_entry@plt>

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

LLVM IR (-O2):
define void @safe_free(i8* %0) {
%2 = tail call i32 @free(i8* %0)
%3 = tail call i32 @remove_entry(i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct in_addr {
  int /*<<< orphan*/ s_addr;
};

/* Variables and functions */
char const *inet_ntoa(struct in_addr);
const char *ipaddr_to_string(uint32_t addr) {
  struct in_addr in_addr;
  in_addr.s_addr = addr;
  return inet_ntoa(in_addr);
}


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

x86 assembly (clang, -O2):
<ipaddr_to_string>:
jmp    1030 <inet_ntoa@plt>

LLVM IR (-O0):
%struct.in_addr = type { i32 }
define i8* @ipaddr_to_string(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.in_addr
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %3, i32 0, i32 0
store i32 %4, i32* %5
%6 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %3, i32 0, i32 0
%7 = load i32, i32* %6
%8 = call i8* @inet_ntoa(i32 %7)
ret i8* %8
}

LLVM IR (-O2):
define i8* @ipaddr_to_string(i32 %0) {
%2 = tail call i8* @inet_ntoa(i32 %0)
ret i8* %2
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint32_t;

/* Variables and functions */
void tumbleweed_characters2checksum(uint8_t crc1, uint8_t crc2, uint8_t crc3,
                                    uint32_t *crcp) {
  *crcp = (((uint32_t)crc1) << (8 * 2)) | (((uint32_t)crc2) << (8 * 1)) |
          (((uint32_t)crc3) << (8 * 0));
}


x86 assembly (clang, -O0):
<tumbleweed_characters2checksum>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%ecx
shl    $0x10,%ecx
mov    -0x10(%rbp),%rax
shl    $0x8,%eax
or     %eax,%ecx
mov    -0x18(%rbp),%rax
shl    $0x0,%eax
or     %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<tumbleweed_characters2checksum>:
shl    $0x10,%edi
shl    $0x8,%esi
or     %edi,%esi
or     %esi,%edx
mov    %edx,(%rcx)
ret

LLVM IR (-O0):
define void @tumbleweed_characters2checksum(i64 %0, i64 %1, i64 %2, i32* %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32*
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i32* %3, i32** %8
%9 = load i64, i64* %5
%10 = trunc i64 %9 to i32
%11 = shl i32 %10, 16
%12 = load i64, i64* %6
%13 = trunc i64 %12 to i32
%14 = shl i32 %13, 8
%15 = or i32 %11, %14
%16 = load i64, i64* %7
%17 = trunc i64 %16 to i32
%18 = shl i32 %17, 0
%19 = or i32 %15, %18
%20 = load i32*, i32** %8
store i32 %19, i32* %20
ret void
}

LLVM IR (-O2):
define void @tumbleweed_characters2checksum(i64 %0, i64 %1, i64 %2, i32* nocapture writeonly %3) {
%5 = trunc i64 %0 to i32
%6 = shl i32 %5, 16
%7 = trunc i64 %1 to i32
%8 = shl i32 %7, 8
%9 = or i32 %8, %6
%10 = trunc i64 %2 to i32
%11 = or i32 %9, %10
store i32 %11, i32* %3
ret void
}
int turn(int base, int n) {
  int sum = 0;
  while (n != 0) {
    int rem = n % base;
    n = n / base;
    sum += rem;
  }
  return sum % base;
}


x86 assembly (clang, -O0):
<turn>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     113d <turn+0x3d>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1111 <turn+0x11>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<turn>:
test   %esi,%esi
je     111b <turn+0x1b>
mov    %esi,%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cltd
idiv   %edi
add    %edx,%ecx
test   %eax,%eax
jne    1110 <turn+0x10>
jmp    111d <turn+0x1d>
xor    %ecx,%ecx
mov    %ecx,%eax
cltd
idiv   %edi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @turn(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ %1, %2 ]
%6 = phi i32 [ %9, %4 ], [ 0, %2 ]
%7 = srem i32 %5, %0
%8 = sdiv i32 %5, %0
%9 = add nsw i32 %7, %6
%10 = icmp eq i32 %8, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %2
%12 = phi i32 [ 0, %2 ], [ %9, %4 ]
%13 = srem i32 %12, %0
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void __attribute__((aligned(2048))) hp1(void) { printf("hello, world!\n"); }


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"hello, world!\0A\00"
define void @hp1() align 2048 {
%1 = 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"hello, world!\00"
define void @hp1() align 2048 {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
f(x) int x;
{ g(x * x); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
imul   -0x8(%rbp),%edi
mov    $0x0,%al
call   1030 <g@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
imul   %edi,%edi
xor    %eax,%eax
jmp    1030 <g@plt>

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* %3
%6 = mul nsw i32 %4, %5
%7 = call i32 (i32, ...) bitcast (i32 (...)* @g to i32 (i32, ...)*)(i32 %6)
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = mul nsw i32 %0, %0
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @g to i32 (i32, ...)*)(i32 %2)
ret i32 undef
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int, int *);
int main(void) {
  int tmp = 0x420;
  printf("%d %p\n", getpid(), &tmp);
  while (420)
    ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x420,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rdx
call   1040 <printf@plt>
jmp    114f <main+0x2f>

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x420,0x4(%rsp)
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xec9(%rip),%rdi
lea    0x4(%rsp),%rdx
mov    %eax,%esi
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
jmp    1150 <main+0x30>

LLVM IR (-O0):
@.str = [7 x i8] c"%d %p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1056, i32* %2
%3 = call i32 (...) @getpid()
%4 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %3, i32* %2)
br label %5
5: ; preds = %0, %5
br label %5
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 1056, i32* %1
%3 = tail call i32 (...) @getpid()
%4 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %3, i32* %1)
br label %5
5: ; preds = %5, %0
br label %5
}
imm0adrreg1(r0, r1, x0, x1, p0, p1) unsigned short r0, r1;
unsigned short *p0, *p1;
{
  if (22 <= (p1[1111111 / 4]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<imm0adrreg1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movzwl 0x87a22(%rax),%ecx
mov    $0x16,%eax
cmp    %ecx,%eax
jg     1143 <imm0adrreg1+0x43>
movl   $0x1,-0x4(%rbp)
jmp    114a <imm0adrreg1+0x4a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<imm0adrreg1>:
xor    %eax,%eax
cmpw   $0x16,0x87a22(%r9)
setae  %al
ret

LLVM IR (-O0):
define i32 @imm0adrreg1(i32 %0, i32 %1, i32 %2, i32 %3, i16* %4, i16* %5) {
%7 = alloca i32
%8 = alloca i16
%9 = alloca i16
%10 = alloca i32
%11 = alloca i32
%12 = alloca i16*
%13 = alloca i16*
%14 = trunc i32 %0 to i16
%15 = trunc i32 %1 to i16
store i16 %14, i16* %8
store i16 %15, i16* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i16* %4, i16** %12
store i16* %5, i16** %13
%16 = load i16*, i16** %13
%17 = getelementptr inbounds i16, i16* %16, i64 277777
%18 = load i16, i16* %17
%19 = zext i16 %18 to i32
%20 = icmp sle i32 22, %19
br i1 %20, label %21, label %22
21: ; preds = %6
store i32 1, i32* %7
br label %23
22: ; preds = %6
store i32 0, i32* %7
br label %23
23: ; preds = %22, %21
%24 = load i32, i32* %7
ret i32 %24
}

LLVM IR (-O2):
define i32 @imm0adrreg1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture readnone %4, i16* nocapture %5) {
%7 = getelementptr inbounds i16, i16* %5, i64 277777
%8 = load i16, i16* %7
%9 = icmp ugt i16 %8, 21
%10 = zext i1 %9 to i32
ret i32 %10
}
void f5(int *x) { return; }


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

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

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

LLVM IR (-O2):
define void @f5(i32* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printChar(char);
void str_arr2(char str[], int len) {
  int i;
  for (i = 0; i < len; i++) {
    printChar(str[i]);
    printChar(' ');
  }
}


x86 assembly (clang, -O0):
<str_arr2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115b <str_arr2+0x4b>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <printChar@plt>
mov    $0x20,%edi
call   1030 <printChar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <str_arr2+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_arr2>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    114d <str_arr2+0x3d>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%edi
call   1030 <printChar@plt>
mov    $0x20,%edi
call   1030 <printChar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <str_arr2+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @str_arr2(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = tail call i32 @printChar(i8 signext %9)
%11 = tail call i32 @printChar(i8 signext 32)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret void
}
/* Type definitions */
struct rtree {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ rtree_purge(struct rtree *);
void rtree_destroy(struct rtree *tree) { rtree_purge(tree); }


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

x86 assembly (clang, -O2):
<rtree_destroy>:
jmp    1030 <rtree_purge@plt>

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

LLVM IR (-O2):
%struct.rtree = type { i32 }
define void @rtree_destroy(%struct.rtree* %0) {
%2 = tail call i32 @rtree_purge(%struct.rtree* %0)
ret void
}
int test_imm_10uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x10 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_10uint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 16
%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_10uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 1048576
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int wipe_exitColorXForm(int width, int height, int ticks) { return 0; }


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

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

LLVM IR (-O0):
define i32 @wipe_exitColorXForm(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
ret i32 0
}

LLVM IR (-O2):
define i32 @wipe_exitColorXForm(i32 %0, i32 %1, i32 %2) {
ret i32 0
}
int doubledouble2longdouble(double *_doubledouble, long double *_longdouble) {
  *_longdouble = (long double)_doubledouble[0] + (long double)_doubledouble[1];
  return 0;
}


x86 assembly (clang, -O0):
<doubledouble2longdouble>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
fldl   (%rax)
fldl   0x8(%rax)
faddp  %st,%st(1)
mov    -0x10(%rbp),%rax
fstpt  (%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<doubledouble2longdouble>:
fldl   (%rdi)
faddl  0x8(%rdi)
fstpt  (%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @doubledouble2longdouble(double* %0, x86_fp80* %1) {
%3 = alloca double*
%4 = alloca x86_fp80*
store double* %0, double** %3
store x86_fp80* %1, x86_fp80** %4
%5 = load double*, double** %3
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = fpext double %7 to x86_fp80
%9 = load double*, double** %3
%10 = getelementptr inbounds double, double* %9, i64 1
%11 = load double, double* %10
%12 = fpext double %11 to x86_fp80
%13 = fadd x86_fp80 %8, %12
%14 = load x86_fp80*, x86_fp80** %4
store x86_fp80 %13, x86_fp80* %14
ret i32 0
}

LLVM IR (-O2):
define i32 @doubledouble2longdouble(double* nocapture %0, x86_fp80* nocapture writeonly %1) {
%3 = load double, double* %0
%4 = fpext double %3 to x86_fp80
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = fpext double %6 to x86_fp80
%8 = fadd x86_fp80 %4, %7
store x86_fp80 %8, x86_fp80* %1
ret i32 0
}
/* Type definitions */
struct timespec {
  int tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ nanosleep(struct timespec const *, int /*<<< orphan*/ *);
__attribute__((unused)) void fio_reschedule_thread(void) {
  const struct timespec tm = {.tv_nsec = 1};
  nanosleep(&tm, NULL);
}


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

x86 assembly (clang, -O2):
<fio_reschedule_thread>:
push   %rax
movl   $0x1,(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <nanosleep@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@__const.fio_reschedule_thread.tm = %struct.timespec { i32 1 }
define void @fio_reschedule_thread() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = call i32 @nanosleep(%struct.timespec* %1, i32* null)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
define void @fio_reschedule_thread() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
store i32 1, i32* %3
%4 = call i32 @nanosleep(%struct.timespec* %1, i32* null)
ret void
}
/* Variables and functions */
void *calloc(unsigned int nmemb __attribute__((unused)),
             unsigned int size __attribute__((unused))) {
  return 0;
}


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

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

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

LLVM IR (-O2):
define noalias i8* @calloc(i32 %0, i32 %1) {
ret i8* null
}
/* Type definitions */
typedef unsigned long uint32_t;

/* Variables and functions */
void GPIOIntClear(uint32_t ui32Port, uint32_t ui32IntFlags) {
  ;
  (*((volatile unsigned long *)(ui32Port + 0x0000041C))) = ui32IntFlags;
}


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

x86 assembly (clang, -O2):
<GPIOIntClear>:
mov    %rsi,0x41c(%rdi)
ret

LLVM IR (-O0):
define void @GPIOIntClear(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %3
%7 = add i64 %6, 1052
%8 = inttoptr i64 %7 to i64*
store volatile i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @GPIOIntClear(i64 %0, i64 %1) {
%3 = add i64 %0, 1052
%4 = inttoptr i64 %3 to i64*
store volatile i64 %1, i64* %4
ret void
}
int test_imm_F4uint16_reg(unsigned short val) {
  return ((val) & (-0xF4 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_F4uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffff0c,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_F4uint16_reg>:
test   $0xff0c,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_F4uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -244
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ ft_putchar_fd(char, int);
void ft_putendl_fd(char const *s, int fd) {
  while (*s)
    ft_putchar_fd(*s++, fd);
  ft_putchar_fd('\n', fd);
}


x86 assembly (clang, -O0):
<ft_putendl_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114d <ft_putendl_fd+0x3d>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    -0xc(%rbp),%esi
movsbl %al,%edi
call   1030 <ft_putchar_fd@plt>
jmp    111f <ft_putendl_fd+0xf>
mov    -0xc(%rbp),%esi
mov    $0xa,%edi
call   1030 <ft_putchar_fd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putendl_fd>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    (%rdi),%al
test   %al,%al
je     1145 <ft_putendl_fd+0x35>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%edi
mov    %ebp,%esi
call   1030 <ft_putchar_fd@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <ft_putendl_fd+0x20>
mov    $0xa,%edi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <ft_putchar_fd@plt>

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

LLVM IR (-O2):
define void @ft_putendl_fd(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %10, %5 ], [ %3, %2 ]
%7 = phi i8* [ %8, %5 ], [ %0, %2 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = tail call i32 @ft_putchar_fd(i8 signext %6, i32 %1)
%10 = load i8, i8* %8
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %2
%13 = tail call i32 @ft_putchar_fd(i8 signext 10, i32 %1)
ret void
}
/* Variables and functions */
short acos(short);
short internal_acos_s(short value) { return acos(value); }


x86 assembly (clang, -O0):
<internal_acos_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edi
call   1030 <acos@plt>
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_acos_s>:
jmp    1030 <acos@plt>

LLVM IR (-O0):
define signext i16 @internal_acos_s(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = call signext i16 @acos(i16 signext %3)
ret i16 %4
}

LLVM IR (-O2):
define signext i16 @internal_acos_s(i16 signext %0) {
%2 = tail call signext i16 @acos(i16 signext %0)
ret i16 %2
}
unsigned long long int fibonacci(unsigned int n) {
  if (n == 0) {
    return (0);
  } else if (n == 1) {
    return (1);
  } else {
    return (fibonacci(n - 1) + fibonacci(n - 2));
  }
}


x86 assembly (clang, -O0):
<fibonacci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1132 <fibonacci+0x22>
movq   $0x0,-0x8(%rbp)
jmp    1171 <fibonacci+0x61>
cmpl   $0x1,-0xc(%rbp)
jne    1149 <fibonacci+0x39>
movq   $0x1,-0x8(%rbp)
jmp    1171 <fibonacci+0x61>
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
call   1030 <fibonacci@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
sub    $0x2,%edi
call   1030 <fibonacci@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibonacci>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %r14d,%r14d
test   %ebx,%ebx
je     1137 <fibonacci+0x27>
nopl   (%rax)
cmp    $0x1,%ebx
je     113b <fibonacci+0x2b>
lea    -0x1(%rbx),%edi
call   1030 <fibonacci@plt>
add    %rax,%r14
add    $0xfffffffe,%ebx
test   %ebx,%ebx
jne    1120 <fibonacci+0x10>
xor    %eax,%eax
jmp    1140 <fibonacci+0x30>
mov    $0x1,%eax
add    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @fibonacci(i32 %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i64 [ 0, %1 ], [ %9, %5 ]
%4 = phi i32 [ %0, %1 ], [ %8, %5 ]
switch i32 %4, label %5 [
i32 0, label %10
i32 1, label %11
]
5: ; preds = %2
%6 = add i32 %4, -1
%7 = tail call i64 @fibonacci(i32 %6)
%8 = add i32 %4, -2
%9 = add i64 %7, %3
br label %2
10: ; preds = %2
br label %11
11: ; preds = %2, %10
%12 = phi i64 [ 0, %10 ], [ 1, %2 ]
%13 = add i64 %12, %3
ret i64 %13
}
unsigned long elf_hash(const unsigned char *name) {
  unsigned long h = 0, g;
  while (*name) {
    h = (h << 4) + *name++;
    if (g = (h & 0xf0000000))
      h ^= g >> 24;
    h &= ~g;
  }
  return h;
}


x86 assembly (clang, -O0):
<elf_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     117f <elf_hash+0x7f>
mov    -0x10(%rbp),%rax
shl    $0x4,%rax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movzbl (%rcx),%ecx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
movabs $0xf0000000,%rax
and    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     116a <elf_hash+0x6a>
mov    -0x18(%rbp),%rax
shr    $0x18,%rax
xor    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
xor    $0xffffffffffffffff,%rax
and    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <elf_hash+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<elf_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     113d <elf_hash+0x3d>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
shl    $0x4,%rax
movzbl %cl,%ecx
add    %rax,%rcx
mov    %ecx,%eax
and    $0xf0000000,%eax
mov    %rax,%rdx
shr    $0x18,%rdx
xor    %rcx,%rdx
not    %rax
and    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <elf_hash+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @elf_hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
store i8* %0, i8** %2
store i64 0, i64* %3
br label %5
5: ; preds = %25, %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %30
9: ; preds = %5
%10 = load i64, i64* %3
%11 = shl i64 %10, 4
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %2
%14 = load i8, i8* %12
%15 = zext i8 %14 to i64
%16 = add i64 %11, %15
store i64 %16, i64* %3
%17 = load i64, i64* %3
%18 = and i64 %17, 4026531840
store i64 %18, i64* %4
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %9
%21 = load i64, i64* %4
%22 = lshr i64 %21, 24
%23 = load i64, i64* %3
%24 = xor i64 %23, %22
store i64 %24, i64* %3
br label %25
25: ; preds = %20, %9
%26 = load i64, i64* %4
%27 = xor i64 %26, -1
%28 = load i64, i64* %3
%29 = and i64 %28, %27
store i64 %29, i64* %3
br label %5
30: ; preds = %5
%31 = load i64, i64* %3
ret i64 %31
}

LLVM IR (-O2):
define i64 @elf_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %19, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %17, %4 ], [ %2, %1 ]
%6 = phi i8* [ %9, %4 ], [ %0, %1 ]
%7 = phi i64 [ %16, %4 ], [ 0, %1 ]
%8 = shl i64 %7, 4
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = zext i8 %5 to i64
%11 = add i64 %8, %10
%12 = and i64 %11, 4026531840
%13 = lshr exact i64 %12, 24
%14 = xor i64 %13, %11
%15 = xor i64 %12, -1
%16 = and i64 %14, %15
%17 = load i8, i8* %9
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %4
19: ; preds = %4, %1
%20 = phi i64 [ 0, %1 ], [ %16, %4 ]
ret i64 %20
}
int main(int argc, char **argv) { return 42 << 0 + 2 >> 1 * 2; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x2a,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 42
}
/* Variables and functions */
int EOF;
int getc(int /*<<< orphan*/);
int /*<<< orphan*/ putc(int, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(void) {
  int c;
  while (EOF != (c = getc(stdin)))
    putc(c, stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
call   1040 <getc@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
mov    %ecx,-0x8(%rbp)
cmp    %ecx,%eax
je     116f <main+0x4f>
mov    -0x8(%rbp),%edi
mov    0x2e6d(%rip),%rax
mov    (%rax),%esi
call   1030 <putc@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2eb2(%rip),%r14
mov    (%r14),%ebx
mov    0x2eb0(%rip),%r15
mov    (%r15),%edi
call   1040 <getc@plt>
cmp    %eax,%ebx
je     1168 <main+0x48>
mov    0x2e85(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%esi
mov    %eax,%edi
call   1030 <putc@plt>
mov    (%r14),%ebp
mov    (%r15),%edi
call   1040 <getc@plt>
cmp    %eax,%ebp
jne    1150 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
@stdin = global i32 0
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %8, %0
%4 = load i32, i32* @EOF
%5 = load i32, i32* @stdin
%6 = call i32 @getc(i32 %5)
store i32 %6, i32* %2
%7 = icmp ne i32 %4, %6
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = load i32, i32* %2
%10 = load i32, i32* @stdout
%11 = call i32 @putc(i32 %9, i32 %10)
br label %3
12: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@stdin = global i32 0
@stdout = global i32 0
define i32 @main() {
%1 = load i32, i32* @EOF
%2 = load i32, i32* @stdin
%3 = tail call i32 @getc(i32 %2)
%4 = icmp eq i32 %1, %3
br i1 %4, label %13, label %5
5: ; preds = %0, %5
%6 = phi i32 [ %11, %5 ], [ %3, %0 ]
%7 = load i32, i32* @stdout
%8 = tail call i32 @putc(i32 %6, i32 %7)
%9 = load i32, i32* @EOF
%10 = load i32, i32* @stdin
%11 = tail call i32 @getc(i32 %10)
%12 = icmp eq i32 %9, %11
br i1 %12, label %13, label %5
13: ; preds = %5, %0
ret i32 0
}
int do_635() { return 635; }


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

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

LLVM IR (-O0):
define i32 @do_635() {
ret i32 635
}

LLVM IR (-O2):
define i32 @do_635() {
ret i32 635
}
int bang(int x) {
  return ((((x >> 31) & 0x01) | (((~x + 1) >> 31) & 0x01)) ^ 0x01);
}


x86 assembly (clang, -O0):
<bang>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
and    $0x1,%eax
mov    -0x4(%rbp),%ecx
xor    $0xffffffff,%ecx
add    $0x1,%ecx
sar    $0x1f,%ecx
and    $0x1,%ecx
or     %ecx,%eax
xor    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bang>:
xor    %eax,%eax
test   %edi,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @bang(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 31
%5 = and i32 %4, 1
%6 = load i32, i32* %2
%7 = xor i32 %6, -1
%8 = add nsw i32 %7, 1
%9 = ashr i32 %8, 31
%10 = and i32 %9, 1
%11 = or i32 %5, %10
%12 = xor i32 %11, 1
ret i32 %12
}

LLVM IR (-O2):
define i32 @bang(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
void F_IntToStr(char *str, int i) { sprintf(str, "%i", i); }


x86 assembly (clang, -O0):
<F_IntToStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<F_IntToStr>:
mov    %esi,%edx
lea    0xee7(%rip),%rsi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
define void @F_IntToStr(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 i32, i32* %4
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
define void @F_IntToStr(i8* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ commas_in_double(char *, double);
char *place_commas_in_double(double d) {
  static char destination[64];
  commas_in_double(destination, d);
  return destination;
}


x86 assembly (clang, -O0):
<place_commas_in_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0x2f17(%rip),%rdi
call   1030 <commas_in_double@plt>
lea    0x2f0b(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<place_commas_in_double>:
push   %rbx
lea    0x2f28(%rip),%rbx
mov    %rbx,%rdi
call   1030 <commas_in_double@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@place_commas_in_double.destination = internal global [64 x i8] zeroinitializer
define i8* @place_commas_in_double(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @commas_in_double(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @place_commas_in_double.destination, i64 0, i64 0), double %3)
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @place_commas_in_double.destination, i64 0, i64 0)
}

LLVM IR (-O2):
@place_commas_in_double.destination = internal global [64 x i8] zeroinitializer
define i8* @place_commas_in_double(double %0) {
%2 = tail call i32 @commas_in_double(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @place_commas_in_double.destination, i64 0, i64 0), double %0)
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @place_commas_in_double.destination, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *getprogname();
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr, "Usage: %s [-T] [-h host] [-d domainname] mapname\n",
                getprogname());
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rdx
lea    0xea8(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    0x2ea8(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1030 <getprogname@plt>
lea    0xeb8(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [50 x i8] c"Usage: %s [-T] [-h host] [-d domainname] mapname\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i8* (...) @getprogname()
%3 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [50 x i8] c"Usage: %s [-T] [-h host] [-d domainname] mapname\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i8* (...) @getprogname()
%3 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ timer_t;

/* Variables and functions */
int timer_delete(int /*<<< orphan*/);
int mt_deactivate_alarm(timer_t timer) {
  int ret;
  ret = timer_delete(timer);
  if (ret)
    return ((ret > 0) ? -ret : ret);
  return 0;
}


x86 assembly (clang, -O0):
<mt_deactivate_alarm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <timer_delete@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1158 <mt_deactivate_alarm+0x48>
cmpl   $0x0,-0xc(%rbp)
jle    1147 <mt_deactivate_alarm+0x37>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    114d <mt_deactivate_alarm+0x3d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115f <mt_deactivate_alarm+0x4f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mt_deactivate_alarm>:
push   %rax
call   1030 <timer_delete@plt>
mov    %eax,%ecx
neg    %ecx
cmovns %eax,%ecx
cmovb  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @mt_deactivate_alarm(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @timer_delete(i32 %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %1
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* %4
%14 = sub nsw i32 0, %13
br label %17
15: ; preds = %9
%16 = load i32, i32* %4
br label %17
17: ; preds = %15, %12
%18 = phi i32 [ %14, %12 ], [ %16, %15 ]
store i32 %18, i32* %2
br label %20
19: ; preds = %1
store i32 0, i32* %2
br label %20
20: ; preds = %19, %17
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @mt_deactivate_alarm(i32 %0) {
%2 = tail call i32 @timer_delete(i32 %0)
%3 = icmp eq i32 %2, 0
%4 = tail call i32 @llvm.abs.i32(i32 %2, i1 false)
%5 = sub i32 0, %4
%6 = select i1 %3, i32 0, i32 %5
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t *getProtoData(uint8_t *data) { return &data[1]; }


x86 assembly (clang, -O0):
<getProtoData>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getProtoData>:
lea    0x4(%rdi),%rax
ret

LLVM IR (-O0):
define i32* @getProtoData(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 1
ret i32* %4
}

LLVM IR (-O2):
define i32* @getProtoData(i32* readnone %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
ret i32* %2
}
/* Variables and functions */
int /*<<< orphan*/ system_update(int);
int /*<<< orphan*/ window_render();
int window_update(int);
void platform_loop(void) {
  int rc;
  do {
    system_update(100);
    window_render();
    rc = window_update(100);
  } while (rc == 0);
}


x86 assembly (clang, -O0):
<platform_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x64,%edi
call   1040 <system_update@plt>
mov    $0x0,%al
call   1030 <window_render@plt>
mov    $0x64,%edi
call   1050 <window_update@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1138 <platform_loop+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<platform_loop>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x64,%edi
call   1040 <system_update@plt>
xor    %eax,%eax
call   1030 <window_render@plt>
mov    $0x64,%edi
call   1050 <window_update@plt>
test   %eax,%eax
je     1140 <platform_loop+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @platform_loop() {
%1 = alloca i32
br label %2
2: ; preds = %6, %0
%3 = call i32 @system_update(i32 100)
%4 = call i32 (...) @window_render()
%5 = call i32 @window_update(i32 100)
store i32 %5, i32* %1
br label %6
6: ; preds = %2
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 0
br i1 %8, label %2, label %9
9: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @platform_loop() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @system_update(i32 100)
%3 = tail call i32 (...) @window_render()
%4 = tail call i32 @window_update(i32 100)
%5 = icmp eq i32 %4, 0
br i1 %5, label %1, label %6
6: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ docfunctions(char *, char *);
void extfunc(char *filename) { docfunctions(filename, "-function"); }


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

x86 assembly (clang, -O2):
<extfunc>:
lea    0xee9(%rip),%rsi
jmp    1030 <docfunctions@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"-function\00"
define void @extfunc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @docfunctions(i8* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"-function\00"
define void @extfunc(i8* %0) {
%2 = tail call i32 @docfunctions(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ *wcsstr(int /*<<< orphan*/ const *,
                           int /*<<< orphan*/ const *);
wchar_t *wcswcs(const wchar_t *haystack, const wchar_t *needle) {
  return wcsstr(haystack, needle);
}


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

x86 assembly (clang, -O2):
<wcswcs>:
jmp    1030 <wcsstr@plt>

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

LLVM IR (-O2):
define i32* @wcswcs(i32* %0, i32* %1) {
%3 = tail call i32* @wcsstr(i32* %0, i32* %1)
ret i32* %3
}