xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ errx(int, char *, size_t);
void *malloc(size_t);
void *xmalloc(size_t size) {
  void *ptr = malloc(size);
  if (size > 0 && ptr == NULL)
    errx(100, "Memory allocation failure (%u bytes)", size);
  return ptr;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jbe    1164 <xmalloc+0x44>
cmpq   $0x0,-0x10(%rbp)
jne    1164 <xmalloc+0x44>
mov    -0x8(%rbp),%rdx
mov    $0x64,%edi
lea    0xea1(%rip),%rsi
call   1030 <errx@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <malloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     114d <xmalloc+0x2d>
test   %r14,%r14
jne    114d <xmalloc+0x2d>
lea    0xec0(%rip),%rsi
mov    $0x64,%edi
mov    %rbx,%rdx
call   1030 <errx@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Memory allocation failure (%u bytes)\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i64, i64* %2
%7 = icmp ugt i64 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i64, i64* %2
%13 = call i32 @errx(i32 100, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %12)
br label %14
14: ; preds = %11, %8, %1
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@.str = [37 x i8] c"Memory allocation failure (%u bytes)\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp ne i64 %0, 0
%4 = icmp eq i8* %2, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @errx(i32 100, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %0)
br label %8
8: ; preds = %6, %1
ret i8* %2
}
int egsy_gcm_csr_dataout2_set(unsigned int dev_id,
                              union egsy_gcm_csr_dataout2_u *value) {
  return 1;
}


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

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

LLVM IR (-O0):
%union.egsy_gcm_csr_dataout2_u = type opaque
define i32 @egsy_gcm_csr_dataout2_set(i32 %0, %union.egsy_gcm_csr_dataout2_u* %1) {
%3 = alloca i32
%4 = alloca %union.egsy_gcm_csr_dataout2_u*
store i32 %0, i32* %3
store %union.egsy_gcm_csr_dataout2_u* %1, %union.egsy_gcm_csr_dataout2_u** %4
ret i32 1
}

