xunge/DecIR huggingface dataset:
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  short member_0;
  short member_1;
  short member_2;
  short member_3;
  short member_4;
  short member_5;
  short member_6;
  short member_7;
};
typedef TYPE_1__ __v8hi;

/* Variables and functions */
__v8hi foo_10(short c) {
  __v8hi v1 = {c, c, c, c, c, c, c, c};
  return v1;
}


x86 assembly (clang, -O0):
<foo_10>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x12(%rbp)
mov    -0x12(%rbp),%ax
mov    %ax,-0x10(%rbp)
mov    -0x12(%rbp),%ax
mov    %ax,-0xe(%rbp)
mov    -0x12(%rbp),%ax
mov    %ax,-0xc(%rbp)
mov    -0x12(%rbp),%ax
mov    %ax,-0xa(%rbp)
mov    -0x12(%rbp),%ax
mov    %ax,-0x8(%rbp)
mov    -0x12(%rbp),%ax
mov    %ax,-0x6(%rbp)
mov    -0x12(%rbp),%ax
mov    %ax,-0x4(%rbp)
mov    -0x12(%rbp),%ax
mov    %ax,-0x2(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo_10>:
movzwl %di,%ecx
movabs $0x1000100010001,%rax
imul   %rcx,%rax
mov    %rax,%rdx
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i16, i16, i16, i16, i16, i16, i16, i16 }
define { i64, i64 } @foo_10(i16 signext %0) {
%2 = alloca %struct.TYPE_3__
%3 = alloca i16
store i16 %0, i16* %3
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 0
%5 = load i16, i16* %3
store i16 %5, i16* %4
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 1
%7 = load i16, i16* %3
store i16 %7, i16* %6
%8 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 2
%9 = load i16, i16* %3
store i16 %9, i16* %8
%10 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 3
%11 = load i16, i16* %3
store i16 %11, i16* %10
%12 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 4
%13 = load i16, i16* %3
store i16 %13, i16* %12
%14 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 5
%15 = load i16, i16* %3
store i16 %15, i16* %14
%16 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 6
%17 = load i16, i16* %3
store i16 %17, i16* %16
%18 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 7
%19 = load i16, i16* %3
store i16 %19, i16* %18
%20 = bitcast %struct.TYPE_3__* %2 to { i64, i64 }*
%21 = load { i64, i64 }, { i64, i64 }* %20
ret { i64, i64 } %21
}

LLVM IR (-O2):
define { i64, i64 } @foo_10(i16 signext %0) {
%2 = zext i16 %0 to i64
%3 = mul nuw i64 %2, 281479271743489
%4 = insertvalue { i64, i64 } poison, i64 %3, 0
%5 = insertvalue { i64, i64 } %4, i64 %3, 1
ret { i64, i64 } %5
}
/* Variables and functions */
size_t strlen(char *);
void chomp(char *s) {
  size_t sl = strlen(s);
  if (sl == 0)
    return;
  if (s[sl - 1] != '\n')
    return;
  s[sl - 1] = '\0';
}


x86 assembly (clang, -O0):
<chomp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1139 <chomp+0x29>
jmp    1167 <chomp+0x57>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
je     1157 <chomp+0x47>
jmp    1167 <chomp+0x57>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chomp>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %rax,%rax
je     112a <chomp+0x1a>
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    112a <chomp+0x1a>
movb   $0x0,-0x1(%rbx,%rax,1)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @chomp(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = add i64 %2, -1
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 10
br i1 %8, label %9, label %10
9: ; preds = %4
store i8 0, i8* %6
br label %10
10: ; preds = %4, %1, %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, long);
void print(char *stream, long i, long l) { write(1, &stream[i], l - i); }


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
add    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
sub    -0x10(%rbp),%rdx
mov    $0x1,%edi
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
lea    (%rdi,%rsi,1),%rax
sub    %rsi,%rdx
mov    $0x1,%edi
mov    %rax,%rsi
jmp    1030 <write@plt>

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

