xunge/DecIR huggingface dataset:
/* Variables and functions */
void stub1(int, char);
void testClosureIBrV(void (*closure)(int, char), int a1, char a2) {
  if (closure != NULL)
    (*closure)(a1, a2);
}


x86 assembly (clang, -O0):
<testClosureIBrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     112c <testClosureIBrV+0x2c>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%edi
movsbl -0xd(%rbp),%esi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosureIBrV>:
test   %rdi,%rdi
je     1111 <testClosureIBrV+0x11>
mov    %rdi,%rax
movsbl %dl,%ecx
mov    %esi,%edi
mov    %ecx,%esi
jmp    *%rax
ret

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

LLVM IR (-O2):
define void @testClosureIBrV(void (i32, i8)* %0, i32 %1, i8 signext %2) {
%4 = icmp eq void (i32, i8)* %0, null
br i1 %4, label %6, label %5
5: ; preds = %3
tail call void %0(i32 %1, i8 signext %2)
br label %6
6: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pointer_fiddling();
int main(int argc, char *argv[]) {
  pointer_fiddling();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <pointer_fiddling@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @pointer_fiddling()
ret i32 0
}
/* Type definitions */
struct _stor_ftruncate_rsp {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct _stor_ftruncate_rsp *);
void stor_ftruncate_rsp_free(struct _stor_ftruncate_rsp *ptr) { free(ptr); }


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

x86 assembly (clang, -O2):
<stor_ftruncate_rsp_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct._stor_ftruncate_rsp = type { i32 }
define void @stor_ftruncate_rsp_free(%struct._stor_ftruncate_rsp* nocapture %0) {
%2 = tail call i32 @free(%struct._stor_ftruncate_rsp* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void print_res(const char *res) {
  printf("-> res is %s\n", (res ? "non-NULL" : "NULL"));
}


x86 assembly (clang, -O0):
<print_res>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
lea    0xeeb(%rip),%rsi
lea    0xee0(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_res>:
test   %rdi,%rdi
lea    0xef8(%rip),%rax
lea    0xeed(%rip),%rsi
cmove  %rax,%rsi
lea    0xed4(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"-> res is %s\0A\00"
@.str.1 = [9 x i8] c"non-NULL\00"
@.str.2 = [5 x i8] c"NULL\00"
define void @print_res(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"-> res is %s\0A\00"
@.str.1 = [9 x i8] c"non-NULL\00"
@.str.2 = [5 x i8] c"NULL\00"
define void @print_res(i8* readnone %0) {
%2 = icmp eq i8* %0, null
%3 = select i1 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ srandom(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void olsr_init_random(void) { srandom(time(NULL)); }


x86 assembly (clang, -O0):
<olsr_init_random>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @olsr_init_random() {
%1 = call i32 @time(i32* null)
%2 = call i32 @srandom(i32 %1)
ret void
}

LLVM IR (-O2):
define void @olsr_init_random() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srandom(i32 %1)
ret void
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint32_t;

/* Variables and functions */
void nn_putl(uint8_t *buf, uint32_t val) {
  buf[0] = (uint8_t)(((val) >> 24) & 0xff);
  buf[1] = (uint8_t)(((val) >> 16) & 0xff);
  buf[2] = (uint8_t)(((val) >> 8) & 0xff);
  buf[3] = (uint8_t)(val & 0xff);
}


x86 assembly (clang, -O0):
<nn_putl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<nn_putl>:
mov    %esi,%eax
mov    %esi,%ecx
movzbl %ah,%edx
movzbl %al,%esi
shr    $0x18,%eax
mov    %rax,(%rdi)
shr    $0x10,%ecx
movzbl %cl,%eax
mov    %rax,0x8(%rdi)
mov    %rdx,0x10(%rdi)
mov    %rsi,0x18(%rdi)
ret

LLVM IR (-O0):
define void @nn_putl(i64* %0, i32 %1) {
%3 = alloca i64*
%4 = alloca i32
store i64* %0, i64** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = ashr i32 %5, 24
%7 = and i32 %6, 255
%8 = sext i32 %7 to i64
%9 = load i64*, i64** %3
%10 = getelementptr inbounds i64, i64* %9, i64 0
store i64 %8, i64* %10
%11 = load i32, i32* %4
%12 = ashr i32 %11, 16
%13 = and i32 %12, 255
%14 = sext i32 %13 to i64
%15 = load i64*, i64** %3
%16 = getelementptr inbounds i64, i64* %15, i64 1
store i64 %14, i64* %16
%17 = load i32, i32* %4
%18 = ashr i32 %17, 8
%19 = and i32 %18, 255
%20 = sext i32 %19 to i64
%21 = load i64*, i64** %3
%22 = getelementptr inbounds i64, i64* %21, i64 2
store i64 %20, i64* %22
%23 = load i32, i32* %4
%24 = and i32 %23, 255
%25 = sext i32 %24 to i64
%26 = load i64*, i64** %3
%27 = getelementptr inbounds i64, i64* %26, i64 3
store i64 %25, i64* %27
ret void
}

LLVM IR (-O2):
define void @nn_putl(i64* nocapture writeonly %0, i32 %1) {
%3 = lshr i32 %1, 24
%4 = zext i32 %3 to i64
store i64 %4, i64* %0
%5 = lshr i32 %1, 16
%6 = and i32 %5, 255
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i64, i64* %0, i64 1
store i64 %7, i64* %8
%9 = lshr i32 %1, 8
%10 = and i32 %9, 255
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds i64, i64* %0, i64 2
store i64 %11, i64* %12
%13 = and i32 %1, 255
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds i64, i64* %0, i64 3
store i64 %14, i64* %15
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(void *);
short gshortand(short x, short y) {
  x &= y;
  if (!x)
    foo((void *)0);
  return x;
}


x86 assembly (clang, -O0):
<gshortand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movswl -0x4(%rbp),%ecx
movswl -0x2(%rbp),%eax
and    %ecx,%eax
mov    %ax,-0x2(%rbp)
cmpw   $0x0,-0x2(%rbp)
jne    1148 <gshortand+0x38>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <foo@plt>
movswl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gshortand>:
push   %rbx
mov    %edi,%ebx
and    %esi,%ebx
test   %bx,%bx
jne    1121 <gshortand+0x11>
xor    %edi,%edi
call   1030 <foo@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i16 @gshortand(i16 signext %0, i16 signext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %4
%6 = sext i16 %5 to i32
%7 = load i16, i16* %3
%8 = sext i16 %7 to i32
%9 = and i32 %8, %6
%10 = trunc i32 %9 to i16
store i16 %10, i16* %3
%11 = load i16, i16* %3
%12 = icmp ne i16 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %2
%14 = call i32 @foo(i8* null)
br label %15
15: ; preds = %13, %2
%16 = load i16, i16* %3
ret i16 %16
}

LLVM IR (-O2):
define signext i16 @gshortand(i16 signext %0, i16 signext %1) {
%3 = and i16 %1, %0
%4 = icmp eq i16 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @foo(i8* null)
br label %7
7: ; preds = %5, %2
ret i16 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main() {
  int sayi1, sayi2, sayi3;
  printf("Lutfen 3 tamsayi giriniz:\n");
  scanf("%d%d%d", &sayi1, &sayi2, &sayi3);
  printf("bugun %d m yuzdum, %d m kostum, %d m kurek cektim.\n", sayi1, sayi2,
         sayi3);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xf00(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1050 <scanf@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
lea    0xe99(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Lutfen 3 tamsayi giriniz:\0A\00"
@.str.1 = [7 x i8] c"%d%d%d\00"
@.str.2 = [52 x i8] c"bugun %d m yuzdum, %d m kostum, %d m kurek cektim.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"%d%d%d\00"
@.str.2 = [52 x i8] c"bugun %d m yuzdum, %d m kostum, %d m kurek cektim.\0A\00"
@str = [26 x i8] c"Lutfen 3 tamsayi giriniz:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i32 %9, i32 %10, i32 %11)
ret i32 0
}
int init(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @init() {
ret i32 0
}
void Hw_Uart_Init(void) {
  (*(volatile unsigned long *)(0x40013800 + 0x000C)) =
      0 | (1 << 13) | (0 << 12) | (0 << 10) | (1 << 3) | (1 << 2);
  (*(volatile unsigned long *)(0x40013800 + 0x0010)) = (0 << 12);
  (*(volatile unsigned long *)(0x40013800 + 0x0014)) = 0;
  (*(volatile unsigned long *)(0x40013800 + 0x0008)) = 0 | (39 << 4) | (1 << 0);
  (*(volatile unsigned long *)(0x40013800 + 0x000C)) |= (1 << 13);
}


x86 assembly (clang, -O0):
<Hw_Uart_Init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4001380c,%eax
movq   $0x200c,(%rax)
mov    $0x40013810,%eax
movq   $0x0,(%rax)
mov    $0x40013814,%eax
movq   $0x0,(%rax)
mov    $0x40013808,%eax
movq   $0x271,(%rax)
mov    $0x4001380c,%eax
mov    (%rax),%rcx
or     $0x2000,%rcx
mov    $0x4001380c,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Hw_Uart_Init>:
movq   $0x200c,0x4001380c
movq   $0x0,0x40013810
movq   $0x0,0x40013814
movq   $0x271,0x40013808
orq    $0x2000,0x4001380c
ret

LLVM IR (-O0):
define void @Hw_Uart_Init() {
store volatile i64 8204, i64* inttoptr (i64 1073821708 to i64*)
store volatile i64 0, i64* inttoptr (i64 1073821712 to i64*)
store volatile i64 0, i64* inttoptr (i64 1073821716 to i64*)
store volatile i64 625, i64* inttoptr (i64 1073821704 to i64*)
%1 = load volatile i64, i64* inttoptr (i64 1073821708 to i64*)
%2 = or i64 %1, 8192
store volatile i64 %2, i64* inttoptr (i64 1073821708 to i64*)
ret void
}

LLVM IR (-O2):
define void @Hw_Uart_Init() {
store volatile i64 8204, i64* inttoptr (i64 1073821708 to i64*)
store volatile i64 0, i64* inttoptr (i64 1073821712 to i64*)
store volatile i64 0, i64* inttoptr (i64 1073821716 to i64*)
store volatile i64 625, i64* inttoptr (i64 1073821704 to i64*)
%1 = load volatile i64, i64* inttoptr (i64 1073821708 to i64*)
%2 = or i64 %1, 8192
store volatile i64 %2, i64* inttoptr (i64 1073821708 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ op_to_ea(char *, int);
void i_and_ea(void) { op_to_ea("and", 1); }


x86 assembly (clang, -O0):
<i_and_ea>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x1,%esi
call   1030 <op_to_ea@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<i_and_ea>:
lea    0xee9(%rip),%rdi
mov    $0x1,%esi
jmp    1030 <op_to_ea@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"and\00"
define void @i_and_ea() {
%1 = tail call i32 @op_to_ea(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
void vx_info_exit_sched_pc(struct _vx_sched_pc *sched_pc, int cpu) { return; }


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

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

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

LLVM IR (-O2):
%struct._vx_sched_pc = type opaque
define void @vx_info_exit_sched_pc(%struct._vx_sched_pc* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ttputc(int);
void tcapbeep(void) { ttputc(0x07); }


x86 assembly (clang, -O0):
<tcapbeep>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7,%edi
call   1030 <ttputc@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcapbeep>:
mov    $0x7,%edi
jmp    1030 <ttputc@plt>

LLVM IR (-O0):
define void @tcapbeep() {
%1 = call i32 @ttputc(i32 7)
ret void
}

LLVM IR (-O2):
define void @tcapbeep() {
%1 = tail call i32 @ttputc(i32 7)
ret void
}
void g() {
  int a[2];
  char *b = (char *)a;
  b[3] = 'c';
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x63,0x3(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @g() {
%1 = alloca [2 x i32]
%2 = alloca i8*
%3 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%4 = bitcast i32* %3 to i8*
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 3
store i8 99, i8* %6
ret void
}

LLVM IR (-O2):
define void @g() {
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t exception_vec_to_off(uint8_t v) { return v * 4; }


x86 assembly (clang, -O0):
<exception_vec_to_off>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exception_vec_to_off>:
lea    0x0(,%rdi,4),%eax
ret

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

LLVM IR (-O2):
define i32 @exception_vec_to_off(i32 %0) {
%2 = shl nsw i32 %0, 2
ret i32 %2
}
int test_imm_B1int8_mem(signed char *val) {
  return ((*val) & (0xB1 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_B1int8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0xb1,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_B1int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -79
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int order(char c) {
  if ((((unsigned)(c) | 32) - 'a' < 26))
    return c;
  if (((unsigned)(c) - '0' < 10))
    return 0;
  if (c == '~')
    return -1;
  return (int)c + 256;
}


x86 assembly (clang, -O0):
<order>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
or     $0x20,%eax
sub    $0x61,%eax
cmp    $0x1a,%eax
jae    1129 <order+0x29>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116a <order+0x6a>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
cmp    $0xa,%eax
jae    1145 <order+0x45>
movl   $0x0,-0x4(%rbp)
jmp    116a <order+0x6a>
movsbl -0x5(%rbp),%eax
cmp    $0x7e,%eax
jne    115e <order+0x5e>
movl   $0xffffffff,-0x4(%rbp)
jmp    116a <order+0x6a>
movsbl -0x5(%rbp),%eax
add    $0x100,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<order>:
mov    %edi,%ecx
or     $0x20,%ecx
add    $0xffffff9f,%ecx
mov    %edi,%eax
cmp    $0x1a,%ecx
jb     112d <order+0x2d>
lea    -0x30(%rdi),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
jb     112d <order+0x2d>
mov    %edi,%ecx
add    $0x100,%ecx
cmp    $0x7e,%dil
mov    $0xffffffff,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @order(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = or i32 %5, 32
%7 = sub i32 %6, 97
%8 = icmp ult i32 %7, 26
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
store i32 %11, i32* %2
br label %27
12: ; preds = %1
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = sub i32 %14, 48
%16 = icmp ult i32 %15, 10
br i1 %16, label %17, label %18
17: ; preds = %12
store i32 0, i32* %2
br label %27
18: ; preds = %12
%19 = load i8, i8* %3
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 126
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 -1, i32* %2
br label %27
23: ; preds = %18
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = add nsw i32 %25, 256
store i32 %26, i32* %2
br label %27
27: ; preds = %23, %22, %17, %9
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
define i32 @order(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = or i32 %2, 32
%4 = add nsw i32 %3, -97
%5 = icmp ult i32 %4, 26
br i1 %5, label %13, label %6
6: ; preds = %1
%7 = add nsw i32 %2, -48
%8 = icmp ult i32 %7, 10
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = icmp eq i8 %0, 126
%11 = add nsw i32 %2, 256
%12 = select i1 %10, i32 -1, i32 %11
br label %13
13: ; preds = %9, %6, %1
%14 = phi i32 [ %2, %1 ], [ 0, %6 ], [ %12, %9 ]
ret i32 %14
}
/* Variables and functions */
void *paged_mem_pool_new(size_t, int);
void *virtual_machine_resource_pool_page_init(size_t size) {
  return paged_mem_pool_new(size, 1);
}


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

x86 assembly (clang, -O2):
<virtual_machine_resource_pool_page_init>:
mov    $0x1,%esi
jmp    1030 <paged_mem_pool_new@plt>

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

LLVM IR (-O2):
define i8* @virtual_machine_resource_pool_page_init(i64 %0) {
%2 = tail call i8* @paged_mem_pool_new(i64 %0, i32 1)
ret i8* %2
}
/* Variables and functions */
int quittask1();
int /*<<< orphan*/ task1();
int main(int argc, char **argv) {
begintask1:;
  task1();
  int endtask1 = quittask1();
  if (endtask1 == 0) {
  } else if (endtask1 == 1) {
    goto begintask1;
  }
  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 <task1@plt>
mov    $0x0,%al
call   1030 <quittask1@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1156 <main+0x36>
jmp    116a <main+0x4a>
cmpl   $0x1,-0x14(%rbp)
jne    1165 <main+0x45>
jmp    1136 <main+0x16>
jmp    116a <main+0x4a>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <task1@plt>
xor    %eax,%eax
call   1030 <quittask1@plt>
cmp    $0x1,%eax
je     1130 <main+0x10>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32 (...) @task1()
%5 = tail call i32 (...) @quittask1()
%6 = icmp eq i32 %5, 1
br i1 %6, label %3, label %7
7: ; preds = %3
ret i32 0
}
/* Type definitions */
struct stat {
  int st_size;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
int get_file_size(char *filename) {
  struct stat st;
  if (stat(filename, &st) == 0)
    return st.st_size;
  fprintf(stderr, "Cannot determine size of %s: \n", filename);
  return -1;
}


x86 assembly (clang, -O0):
<get_file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
jne    114e <get_file_size+0x2e>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116e <get_file_size+0x4e>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe9e(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_file_size>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rsi
call   1040 <stat@plt>
test   %rax,%rax
je     1156 <get_file_size+0x36>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    115a <get_file_size+0x3a>
mov    0x8(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [31 x i8] c"Cannot determine size of %s: \0A\00"
define i32 @get_file_size(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%10 = load i32, i32* %9
store i32 %10, i32* %2
br label %15
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %3
%14 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %13)
store i32 -1, i32* %2
br label %15
15: ; preds = %11, %8
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [31 x i8] c"Cannot determine size of %s: \0A\00"
define i32 @get_file_size(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
br label %12
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %12
12: ; preds = %9, %6
%13 = phi i32 [ %8, %6 ], [ -1, %9 ]
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime_r(int /*<<< orphan*/ const *, struct tm *);
struct tm *Parrot_localtime_r(const time_t *t, struct tm *tm) {
  return localtime_r(t, tm);
}


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

x86 assembly (clang, -O2):
<Parrot_localtime_r>:
jmp    1030 <localtime_r@plt>

LLVM IR (-O0):
%struct.tm = type { i32 }
define %struct.tm* @Parrot_localtime_r(i32* %0, %struct.tm* %1) {
%3 = alloca i32*
%4 = alloca %struct.tm*
store i32* %0, i32** %3
store %struct.tm* %1, %struct.tm** %4
%5 = load i32*, i32** %3
%6 = load %struct.tm*, %struct.tm** %4
%7 = call %struct.tm* @localtime_r(i32* %5, %struct.tm* %6)
ret %struct.tm* %7
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define %struct.tm* @Parrot_localtime_r(i32* %0, %struct.tm* %1) {
%3 = tail call %struct.tm* @localtime_r(i32* %0, %struct.tm* %1)
ret %struct.tm* %3
}
/* Variables and functions */
int /*<<< orphan*/ PWM2_0_DriverIRQHandler();
__attribute__((weak)) void PWM2_0_IRQHandler(void) {
  PWM2_0_DriverIRQHandler();
}


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

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

LLVM IR (-O0):
define weak void @PWM2_0_IRQHandler() {
%1 = call i32 (...) @PWM2_0_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @PWM2_0_IRQHandler() {
%1 = tail call i32 (...) @PWM2_0_DriverIRQHandler()
ret void
}
/* Type definitions */
struct sd_sys {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ht_free(struct sd_sys *);
void sd_sys_free(struct sd_sys *sys) { ht_free(sys); }


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

x86 assembly (clang, -O2):
<sd_sys_free>:
jmp    1030 <ht_free@plt>

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

LLVM IR (-O2):
%struct.sd_sys = type { i32 }
define void @sd_sys_free(%struct.sd_sys* %0) {
%2 = tail call i32 @ht_free(%struct.sd_sys* %0)
ret void
}
unsigned long long f(unsigned long long i) { return (i & 0x1ffffffffULL) << 4; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movabs $0x1ffffffff,%rax
and    -0x8(%rbp),%rax
shl    $0x4,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
shl    $0x4,%rdi
movabs $0x1ffffffff0,%rax
and    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @f(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 8589934591
%5 = shl i64 %4, 4
ret i64 %5
}

LLVM IR (-O2):
define i64 @f(i64 %0) {
%2 = shl i64 %0, 4
%3 = and i64 %2, 137438953456
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ create_write_byte(int);
void create_straight(int speed) {
  ;
  create_write_byte(145);
  create_write_byte(((speed & 0xFFFF) >> 8));
  create_write_byte((speed & 0xFF));
  create_write_byte(((speed & 0xFFFF) >> 8));
  create_write_byte((speed & 0xFF));
  ;
}


x86 assembly (clang, -O0):
<create_straight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x91,%edi
call   1030 <create_write_byte@plt>
mov    -0x4(%rbp),%edi
and    $0xffff,%edi
sar    $0x8,%edi
call   1030 <create_write_byte@plt>
mov    -0x4(%rbp),%edi
and    $0xff,%edi
call   1030 <create_write_byte@plt>
mov    -0x4(%rbp),%edi
and    $0xffff,%edi
sar    $0x8,%edi
call   1030 <create_write_byte@plt>
mov    -0x4(%rbp),%edi
and    $0xff,%edi
call   1030 <create_write_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_straight>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    $0x91,%edi
call   1030 <create_write_byte@plt>
movzbl %bh,%edi
mov    %edi,%r14d
call   1030 <create_write_byte@plt>
movzbl %bl,%ebp
mov    %ebp,%edi
call   1030 <create_write_byte@plt>
mov    %r14d,%edi
call   1030 <create_write_byte@plt>
mov    %ebp,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <create_write_byte@plt>

LLVM IR (-O0):
define void @create_straight(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @create_write_byte(i32 145)
%4 = load i32, i32* %2
%5 = and i32 %4, 65535
%6 = ashr i32 %5, 8
%7 = call i32 @create_write_byte(i32 %6)
%8 = load i32, i32* %2
%9 = and i32 %8, 255
%10 = call i32 @create_write_byte(i32 %9)
%11 = load i32, i32* %2
%12 = and i32 %11, 65535
%13 = ashr i32 %12, 8
%14 = call i32 @create_write_byte(i32 %13)
%15 = load i32, i32* %2
%16 = and i32 %15, 255
%17 = call i32 @create_write_byte(i32 %16)
ret void
}

LLVM IR (-O2):
define void @create_straight(i32 %0) {
%2 = tail call i32 @create_write_byte(i32 145)
%3 = lshr i32 %0, 8
%4 = and i32 %3, 255
%5 = tail call i32 @create_write_byte(i32 %4)
%6 = and i32 %0, 255
%7 = tail call i32 @create_write_byte(i32 %6)
%8 = tail call i32 @create_write_byte(i32 %4)
%9 = tail call i32 @create_write_byte(i32 %6)
ret void
}
/* Variables and functions */
char *create_file_name(char *);
int /*<<< orphan*/ fatal(char *);
int strlen(char *);
char *socket_name() {
  char *socket_name = create_file_name("socket2");
  if (strlen(socket_name) > 108)
    fatal("Can't create socket name.");
  return socket_name;
}


x86 assembly (clang, -O0):
<socket_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1040 <create_file_name@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x6c,%eax
jle    1166 <socket_name+0x36>
lea    0xea7(%rip),%rdi
call   1050 <fatal@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket_name>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1040 <create_file_name@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <strlen@plt>
cmp    $0x6d,%eax
jl     1159 <socket_name+0x29>
lea    0xeb4(%rip),%rdi
call   1050 <fatal@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"socket2\00"
@.str.1 = [26 x i8] c"Can't create socket name.\00"
define i8* @socket_name() {
%1 = alloca i8*
%2 = call i8* @create_file_name(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @strlen(i8* %3)
%5 = icmp sgt i32 %4, 108
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @fatal(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
%9 = load i8*, i8** %1
ret i8* %9
}

LLVM IR (-O2):
@.str = [8 x i8] c"socket2\00"
@.str.1 = [26 x i8] c"Can't create socket name.\00"
define i8* @socket_name() {
%1 = tail call i8* @create_file_name(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @strlen(i8* %1)
%3 = icmp sgt i32 %2, 108
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 @fatal(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
ret i8* %1
}
void wait_irq(void) { asm volatile("sti ; hlt ; cli ; cld" : : : "memory"); }


x86 assembly (clang, -O0):
<wait_irq>:
push   %rbp
mov    %rsp,%rbp
sti
hlt
cli
cld
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_irq>:
sti
hlt
cli
cld
ret

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

LLVM IR (-O2):
define void @wait_irq() {
tail call void asm sideeffect "sti ; hlt ; cli ; cld", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
char const *pubnub_uname(void) {
  return "Windows"
         "%2F"
         "2.1-alpha";
}


x86 assembly (clang, -O0):
<pubnub_uname>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [20 x i8] c"Windows%2F2.1-alpha\00"
define i8* @pubnub_uname() {
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [20 x i8] c"Windows%2F2.1-alpha\00"
define i8* @pubnub_uname() {
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  char buf[3];
  strcpy(buf, argv[1] ? argv[1] : "exec(\"/bin/sh\")");
  printf("%s\n", buf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x13(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     115e <main+0x3e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    116e <main+0x4e>
lea    0xe9b(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    116e <main+0x4e>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x13(%rbp),%rsi
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0x8(%rsi),%rax
test   %rax,%rax
lea    0xecd(%rip),%rsi
cmovne %rax,%rsi
lea    0xd(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xec5(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"exec(\22/bin/sh\22)\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [3 x i8]
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
%8 = select i1 %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %6
%9 = call i32 @strcpy(i8* %4, i8* %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}
/* Variables and functions */
int invert(int, int, int);
int /*<<< orphan*/ printf(char *, int);
int main() { printf("%u\n", invert(9, 2, 2)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x9,%edi
mov    $0x2,%edx
mov    %edx,%esi
call   1030 <invert@plt>
mov    %eax,%esi
lea    0xec2(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x9,%edi
mov    $0x2,%esi
mov    $0x2,%edx
call   1030 <invert@plt>
lea    0xec4(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%u\0A\00"
define i32 @main() {
%1 = call i32 @invert(i32 9, i32 2, i32 2)
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%u\0A\00"
define i32 @main() {
%1 = tail call i32 @invert(i32 9, i32 2, i32 2)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a;
  scanf("%d", &a);
  printf("\n%d", a * a);
  printf("\n%d", a * a * a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed2(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%esi
imul   -0x4(%rbp),%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
imul   -0x4(%rbp),%esi
imul   -0x4(%rbp),%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"\0A%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = mul nsw i32 %4, %4
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %1
%8 = mul nsw i32 %7, %7
%9 = mul nsw i32 %8, %7
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %9)
ret i32 0
}
void __monitor(const void *eax, unsigned long ecx, unsigned long edx) {
  asm volatile(".byte 0x0f, 0x01, 0xc8;" ::"a"(eax), "c"(ecx), "d"(edx));
}


x86 assembly (clang, -O0):
<__monitor>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rdx
monitor %rax,%ecx,%edx
pop    %rbp
ret

x86 assembly (clang, -O2):
<__monitor>:
mov    %rsi,%rcx
mov    %rdi,%rax
monitor %rax,%ecx,%edx
ret

LLVM IR (-O0):
define void @__monitor(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
ret void
}

LLVM IR (-O2):
define void @__monitor(i8* %0, i64 %1, i64 %2) {
tail call void asm sideeffect ".byte 0x0f, 0x01, 0xc8;", "{ax},{cx},{dx},~{dirflag},~{fpsr},~{flags}"(i8* %0, i64 %1, i64 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isprint(int);
void t_isprint_0x5e() {
  Assert_real((isprint(94)),
              "/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/ctype/test_isprint.c",
              475, ("isprint should be 1 for ^"));
}


x86 assembly (clang, -O0):
<t_isprint_0x5e>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5e,%edi
call   1030 <isprint@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x1db,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isprint_0x5e>:
push   %rax
mov    $0x5e,%edi
call   1030 <isprint@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x1db,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 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/ctype/test_isprint.c\00"
@.str.1 = [26 x i8] c"isprint should be 1 for ^\00"
define void @t_isprint_0x5e() {
%1 = call i32 @isprint(i32 94)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 475, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 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/ctype/test_isprint.c\00"
@.str.1 = [26 x i8] c"isprint should be 1 for ^\00"
define void @t_isprint_0x5e() {
%1 = tail call i32 @isprint(i32 94)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 475, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int espar(num) {
  int par = 1;
  if (num % 2 == 0) {
    par = 0;
  }
  return par;
}


x86 assembly (clang, -O0):
<espar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1129 <espar+0x29>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @espar(i32 %0) {
%2 = and i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ fork();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ wait(int /*<<< orphan*/ *);
int main(void) {
  int i;
  for (i = 0; i < 2; i++) {
    fork();
    printf("-");
  }
  wait(NULL);
  wait(NULL);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1171 <main+0x41>
mov    $0x0,%al
call   1050 <fork@plt>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <wait@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <wait@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <fork@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <fork@plt>
mov    $0x2d,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1040 <wait@plt>
xor    %edi,%edi
call   1040 <wait@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @fork()
%2 = tail call i32 @putchar(i32 45)
%3 = tail call i32 (...) @fork()
%4 = tail call i32 @putchar(i32 45)
%5 = tail call i32 @wait(i32* null)
%6 = tail call i32 @wait(i32* null)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
long int gethostid(void) {
  __set_errno(ENOSYS);
  return -1L;
}


x86 assembly (clang, -O0):
<gethostid>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffffffffffff,%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@ENOSYS = global i32 0
define i64 @gethostid() {
%1 = load i32, i32* @ENOSYS
%2 = call i32 @__set_errno(i32 %1)
ret i64 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i64 @gethostid() {
%1 = load i32, i32* @ENOSYS
%2 = tail call i32 @__set_errno(i32 %1)
ret i64 -1
}