LLVM IR (-O2):
%union.egsy_gcm_csr_dataout2_u = type opaque
define i32 @egsy_gcm_csr_dataout2_set(i32 %0, %union.egsy_gcm_csr_dataout2_u* nocapture readnone %1) {
ret i32 1
}
int foo(int *a, int *b, int c) {
  *a *= 2;
  *b /= 2;
  c = *a + *b;
  return c;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
shl    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
add    (%rcx),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
shll   (%rdi)
mov    (%rsi),%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
mov    %eax,(%rsi)
add    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @foo(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = mul nsw i32 %8, 2
store i32 %9, i32* %7
%10 = load i32*, i32** %5
%11 = load i32, i32* %10
%12 = sdiv i32 %11, 2
store i32 %12, i32* %10
%13 = load i32*, i32** %4
%14 = load i32, i32* %13
%15 = load i32*, i32** %5
%16 = load i32, i32* %15
%17 = add nsw i32 %14, %16
store i32 %17, i32* %6
%18 = load i32, i32* %6
ret i32 %18
}

LLVM IR (-O2):
define i32 @foo(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = load i32, i32* %0
%5 = shl nsw i32 %4, 1
store i32 %5, i32* %0
%6 = load i32, i32* %1
%7 = sdiv i32 %6, 2
store i32 %7, i32* %1
%8 = load i32, i32* %0
%9 = add nsw i32 %8, %7
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ i2d_of_void;
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ EVP_PKEY;

/* Variables and functions */
int PEM_ASN1_write(int /*<<< orphan*/ *, int /*<<< orphan*/,
                   int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                   int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                   int /*<<< orphan*/, int /*<<< orphan*/ *,
                   int /*<<< orphan*/ *);
int /*<<< orphan*/ PEM_STRING_PUBLIC;
scalar_t__ i2d_PUBKEY;
int PEM_write_PUBKEY(FILE *fp, EVP_PKEY *x) {
  return PEM_ASN1_write((i2d_of_void *)i2d_PUBKEY, PEM_STRING_PUBLIC, fp, x,
                        NULL, NULL, 0, NULL, NULL);
}


x86 assembly (clang, -O0):
<PEM_write_PUBKEY>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%rdi
mov    0x2eb7(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r9d
xor    %eax,%eax
mov    %r9,%r8
movl   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
call   1030 <PEM_ASN1_write@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PEM_write_PUBKEY>:
sub    $0x18,%rsp
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2ebf(%rip),%rax
mov    (%rax),%rdi
mov    0x2ebd(%rip),%rax
mov    (%rax),%esi
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rsp)
movl   $0x0,(%rsp)
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <PEM_ASN1_write@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@i2d_PUBKEY = global i64 0
@PEM_STRING_PUBLIC = global i32 0
define i32 @PEM_write_PUBKEY(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i64, i64* @i2d_PUBKEY
%6 = inttoptr i64 %5 to i32*
%7 = load i32, i32* @PEM_STRING_PUBLIC
%8 = load i32*, i32** %3
%9 = load i32*, i32** %4
%10 = call i32 @PEM_ASN1_write(i32* %6, i32 %7, i32* %8, i32* %9, i32* null, i32* null, i32 0, i32* null, i32* null)
ret i32 %10
}

LLVM IR (-O2):
@i2d_PUBKEY = global i64 0
@PEM_STRING_PUBLIC = global i32 0
define i32 @PEM_write_PUBKEY(i32* %0, i32* %1) {
%3 = load i64, i64* @i2d_PUBKEY
%4 = inttoptr i64 %3 to i32*
%5 = load i32, i32* @PEM_STRING_PUBLIC
%6 = tail call i32 @PEM_ASN1_write(i32* %4, i32 %5, i32* %0, i32* %1, i32* null, i32* null, i32 0, i32* null, i32* null)
ret i32 %6
}
void Delay(unsigned int Cycles) {
  while (Cycles != 0) {
    Cycles--;
  }
}


x86 assembly (clang, -O0):
<Delay>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     111f <Delay+0x1f>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    1107 <Delay+0x7>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @Delay(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %6, %1
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* %2
%8 = add i32 %7, -1
store i32 %8, i32* %2
br label %3
9: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @Delay(i32 %0) {
ret void
}
/* Variables and functions */
int foo(int, int);
int entrypoint() { return foo(4, 5); }


x86 assembly (clang, -O0):
<entrypoint>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
mov    $0x5,%esi
call   1030 <foo@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<entrypoint>:
mov    $0x4,%edi
mov    $0x5,%esi
jmp    1030 <foo@plt>

LLVM IR (-O0):
define i32 @entrypoint() {
%1 = call i32 @foo(i32 4, i32 5)
ret i32 %1
}

LLVM IR (-O2):
define i32 @entrypoint() {
%1 = tail call i32 @foo(i32 4, i32 5)
ret i32 %1
}
void make_black(unsigned char *pixel) {
  pixel[0] = pixel[1] = pixel[2] = (unsigned char)0;
}


x86 assembly (clang, -O0):
<make_black>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,0x2(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_black>:
movb   $0x0,0x2(%rdi)
movw   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @make_black(i8* nocapture writeonly %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 2
store i8 0, i8* %2
%3 = getelementptr inbounds i8, i8* %0, i64 1
store i8 0, i8* %3
store i8 0, i8* %0
ret void
}
void put_pixel(int x, int y, int h, int w, char canvas[h][w]) {
  if ((x < w && y < h) && (x >= 0 && y >= 0))
    canvas[y][x] = '#';
}


x86 assembly (clang, -O0):
<put_pixel>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1162 <put_pixel+0x62>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1162 <put_pixel+0x62>
cmpl   $0x0,-0x4(%rbp)
jl     1162 <put_pixel+0x62>
cmpl   $0x0,-0x8(%rbp)
jl     1162 <put_pixel+0x62>
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
imul   %rdx,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
movb   $0x23,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_pixel>:
cmp    %ecx,%edi
jge    1122 <put_pixel+0x22>
mov    %esi,%eax
or     %edi,%eax
js     1122 <put_pixel+0x22>
cmp    %edx,%esi
jge    1122 <put_pixel+0x22>
mov    %ecx,%eax
movslq %esi,%rcx
imul   %rax,%rcx
add    %rcx,%r8
movslq %edi,%rax
movb   $0x23,(%rax,%r8,1)
ret

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

LLVM IR (-O2):
define void @put_pixel(i32 %0, i32 %1, i32 %2, i32 %3, i8* nocapture writeonly %4) {
%6 = zext i32 %3 to i64
%7 = icmp slt i32 %0, %3
br i1 %7, label %8, label %19
8: ; preds = %5
%9 = icmp slt i32 %1, %2
%10 = or i32 %1, %0
%11 = icmp sgt i32 %10, -1
%12 = and i1 %11, %9
br i1 %12, label %13, label %19
13: ; preds = %8
%14 = sext i32 %1 to i64
%15 = mul nsw i64 %6, %14
%16 = getelementptr inbounds i8, i8* %4, i64 %15
%17 = sext i32 %0 to i64
%18 = getelementptr inbounds i8, i8* %16, i64 %17
store i8 35, i8* %18
br label %19
19: ; preds = %13, %8, %5
ret void
}
/* Variables and functions */
long open_max();
int /*<<< orphan*/ printf(char *, long);
int main(int argc, char **argv) {
  long omax = open_max();
  printf("open_max is %ld\n", omax);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <open_max@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [17 x i8] c"open_max is %ld\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @open_max()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %3)
ret i32 0
}
/* Variables and functions */
int strlen(char *);
void chomp(char *text) {
  if (text[strlen(text) - 1] == '\n')
    text[strlen(text) - 1] = '\0';
}


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

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

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

LLVM IR (-O2):
define void @chomp(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 10
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = tail call i32 @strlen(i8* %0)
%10 = add nsw i32 %9, -1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %0, i64 %11
store i8 0, i8* %12
br label %13
13: ; preds = %8, %1
ret void
}
/* Type definitions */
struct section_list_link {
  int dummy;
};
struct genlist_link {
  int dummy;
};

/* Variables and functions */
scalar_t__ genlist_link_next(struct genlist_link const *);
struct section_list_link *
section_list_link_next(const struct section_list_link *plink) {
  return ((struct section_list_link *)genlist_link_next(
      (const struct genlist_link *)plink));
}


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

x86 assembly (clang, -O2):
<section_list_link_next>:
jmp    1030 <genlist_link_next@plt>

LLVM IR (-O0):
%struct.section_list_link = type { i32 }
%struct.genlist_link = type { i32 }
define %struct.section_list_link* @section_list_link_next(%struct.section_list_link* %0) {
%2 = alloca %struct.section_list_link*
store %struct.section_list_link* %0, %struct.section_list_link** %2
%3 = load %struct.section_list_link*, %struct.section_list_link** %2
%4 = bitcast %struct.section_list_link* %3 to %struct.genlist_link*
%5 = call i64 @genlist_link_next(%struct.genlist_link* %4)
%6 = inttoptr i64 %5 to %struct.section_list_link*
ret %struct.section_list_link* %6
}

LLVM IR (-O2):
%struct.section_list_link = type { i32 }
%struct.genlist_link = type { i32 }
define %struct.section_list_link* @section_list_link_next(%struct.section_list_link* %0) {
%2 = bitcast %struct.section_list_link* %0 to %struct.genlist_link*
%3 = tail call i64 @genlist_link_next(%struct.genlist_link* %2)
%4 = inttoptr i64 %3 to %struct.section_list_link*
ret %struct.section_list_link* %4
}
void capturingComment2CAPTURING_COMMENT() {}


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

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

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

LLVM IR (-O2):
define void @capturingComment2CAPTURING_COMMENT() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_7936() {
  Assert_real((isqrt(7936) == 89),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/stdlib/isqrt.c",
              1440, ("Integer square root of 7936 should be 89"));
}


x86 assembly (clang, -O0):
<t_sqrt_7936>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1f00,%edi
call   1030 <isqrt@plt>
cmp    $0x59,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x5a0,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_7936>:
push   %rax
mov    $0x1f00,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0x59,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x5a0,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [41 x i8] c"Integer square root of 7936 should be 89\00"
define void @t_sqrt_7936() {
%1 = call i32 @isqrt(i32 7936)
%2 = icmp eq i32 %1, 89
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1440, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [41 x i8] c"Integer square root of 7936 should be 89\00"
define void @t_sqrt_7936() {
%1 = tail call i32 @isqrt(i32 7936)
%2 = icmp eq i32 %1, 89
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1440, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
ret void
}
radecsys_f2u(i, vf, cbuf, sht, flt, dub, intype, inmult, tbuf) int i, inmult,
    *vf;
char *cbuf, *tbuf, intype;
short *sht;
float *flt;
double *dub;
{}


x86 assembly (clang, -O0):
<radecsys_f2u>:
push   %rbp
mov    %rsp,%rbp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    %al,-0x31(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @radecsys_f2u(i32 %0, i32* %1, i8* %2, i16* %3, float* %4, double* %5, i32 %6, i32 %7, i8* %8) {
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i8*
%14 = alloca i16*
%15 = alloca float*
%16 = alloca double*
%17 = alloca i8
%18 = alloca i32
%19 = alloca i8*
%20 = trunc i32 %6 to i8
store i32 %0, i32* %11
store i32* %1, i32** %12
store i8* %2, i8** %13
store i16* %3, i16** %14
store float* %4, float** %15
store double* %5, double** %16
store i8 %20, i8* %17
store i32 %7, i32* %18
store i8* %8, i8** %19
%21 = load i32, i32* %10
ret i32 %21
}

LLVM IR (-O2):
define i32 @radecsys_f2u(i32 %0, i32* nocapture readnone %1, i8* nocapture readnone %2, i16* nocapture readnone %3, float* nocapture readnone %4, double* nocapture readnone %5, i32 %6, i32 %7, i8* nocapture readnone %8) {
ret i32 undef
}
void xive_smp_setup_cpu(void) {}


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

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

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

LLVM IR (-O2):
define void @xive_smp_setup_cpu() {
ret void
}
void testDifferentTypes2(unsigned long arg) {
  switch (arg) {
  case 1UL ... 400000000UL:
    clang_analyzer_warnIfReached();
    break;
  default:
    clang_analyzer_warnIfReached();
    break;
  }
}


x86 assembly (clang, -O0):
<testDifferentTypes2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1135 <testDifferentTypes2+0x25>
mov    $0x0,%al
call   1030 <clang_analyzer_warnIfReached@plt>
jmp    1150 <testDifferentTypes2+0x40>
mov    -0x10(%rbp),%rax
sub    $0x1,%rax
cmp    $0x17d783ff,%rax
jbe    1129 <testDifferentTypes2+0x19>
mov    $0x0,%al
call   1030 <clang_analyzer_warnIfReached@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testDifferentTypes2>:
xor    %eax,%eax
jmp    1030 <clang_analyzer_warnIfReached@plt>

LLVM IR (-O0):
define void @testDifferentTypes2(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
switch i64 %3, label %6 [
]
4: ; preds = %6
%5 = call i32 (...) @clang_analyzer_warnIfReached()
br label %11
6: ; preds = %1
%7 = sub i64 %3, 1
%8 = icmp ule i64 %7, 399999999
br i1 %8, label %4, label %9
9: ; preds = %6
%10 = call i32 (...) @clang_analyzer_warnIfReached()
br label %11
11: ; preds = %9, %4
ret void
}

LLVM IR (-O2):
define void @testDifferentTypes2(i64 %0) {
%2 = tail call i32 (...) @clang_analyzer_warnIfReached()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ syscall_exit(int);
void _exit(int ret) { syscall_exit(ret); }


x86 assembly (clang, -O0):
<_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <syscall_exit@plt>

x86 assembly (clang, -O2):
<_exit>:
push   %rax
call   1030 <syscall_exit@plt>

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

LLVM IR (-O2):
define void @_exit(i32 %0) {
%2 = tail call i32 @syscall_exit(i32 %0)
unreachable
}
/* Variables and functions */
float asin(float);
float Q_asin(float c) {
  float angle;
  angle = asin(c);
  if (angle > 3.14159265358979323846f) {
    return (float)3.14159265358979323846f;
  }
  if (angle < -3.14159265358979323846f) {
    return (float)3.14159265358979323846f;
  }
  return angle;
}


x86 assembly (clang, -O0):
<Q_asin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <asin@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xec7(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1154 <Q_asin+0x44>
movss  0xeb6(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1182 <Q_asin+0x72>
movss  0xea8(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1178 <Q_asin+0x68>
movss  0xe92(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1182 <Q_asin+0x72>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q_asin>:
push   %rax
call   1030 <asin@plt>
movaps %xmm0,%xmm2
cmpltss 0xee2(%rip),%xmm2
movss  0xed6(%rip),%xmm3
movaps %xmm2,%xmm1
andps  %xmm3,%xmm1
andnps %xmm0,%xmm2
orps   %xmm1,%xmm2
movaps %xmm3,%xmm1
cmpltss %xmm0,%xmm1
movaps %xmm1,%xmm0
andnps %xmm2,%xmm0
andps  %xmm3,%xmm1
orps   %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @Q_asin(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %3
%5 = load float, float* %3
%6 = call float @asin(float %5)
store float %6, float* %4
%7 = load float, float* %4
%8 = fcmp ogt float %7, 0x400921FB60000000
br i1 %8, label %9, label %10
9: ; preds = %1
store float 0x400921FB60000000, float* %2
br label %16
10: ; preds = %1
%11 = load float, float* %4
%12 = fcmp olt float %11, 0xC00921FB60000000
br i1 %12, label %13, label %14
13: ; preds = %10
store float 0x400921FB60000000, float* %2
br label %16
14: ; preds = %10
%15 = load float, float* %4
store float %15, float* %2
br label %16
16: ; preds = %14, %13, %9
%17 = load float, float* %2
ret float %17
}

LLVM IR (-O2):
define float @Q_asin(float %0) {
%2 = tail call float @asin(float %0)
%3 = fcmp ogt float %2, 0x400921FB60000000
%4 = fcmp olt float %2, 0xC00921FB60000000
%5 = or i1 %3, %4
%6 = select i1 %5, float 0x400921FB60000000, float %2
ret float %6
}
int I16Offset(int cbp, int i16mode) {
  return (cbp & 15 ? 13 : 1) + i16mode + ((cbp & 0x30) >> 2);
}


x86 assembly (clang, -O0):
<I16Offset>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
and    $0xf,%edx
mov    $0x1,%eax
mov    $0xd,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
add    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
and    $0x30,%ecx
sar    $0x2,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<I16Offset>:
mov    %edi,%eax
shr    $0x2,%eax
and    $0xc,%eax
test   $0xf,%dil
lea    0x1(%rax,%rsi,1),%ecx
lea    0xd(%rax,%rsi,1),%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @I16Offset(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = and i32 %5, 15
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 13, i32 1
%10 = load i32, i32* %4
%11 = add nsw i32 %9, %10
%12 = load i32, i32* %3
%13 = and i32 %12, 48
%14 = ashr i32 %13, 2
%15 = add nsw i32 %11, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @I16Offset(i32 %0, i32 %1) {
%3 = and i32 %0, 15
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 1, i32 13
%6 = lshr i32 %0, 2
%7 = and i32 %6, 12
%8 = add i32 %7, %1
%9 = add i32 %8, %5
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ inv_host_serif_get_instance();
int inv_host_serif_open(int /*<<< orphan*/);
int inv_host_serif_open_i(void) {
  return inv_host_serif_open(inv_host_serif_get_instance());
}


x86 assembly (clang, -O0):
<inv_host_serif_open_i>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <inv_host_serif_get_instance@plt>
mov    %eax,%edi
call   1030 <inv_host_serif_open@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<inv_host_serif_open_i>:
push   %rax
xor    %eax,%eax
call   1040 <inv_host_serif_get_instance@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <inv_host_serif_open@plt>

LLVM IR (-O0):
define i32 @inv_host_serif_open_i() {
%1 = call i32 (...) @inv_host_serif_get_instance()
%2 = call i32 @inv_host_serif_open(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
define i32 @inv_host_serif_open_i() {
%1 = tail call i32 (...) @inv_host_serif_get_instance()
%2 = tail call i32 @inv_host_serif_open(i32 %1)
ret i32 %2
}
void SPI_RP_DisableTxInt(void) {}


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

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

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

LLVM IR (-O2):
define void @SPI_RP_DisableTxInt() {
ret void
}
int remap_area_pages(unsigned long addr, unsigned long phys_addr,
                     unsigned long size, unsigned long flags) {
  return 0;
}


x86 assembly (clang, -O0):
<remap_area_pages>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @remap_area_pages(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
ret i32 0
}

LLVM IR (-O2):
define i32 @remap_area_pages(i64 %0, i64 %1, i64 %2, i64 %3) {
ret i32 0
}
int xmlUCSIsCJKUnifiedIdeographs(int code) {
  return (((code >= 0x4E00) && (code <= 0x9FFF)));
}


x86 assembly (clang, -O0):
<xmlUCSIsCJKUnifiedIdeographs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x4e00,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1126 <xmlUCSIsCJKUnifiedIdeographs+0x26>
cmpl   $0x9fff,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmlUCSIsCJKUnifiedIdeographs>:
add    $0xffffb200,%edi
xor    %eax,%eax
cmp    $0x5200,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @xmlUCSIsCJKUnifiedIdeographs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 19968
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 40959
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @xmlUCSIsCJKUnifiedIdeographs(i32 %0) {
%2 = add i32 %0, -19968
%3 = icmp ult i32 %2, 20992
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int z;
typedef int int64_t;
typedef int int32_t;

/* Variables and functions */
int32_t FixedDiv2(int32_t a, int32_t b) {
  int64_t x = (int32_t)a;
  int64_t y = (int32_t)b;
  int64_t z = x * 65536 / y;
  return (z)&0xffffffff;
}


x86 assembly (clang, -O0):
<FixedDiv2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x10,%eax
cltd
idivl  -0x10(%rbp)
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FixedDiv2>:
mov    %edi,%eax
shl    $0x10,%eax
cltd
idiv   %esi
ret

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

LLVM IR (-O2):
define i32 @FixedDiv2(i32 %0, i32 %1) {
%3 = shl nsw i32 %0, 16
%4 = sdiv i32 %3, %1
ret i32 %4
}
double mystery(double x, unsigned n) {
  if (n == 0)
    return 0;
  double y = mystery(x, n / 2);
  if (n % 2 == 0) {
    return y + y;
  } else {
    return x + y + y;
  }
}


x86 assembly (clang, -O0):
<mystery>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1137 <mystery+0x27>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1183 <mystery+0x73>
movsd  -0x10(%rbp),%xmm0
mov    -0x14(%rbp),%edi
shr    $0x1,%edi
call   1030 <mystery@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    116f <mystery+0x5f>
movsd  -0x20(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1183 <mystery+0x73>
movsd  -0x10(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystery>:
test   %edi,%edi
je     1135 <mystery+0x25>
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
shr    %edi
movsd  %xmm0,0x8(%rsp)
call   1030 <mystery@plt>
test   $0x1,%bl
je     1139 <mystery+0x29>
movsd  0x8(%rsp),%xmm1
jmp    1141 <mystery+0x31>
xorps  %xmm0,%xmm0
ret
movsd  0xebf(%rip),%xmm1
addsd  %xmm0,%xmm1
addsd  %xmm0,%xmm1
add    $0x10,%rsp
pop    %rbx
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @mystery(double %0, i32 %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca double
store double %0, double* %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
store double 0.000000e+00, double* %3
br label %28
10: ; preds = %2
%11 = load double, double* %4
%12 = load i32, i32* %5
%13 = udiv i32 %12, 2
%14 = call double @mystery(double %11, i32 %13)
store double %14, double* %6
%15 = load i32, i32* %5
%16 = urem i32 %15, 2
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %10
%19 = load double, double* %6
%20 = load double, double* %6
%21 = fadd double %19, %20
store double %21, double* %3
br label %28
22: ; preds = %10
%23 = load double, double* %4
%24 = load double, double* %6
%25 = fadd double %23, %24
%26 = load double, double* %6
%27 = fadd double %25, %26
store double %27, double* %3
br label %28
28: ; preds = %22, %18, %9
%29 = load double, double* %3
ret double %29
}

LLVM IR (-O2):
define double @mystery(double %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2, %6
%5 = phi double [ %13, %6 ], [ 0.000000e+00, %2 ]
ret double %5
6: ; preds = %2
%7 = lshr i32 %1, 1
%8 = tail call double @mystery(double %0, i32 %7)
%9 = and i32 %1, 1
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, double -0.000000e+00, double %0
%12 = fadd double %11, %8
%13 = fadd double %8, %12
br label %4
}
/* Variables and functions */
int func_two(int);
int func_one(int x) { return func_two(x + 1); }


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

x86 assembly (clang, -O2):
<func_one>:
add    $0x1,%edi
jmp    1030 <func_two@plt>

LLVM IR (-O0):
define i32 @func_one(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
%5 = call i32 @func_two(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @func_one(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = tail call i32 @func_two(i32 %2)
ret i32 %3
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t gcd(uint64_t a, uint64_t b) {
  uint64_t tmp;
  while (b) {
    tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112f <gcd+0x2f>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    110a <gcd+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %0, %2 ]
%6 = phi i32 [ %7, %4 ], [ %1, %2 ]
%7 = srem i32 %5, %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %6, %4 ]
ret i32 %10
}
void gtk_file_chooser_get_preview_uri() {}


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

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

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

LLVM IR (-O2):
define void @gtk_file_chooser_get_preview_uri() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void bad(const char *p) {
  fprintf(stderr, "Invalid map line: %s", p);
  exit(1);
}


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

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

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"Invalid map line: %s\00"
define void @bad(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
unsigned long hash(char *str) {
  unsigned long h = 0;
  while (*str)
    h = ((h << 5) - h) ^ (unsigned char)*(str++);
  return h;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1147 <hash+0x47>
mov    -0x10(%rbp),%rax
shl    $0x5,%rax
sub    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movzbl (%rcx),%ecx
xor    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <hash+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112c <hash+0x2c>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
mov    %rax,%rdx
shl    $0x5,%rdx
sub    %rax,%rdx
movzbl %cl,%eax
xor    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
store i64 0, i64* %3
br label %4
4: ; preds = %8, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %18
8: ; preds = %4
%9 = load i64, i64* %3
%10 = shl i64 %9, 5
%11 = load i64, i64* %3
%12 = sub i64 %10, %11
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %2
%15 = load i8, i8* %13
%16 = zext i8 %15 to i64
%17 = xor i64 %12, %16
store i64 %17, i64* %3
br label %4
18: ; preds = %4
%19 = load i64, i64* %3
ret i64 %19
}

LLVM IR (-O2):
define i64 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i64 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = mul i64 %6, 31
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = zext i8 %5 to i64
%11 = xor i64 %8, %10
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 0, %1 ], [ %11, %4 ]
ret i64 %15
}
int main() {
  signed long long int li;
  signed short int si;
  li = 0;
  si = 0x0001;
  li = si;
  li = 0;
  si = 0xFFFF;
  li = si;
  li = 0;
  si = 0x8000;
  li = si;
  li = 0;
  si = 0x7FFF;
  li = si;
  li = 0;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movw   $0x1,-0x12(%rbp)
movswq -0x12(%rbp),%rax
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x10(%rbp)
movw   $0xffff,-0x12(%rbp)
movswq -0x12(%rbp),%rax
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x10(%rbp)
movw   $0x8000,-0x12(%rbp)
movswq -0x12(%rbp),%rax
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x10(%rbp)
movw   $0x7fff,-0x12(%rbp)
movswq -0x12(%rbp),%rax
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i16
store i32 0, i32* %1
store i64 0, i64* %2
store i16 1, i16* %3
%4 = load i16, i16* %3
%5 = sext i16 %4 to i64
store i64 %5, i64* %2
store i64 0, i64* %2
store i16 -1, i16* %3
%6 = load i16, i16* %3
%7 = sext i16 %6 to i64
store i64 %7, i64* %2
store i64 0, i64* %2
store i16 -32768, i16* %3
%8 = load i16, i16* %3
%9 = sext i16 %8 to i64
store i64 %9, i64* %2
store i64 0, i64* %2
store i16 32767, i16* %3
%10 = load i16, i16* %3
%11 = sext i16 %10 to i64
store i64 %11, i64* %2
store i64 0, i64* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ startFunction(int, char *, char *);
int manageWifi(int portno, char *filename, char *cmd) {
  printf("CMD:%s\n", cmd);
  startFunction(portno, filename, cmd);
  return 0;
}


x86 assembly (clang, -O0):
<manageWifi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <startFunction@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<manageWifi>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%ebp
lea    0xecd(%rip),%rdi
mov    %rdx,%rsi
call   1030 <printf@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <startFunction@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"CMD:%s\0A\00"
define i32 @manageWifi(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i32, i32* %4
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = call i32 @startFunction(i32 %9, i8* %10, i8* %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"CMD:%s\0A\00"
define i32 @manageWifi(i32 %0, i8* %1, i8* %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = tail call i32 @startFunction(i32 %0, i8* %1, i8* %2)
ret i32 0
}
/* Type definitions */
typedef void uint8_t;
typedef int uint32_t;

/* Variables and functions */
void *readBuf(uint8_t *buffer, uint32_t address) {
  return ((buffer + (address - 0x8000000)));
}


x86 assembly (clang, -O0):
<readBuf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x8000000,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<readBuf>:
movslq %esi,%rax
add    %rdi,%rax
add    $0xfffffffff8000000,%rax
ret

LLVM IR (-O0):
define i8* @readBuf(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 = sub nsw i32 %6, 134217728
%8 = sext i32 %7 to i64
%9 = getelementptr i8, i8* %5, i64 %8
ret i8* %9
}

LLVM IR (-O2):
define i8* @readBuf(i8* readnone %0, i32 %1) {
%3 = add nsw i32 %1, -134217728
%4 = sext i32 %3 to i64
%5 = getelementptr i8, i8* %0, i64 %4
ret i8* %5
}
/* Variables and functions */
int events_run();
int events_spin(int *done) {
  int rc = 0;
  while ((done[0] == 0) && (rc == 0)) {
    rc = events_run();
  }
  return (rc);
}


x86 assembly (clang, -O0):
<events_spin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmpl   $0x0,(%rcx)
mov    %al,-0xd(%rbp)
jne    113f <events_spin+0x2f>
cmpl   $0x0,-0xc(%rbp)
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    114f <events_spin+0x3f>
jmp    115e <events_spin+0x4e>
mov    $0x0,%al
call   1030 <events_run@plt>
mov    %eax,-0xc(%rbp)
jmp    1123 <events_spin+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<events_spin>:
push   %rbx
xor    %eax,%eax
cmpl   $0x0,(%rdi)
jne    112d <events_spin+0x1d>
mov    %rdi,%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <events_run@plt>
mov    (%rbx),%ecx
or     %eax,%ecx
je     1120 <events_spin+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define i32 @events_spin(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
br label %4
4: ; preds = %14, %1
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 0
br label %12
12: ; preds = %9, %4
%13 = phi i1 [ false, %4 ], [ %11, %9 ]
br i1 %13, label %14, label %16
14: ; preds = %12
%15 = call i32 (...) @events_run()
store i32 %15, i32* %3
br label %4
16: ; preds = %12
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @events_spin(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %10
4: ; preds = %1, %4
%5 = tail call i32 (...) @events_run()
%6 = load i32, i32* %0
%7 = icmp eq i32 %6, 0
%8 = icmp eq i32 %5, 0
%9 = select i1 %7, i1 %8, i1 false
br i1 %9, label %4, label %10
10: ; preds = %4, %1
%11 = phi i32 [ 0, %1 ], [ %5, %4 ]
ret i32 %11
}
void SPIM_1_TX_ISR(void) {}


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

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

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

LLVM IR (-O2):
define void @SPIM_1_TX_ISR() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int errno;
scalar_t__ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
sigchld_handler() {
  int saved_errno = errno;
  while (waitpid(-1, NULL, WNOHANG) > 0)
    ;
  errno = saved_errno;
}


x86 assembly (clang, -O0):
<sigchld_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <waitpid@plt>
cmp    $0x0,%rax
jle    114a <sigchld_handler+0x3a>
jmp    1124 <sigchld_handler+0x14>
mov    -0x8(%rbp),%ecx
mov    0x2e84(%rip),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigchld_handler>:
push   %rbp
push   %r14
push   %rbx
mov    0x2ebd(%rip),%r14
mov    (%r14),%ebp
mov    0x2ec3(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rbx),%edx
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1030 <waitpid@plt>
test   %rax,%rax
jg     1130 <sigchld_handler+0x20>
mov    %ebp,(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i32 0
@WNOHANG = global i32 0
define i32 @sigchld_handler() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @errno
store i32 %3, i32* %2
br label %4
4: ; preds = %8, %0
%5 = load i32, i32* @WNOHANG
%6 = call i64 @waitpid(i32 -1, i32* null, i32 %5)
%7 = icmp sgt i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %4
br label %4
9: ; preds = %4
%10 = load i32, i32* %2
store i32 %10, i32* @errno
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@errno = global i32 0
@WNOHANG = global i32 0
define i32 @sigchld_handler() {
%1 = load i32, i32* @errno
br label %2
2: ; preds = %2, %0
%3 = load i32, i32* @WNOHANG
%4 = tail call i64 @waitpid(i32 -1, i32* null, i32 %3)
%5 = icmp sgt i64 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
store i32 %1, i32* @errno
ret i32 undef
}