LLVM IR (-O2):
define void @print(i8* nocapture %0, i64 %1, i64 %2) {
%4 = getelementptr inbounds i8, i8* %0, i64 %1
%5 = sub nsw i64 %2, %1
%6 = tail call i32 @write(i32 1, i8* %4, i64 %5)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ remove(char *);
int sfd_assemble(FILE *in, char *name) {
  FILE *out;
  remove(name);
  out = fopen(name, "w");
  fclose(in);
  fclose(out);
  return 0;
}


x86 assembly (clang, -O0):
<sfd_assemble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <remove@plt>
mov    -0x10(%rbp),%rdi
lea    0xeac(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sfd_assemble>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <remove@plt>
lea    0xeb7(%rip),%rsi
mov    %rbx,%rdi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
define i32 @sfd_assemble(i32* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @remove(i8* %1)
%4 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @fclose(i32* %0)
%6 = tail call i32 @fclose(i32* %4)
ret i32 0
}
void puts(char *string) {
  __asm__("mov $0x02, %%eax" ::"b"(string));
  __asm__("int $0x83");
}


x86 assembly (clang, -O0):
<puts>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rbx
mov    $0x2,%eax
int    $0x83
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2,%eax
int    $0x83
pop    %rbx
ret

LLVM IR (-O0):
define void @puts(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
define void @puts(i8* %0) {
tail call void asm sideeffect "mov $$0x02, %eax", "{bx},~{dirflag},~{fpsr},~{flags}"(i8* %0)
tail call void asm sideeffect "int $$0x83", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
char *malloc(int);
void has_happened(char *strhold, char *event) {
  int c = 0;
  int d = 0;
  event = malloc(1000);
  while (strhold[c] != '\0') {
    event[d++] = strhold[c++];
    event[c + 1] = '\0';
  }
}


x86 assembly (clang, -O0):
<has_happened>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x3e8,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1191 <has_happened+0x81>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x18(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    113c <has_happened+0x2c>
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @has_happened(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ uart0_transmit(unsigned char const);
void uart0_print_hex(const unsigned char c) {
  const unsigned char hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
                                 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
  unsigned char high = (c & 0xF0) >> 4;
  unsigned char low = c & 0x0F;
  uart0_transmit(hex[high]);
  uart0_transmit(hex[low]);
}


x86 assembly (clang, -O0):
<uart0_print_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed8(%rip),%rax
mov    %rax,-0x18(%rbp)
movzbl -0x1(%rbp),%eax
and    $0xf0,%eax
sar    $0x4,%eax
mov    %al,-0x21(%rbp)
movzbl -0x1(%rbp),%eax
and    $0xf,%eax
mov    %al,-0x22(%rbp)
movzbl -0x21(%rbp),%eax
movzbl -0x20(%rbp,%rax,1),%edi
call   1030 <uart0_transmit@plt>
movzbl -0x22(%rbp),%eax
movzbl -0x20(%rbp,%rax,1),%edi
call   1030 <uart0_transmit@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart0_print_hex>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %rbx,%rax
shr    $0x4,%rax
and    $0xf,%ebx
lea    0xed9(%rip),%r14
movzbl (%rax,%r14,1),%edi
call   1030 <uart0_transmit@plt>
movzbl (%rbx,%r14,1),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <uart0_transmit@plt>

LLVM IR (-O0):
@__const.uart0_print_hex.hex = [16 x i8] c"0123456789ABCDEF"
define void @uart0_print_hex(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca [16 x i8]
%4 = alloca i8
%5 = alloca i8
store i8 %0, i8* %2
%6 = bitcast [16 x i8]* %3 to i8*
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = and i32 %8, 240
%10 = ashr i32 %9, 4
%11 = trunc i32 %10 to i8
store i8 %11, i8* %4
%12 = load i8, i8* %2
%13 = zext i8 %12 to i32
%14 = and i32 %13, 15
%15 = trunc i32 %14 to i8
store i8 %15, i8* %5
%16 = load i8, i8* %4
%17 = zext i8 %16 to i64
%18 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = call i32 @uart0_transmit(i8 zeroext %19)
%21 = load i8, i8* %5
%22 = zext i8 %21 to i64
%23 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = call i32 @uart0_transmit(i8 zeroext %24)
ret void
}

LLVM IR (-O2):
@__const.uart0_print_hex.hex = [16 x i8] c"0123456789ABCDEF"
define void @uart0_print_hex(i8 zeroext %0) {
%2 = lshr i8 %0, 4
%3 = and i8 %0, 15
%4 = zext i8 %2 to i64
%5 = getelementptr inbounds [16 x i8], [16 x i8]* @__const.uart0_print_hex.hex, i64 0, i64 %4
%6 = load i8, i8* %5
%7 = tail call i32 @uart0_transmit(i8 zeroext %6)
%8 = zext i8 %3 to i64
%9 = getelementptr inbounds [16 x i8], [16 x i8]* @__const.uart0_print_hex.hex, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = tail call i32 @uart0_transmit(i8 zeroext %10)
ret void
}
/* Variables and functions */
int f116(int *);
int f117(int *p) { return f116(p); }


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

x86 assembly (clang, -O2):
<f117>:
jmp    1030 <f116@plt>

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

LLVM IR (-O2):
define i32 @f117(i32* %0) {
%2 = tail call i32 @f116(i32* %0)
ret i32 %2
}
/* Type definitions */
struct httpchannel {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ httpch_cleanup(struct httpchannel *);
void worker_cleanup(void *p) {
  struct httpchannel *hc = p;
  httpch_cleanup(hc);
}


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

x86 assembly (clang, -O2):
<worker_cleanup>:
jmp    1030 <httpch_cleanup@plt>

LLVM IR (-O0):
%struct.httpchannel = type { i32 }
define void @worker_cleanup(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.httpchannel*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to %struct.httpchannel*
store %struct.httpchannel* %5, %struct.httpchannel** %3
%6 = load %struct.httpchannel*, %struct.httpchannel** %3
%7 = call i32 @httpch_cleanup(%struct.httpchannel* %6)
ret void
}

LLVM IR (-O2):
%struct.httpchannel = type { i32 }
define void @worker_cleanup(i8* %0) {
%2 = bitcast i8* %0 to %struct.httpchannel*
%3 = tail call i32 @httpch_cleanup(%struct.httpchannel* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void divByZeroError(int a) {
  printf("Error!\n");
  exit(1);
}


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

x86 assembly (clang, -O2):
<divByZeroError>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Error!\0A\00"
define void @divByZeroError(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [7 x i8] c"Error!\00"
define void @divByZeroError(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
void decl_func2(cmpfn) int cmpfn();
{ printf("cmpfn=%lx\n", (long)cmpfn); }


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

x86 assembly (clang, -O2):
<decl_func2>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"cmpfn=%lx\0A\00"
define void @decl_func2(i32 (...)* %0) {
%2 = alloca i32 (...)*
store i32 (...)* %0, i32 (...)** %2
%3 = load i32 (...)*, i32 (...)** %2
%4 = ptrtoint i32 (...)* %3 to i64
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 %4)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"cmpfn=%lx\0A\00"
define void @decl_func2(i32 (...)* %0) {
%2 = ptrtoint i32 (...)* %0 to i64
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 %2)
ret void
}
/* Variables and functions */
int calculate_fib(int);
int /*<<< orphan*/ printf(char *, int, int);
int test() {
  int i = 0;
  for (i = 0; i <= 45; ++i) {
    printf("%d: %d\n", i, calculate_fib(i));
  }
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x2d,-0x8(%rbp)
jg     116d <test+0x4d>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <calculate_fib@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <test+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xed3(%rip),%r14
nopl   (%rax)
mov    %ebx,%edi
call   1030 <calculate_fib@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x2e,%ebx
jne    1130 <test+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"%d: %d\0A\00"
define i32 @test() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %5, %1 ]
%3 = tail call i32 @calculate_fib(i32 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
%5 = add nuw nsw i32 %2, 1
%6 = icmp eq i32 %5, 46
br i1 %6, label %7, label %1
7: ; preds = %1
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(void) {
  int a, b;
  scanf("%d %d", &a, &b);
  printf("%d %d\n", b, a);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %2
%7 = load i32, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ unlink(char *);
void pidfile_remove(void) { unlink("/run/target-isns.pid"); }


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"/run/target-isns.pid\00"
define void @pidfile_remove() {
%1 = call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"/run/target-isns.pid\00"
define void @pidfile_remove() {
%1 = tail call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}
unsigned GetFieldW32(unsigned *A, register unsigned index) { return A[index]; }


x86 assembly (clang, -O0):
<GetFieldW32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetFieldW32>:
mov    %esi,%eax
mov    (%rdi,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @GetFieldW32(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 = zext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
%9 = load i32, i32* %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @GetFieldW32(i32* nocapture %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
ret i32 %5
}
/* Variables and functions */
int sum(int, int);
int main(void) {
  int a = 10;
  int b = 10;
  int c = sum(a, b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <sum@plt>
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @sum(i32 10, i32 10)
ret i32 0
}
void f6(struct z { int b; } c) {
  struct z d;
  d.b = 4;
}


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

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

LLVM IR (-O0):
%struct.z = type { i32 }
define void @f6(i32 %0) {
%2 = alloca %struct.z
%3 = alloca %struct.z
%4 = getelementptr inbounds %struct.z, %struct.z* %2, i32 0, i32 0
store i32 %0, i32* %4
%5 = getelementptr inbounds %struct.z, %struct.z* %3, i32 0, i32 0
store i32 4, i32* %5
ret void
}

LLVM IR (-O2):
define void @f6(i32 %0) {
ret void
}
/* Variables and functions */
int f51(int *);
int f52(int *p) { return f51(p); }


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

x86 assembly (clang, -O2):
<f52>:
jmp    1030 <f51@plt>

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

LLVM IR (-O2):
define i32 @f52(i32* %0) {
%2 = tail call i32 @f51(i32* %0)
ret i32 %2
}
/* Variables and functions */
int strncasecmp(char const *, char const *, int);
int g_strncasecmp(const char *c1, const char *c2, int len) {
  return strncasecmp(c1, c2, len);
}


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

x86 assembly (clang, -O2):
<g_strncasecmp>:
jmp    1030 <strncasecmp@plt>

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

LLVM IR (-O2):
define i32 @g_strncasecmp(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @strncasecmp(i8* %0, i8* %1, i32 %2)
ret i32 %4
}
int f() {
  static int x = 1;
  return x;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f16(%rip),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@f.x = internal global i32 1
define i32 @f() {
%1 = load i32, i32* @f.x
ret i32 %1
}

LLVM IR (-O2):
define i32 @f() {
ret i32 1
}
int cost_add(int c1, int c2) {
  if (c1 >= 10000 || c2 >= 10000 || c1 + c2 >= 10000)
    return 10000;
  else
    return c1 + c2;
}


x86 assembly (clang, -O0):
<cost_add>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x2710,-0x8(%rbp)
jge    1135 <cost_add+0x35>
cmpl   $0x2710,-0xc(%rbp)
jge    1135 <cost_add+0x35>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    $0x2710,%eax
jl     1141 <cost_add+0x41>
movl   $0x2710,-0x4(%rbp)
jmp    114a <cost_add+0x4a>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cost_add>:
lea    (%rsi,%rdi,1),%eax
cmp    $0x2710,%eax
mov    $0x2710,%ecx
cmovge %ecx,%eax
cmp    $0x2710,%esi
cmovge %ecx,%eax
cmp    $0x2710,%edi
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @cost_add(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 9999
%4 = icmp sgt i32 %1, 9999
%5 = or i1 %3, %4
%6 = add nsw i32 %1, %0
%7 = icmp slt i32 %6, 10000
%8 = select i1 %7, i32 %6, i32 10000
%9 = select i1 %5, i32 10000, i32 %8
ret i32 %9
}
/* Variables and functions */
scalar_t__ uwsgi_endswith(char *, char *);
int /*<<< orphan*/ uwsgi_opt_load_config(char *, char *, void *);
int /*<<< orphan*/ uwsgi_opt_load_ini(char *, char *, void *);
void uwsgi_opt_load(char *opt, char *filename, void *none) {
  if (uwsgi_endswith(filename, ".ini")) {
    uwsgi_opt_load_ini(opt, filename, none);
    return;
  }
  uwsgi_opt_load_config(opt, filename, none);
}


x86 assembly (clang, -O0):
<uwsgi_opt_load>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb1(%rip),%rsi
call   1030 <uwsgi_endswith@plt>
cmp    $0x0,%rax
je     1174 <uwsgi_opt_load+0x44>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <uwsgi_opt_load_ini@plt>
jmp    1185 <uwsgi_opt_load+0x55>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <uwsgi_opt_load_config@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uwsgi_opt_load>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0xebb(%rip),%rsi
mov    %rbx,%rdi
call   1030 <uwsgi_endswith@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
test   %rax,%rax
je     1165 <uwsgi_opt_load+0x35>
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <uwsgi_opt_load_ini@plt>
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <uwsgi_opt_load_config@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c".ini\00"
define void @uwsgi_opt_load(i8* %0, i8* %1, i8* %2) {
%4 = tail call i64 @uwsgi_endswith(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @uwsgi_opt_load_ini(i8* %0, i8* %1, i8* %2)
br label %10
8: ; preds = %3
%9 = tail call i32 @uwsgi_opt_load_config(i8* %0, i8* %1, i8* %2)
br label %10
10: ; preds = %8, %6
ret void
}
int fun729() { return 729; }


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

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

LLVM IR (-O0):
define i32 @fun729() {
ret i32 729
}

LLVM IR (-O2):
define i32 @fun729() {
ret i32 729
}
/* Type definitions */
typedef char *ssize_t;

/* Variables and functions */
char *set_errno(int);
ssize_t write(int fd, const void *buffer, size_t length) {
  int r;
  __asm__ __volatile__("\tmov $4, %%eax\n"
                       "\tint $0x80\n"
                       : "=a"(r)
                       : "b"(fd), "c"(buffer), "d"(length)
                       : "memory");
  return set_errno(r);
}


x86 assembly (clang, -O0):
<write>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x28,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0xc(%rbp),%ebx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rdx
mov    $0x4,%eax
int    $0x80
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
call   1030 <set_errno@plt>
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<write>:
push   %rbx
mov    %rsi,%rcx
mov    %edi,%ebx
mov    $0x4,%eax
int    $0x80
mov    %eax,%edi
pop    %rbx
jmp    1030 <set_errno@plt>

LLVM IR (-O0):
define i8* @write(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i32, i32* %4
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = call i32 asm sideeffect "\09mov $$4, %eax\0A\09int $$0x80\0A", "={ax},{bx},{cx},{dx},~{memory},~{dirflag},~{fpsr},~{flags}"(i32 %8, i8* %9, i64 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = call i8* @set_errno(i32 %12)
ret i8* %13
}

LLVM IR (-O2):
define i8* @write(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 asm sideeffect "\09mov $$4, %eax\0A\09int $$0x80\0A", "={ax},{bx},{cx},{dx},~{memory},~{dirflag},~{fpsr},~{flags}"(i32 %0, i8* %1, i64 %2)
%5 = tail call i8* @set_errno(i32 %4)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ mul(size_t, size_t);
void *xrealloc(void *, int /*<<< orphan*/);
void *xreallocn(void *ptr, size_t count, size_t elemsize) {
  return xrealloc(ptr, mul(count, elemsize));
}


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

x86 assembly (clang, -O2):
<xreallocn>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1040 <mul@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <xrealloc@plt>

LLVM IR (-O0):
define i8* @xreallocn(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = load i64, i64* %6
%10 = call i32 @mul(i64 %8, i64 %9)
%11 = call i8* @xrealloc(i8* %7, i32 %10)
ret i8* %11
}

LLVM IR (-O2):
define i8* @xreallocn(i8* %0, i64 %1, i64 %2) {
%4 = tail call i32 @mul(i64 %1, i64 %2)
%5 = tail call i8* @xrealloc(i8* %0, i32 %4)
ret i8* %5
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv) {
  char *x;
  puts("Hello!");
  puts("This is a test");
  x = (char *)malloc(16);
  return 1337;
}


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)
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
mov    $0x10,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x539,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x10,%edi
call   1040 <malloc@plt>
mov    $0x539,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"Hello!\00"
@.str.1 = [15 x i8] c"This is a test\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%9 = call i64 @malloc(i32 16)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %6
ret i32 1337
}

LLVM IR (-O2):
@.str = [7 x i8] c"Hello!\00"
@.str.1 = [15 x i8] c"This is a test\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i64 @malloc(i32 16)
ret i32 1337
}
/* Variables and functions */
int rand();
int main(void) { return (rand() % 255 + 1); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0xff,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0xffffffff80808081,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x7,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x8,%edx
sub    %edx,%ecx
add    %ecx,%eax
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 255
%4 = add nsw i32 %3, 1
ret i32 %4
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 255
%3 = add nsw i32 %2, 1
ret i32 %3
}
void foo490(int p) {}


x86 assembly (clang, -O0):
<foo490>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @foo490(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _SC_OPEN_MAX;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int sysconf(int /*<<< orphan*/);
int openmax() {
  int openmax = 0;
  if ((openmax = sysconf(_SC_OPEN_MAX)) < 0) {
    fprintf(stderr, "sysconf error error for _SC_OPEN_MAX");
    openmax = 1024;
  }
  return openmax;
}


x86 assembly (clang, -O0):
<openmax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
call   1040 <sysconf@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jge    1165 <openmax+0x45>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
lea    0xea7(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x400,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openmax>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
call   1040 <sysconf@plt>
test   %eax,%eax
js     1135 <openmax+0x15>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xebb(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x400,%eax
pop    %rcx
ret

LLVM IR (-O0):
@_SC_OPEN_MAX = global i32 0
@stderr = global i32 0
@.str = [37 x i8] c"sysconf error error for _SC_OPEN_MAX\00"
define i32 @openmax() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @_SC_OPEN_MAX
%3 = call i32 @sysconf(i32 %2)
store i32 %3, i32* %1
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
store i32 1024, i32* %1
br label %8
8: ; preds = %5, %0
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
@_SC_OPEN_MAX = global i32 0
@stderr = global i32 0
@.str = [37 x i8] c"sysconf error error for _SC_OPEN_MAX\00"
define i32 @openmax() {
%1 = load i32, i32* @_SC_OPEN_MAX
%2 = tail call i32 @sysconf(i32 %1)
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %4, %0
%8 = phi i32 [ 1024, %4 ], [ %2, %0 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ link_failure_tan();
scalar_t__ tan(double);
void test_tan(double d) {
  if (tan(d) != tan(d))
    link_failure_tan();
}


x86 assembly (clang, -O0):
<test_tan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <tan@plt>
mov    %rax,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <tan@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
je     115c <test_tan+0x3c>
mov    $0x0,%al
call   1030 <link_failure_tan@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_tan>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
call   1040 <tan@plt>
mov    %rax,%rbx
movsd  0x8(%rsp),%xmm0
call   1040 <tan@plt>
cmp    %rax,%rbx
jne    1149 <test_tan+0x29>
add    $0x10,%rsp
pop    %rbx
ret
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1030 <link_failure_tan@plt>

LLVM IR (-O0):
define void @test_tan(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i64 @tan(double %3)
%5 = load double, double* %2
%6 = call i64 @tan(double %5)
%7 = icmp ne i64 %4, %6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @link_failure_tan()
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
define void @test_tan(double %0) {
%2 = tail call i64 @tan(double %0)
%3 = tail call i64 @tan(double %0)
%4 = icmp eq i64 %2, %3
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @link_failure_tan()
br label %7
7: ; preds = %5, %1
ret void
}
int getuid(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @getuid() {
ret i32 1
}

LLVM IR (-O2):
define i32 @getuid() {
ret i32 1
}
/* Variables and functions */
int strcspn(char *, char *);
int strlen(char *);
int tosString_locateSomeChar(char *s, char *chars, int startingAt) {
  int i = strlen(s);
  if (i > startingAt)
    i = startingAt;
  if (i < 0)
    i = 0;
  return i + strcspn(s + i, chars);
}


x86 assembly (clang, -O0):
<tosString_locateSomeChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1151 <tosString_locateSomeChar+0x31>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1162 <tosString_locateSomeChar+0x42>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x18(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcspn@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tosString_locateSomeChar>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %eax,%ebx
cmp    %ebp,%eax
cmovg  %ebp,%ebx
xor    %eax,%eax
test   %ebx,%ebx
cmovs  %eax,%ebx
lea    (%rbx,%r15,1),%rdi
mov    %r14,%rsi
call   1040 <strcspn@plt>
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @tosString_locateSomeChar(i8* %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp sgt i32 %4, %2
%6 = select i1 %5, i32 %2, i32 %4
%7 = icmp sgt i32 %6, 0
%8 = select i1 %7, i32 %6, i32 0
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = tail call i32 @strcspn(i8* %10, i8* %1)
%12 = add nsw i32 %8, %11
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int siginterrupt(int sig, int interrupt) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<siginterrupt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ec3(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<siginterrupt>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @siginterrupt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @ENOSYS
%6 = call i32 @__set_errno(i32 %5)
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @siginterrupt(i32 %0, i32 %1) {
%3 = load i32, i32* @ENOSYS
%4 = tail call i32 @__set_errno(i32 %3)
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ sgen(char *, char *, char *);
void cgldgb(char *s) { sgen("%s\t%s,%%al", "movb", s); }


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

x86 assembly (clang, -O2):
<cgldgb>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xeea(%rip),%rsi
jmp    1030 <sgen@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"%s\09%s,%%al\00"
@.str.1 = [5 x i8] c"movb\00"
define void @cgldgb(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @sgen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"%s\09%s,%%al\00"
@.str.1 = [5 x i8] c"movb\00"
define void @cgldgb(i8* %0) {
%2 = tail call i32 @sgen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
void textmode(int i) {}


x86 assembly (clang, -O0):
<textmode>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @textmode(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void macscp4_2_from_macscp2() {
  puts("macscp4_2_"
       "from_macscp2");
}


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

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

LLVM IR (-O0):
@.str = [23 x i8] c"macscp4_2_from_macscp2\00"
define void @macscp4_2_from_macscp2() {
%1 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"macscp4_2_from_macscp2\00"
define void @macscp4_2_from_macscp2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
void *malloc(size_t);
void *csp_malloc(size_t size) { return malloc(size); }


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

x86 assembly (clang, -O2):
<csp_malloc>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @csp_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}