xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ nc_error(char *);
char *strdup(char *);
char *MYstrdup(char *string) {
  char *str;
  if (!(str = strdup(string)))
    nc_error("memory allocation rejected!");
  return str;
}


x86 assembly (clang, -O0):
<MYstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    114f <MYstrdup+0x2f>
lea    0xeb6(%rip),%rdi
call   1030 <nc_error@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MYstrdup>:
push   %rbx
call   1040 <strdup@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <MYstrdup+0x1a>
lea    0xecb(%rip),%rdi
call   1030 <nc_error@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"memory allocation rejected!\00"
define i8* @MYstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strdup(i8* %4)
store i8* %5, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = call i32 @nc_error(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
@.str = [28 x i8] c"memory allocation rejected!\00"
define noalias i8* @MYstrdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @nc_error(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
int test_imm_6Bint16_mem(short *val) {
  return ((*val) & (-0x6B << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_6Bint16_mem>:
movzwl (%rdi),%eax
test   $0xff95,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_6Bint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, -107
%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_6Bint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -107
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int Bematech_FI_DataUltimaReducao(Var, Retorno) {
  return Formata("\x1b|35|26|\x1b", Var, Retorno);
}


x86 assembly (clang, -O0):
<Bematech_FI_DataUltimaReducao>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <Formata@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Bematech_FI_DataUltimaReducao>:
mov    %esi,%edx
mov    %edi,%esi
lea    0xee5(%rip),%rdi
xor    %eax,%eax
jmp    1030 <Formata@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"\1B|35|26|\1B\00"
define i32 @Bematech_FI_DataUltimaReducao(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @Formata to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
@.str = [10 x i8] c"\1B|35|26|\1B\00"
define i32 @Bematech_FI_DataUltimaReducao(i32 %0, i32 %1) {
%3 = tail call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @Formata to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void Abc_TtPrintVarSet(int Mask, int nVars) {
  int i;
  for (i = 0; i < nVars; i++)
    if ((Mask >> i) & 1)
      printf("1");
    else
      printf(".");
}


x86 assembly (clang, -O0):
<Abc_TtPrintVarSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1175 <Abc_TtPrintVarSet+0x65>
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1156 <Abc_TtPrintVarSet+0x46>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
jmp    1162 <Abc_TtPrintVarSet+0x52>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
jmp    1167 <Abc_TtPrintVarSet+0x57>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <Abc_TtPrintVarSet+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Abc_TtPrintVarSet>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
jle    113b <Abc_TtPrintVarSet+0x2b>
mov    %esi,%ebx
mov    %edi,%r14d
xor    %ebp,%ebp
nop
xor    %eax,%eax
bt     %ebp,%r14d
setb   %al
lea    (%rax,%rax,2),%edi
add    $0x2e,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1120 <Abc_TtPrintVarSet+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @Abc_TtPrintVarSet(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2, %4
%5 = phi i32 [ %11, %4 ], [ 0, %2 ]
%6 = shl nuw i32 1, %5
%7 = and i32 %6, %0
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i32 46, i32 49
%10 = tail call i32 @putchar(i32 %9)
%11 = add nuw nsw i32 %5, 1
%12 = icmp eq i32 %11, %1
br i1 %12, label %13, label %4
13: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t pgm_read_byte(const void *x) { return *((uint8_t *)x); }


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

x86 assembly (clang, -O2):
<pgm_read_byte>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @pgm_read_byte(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @pgm_read_byte(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ sniffpackets();
main() { sniffpackets(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @sniffpackets()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @sniffpackets()
ret i32 0
}
/* Type definitions */
struct status {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ xfree(struct status *);
void status_free(struct status *status) {
  do {
  } while (0);
  do {
  } while (0);
  do {
  } while (0);
  do {
  } while (0);
  do {
  } while (0);
  do {
  } while (0);
  do {
  } while (0);
  do {
  } while (0);
  xfree(status);
}


x86 assembly (clang, -O0):
<status_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
jmp    1121 <status_free+0x11>
jmp    1126 <status_free+0x16>
jmp    112b <status_free+0x1b>
jmp    1130 <status_free+0x20>
jmp    1135 <status_free+0x25>
jmp    113a <status_free+0x2a>
jmp    113f <status_free+0x2f>
jmp    1144 <status_free+0x34>
jmp    1149 <status_free+0x39>
jmp    114e <status_free+0x3e>
jmp    1153 <status_free+0x43>
jmp    1158 <status_free+0x48>
jmp    115d <status_free+0x4d>
jmp    1162 <status_free+0x52>
jmp    1167 <status_free+0x57>
mov    -0x8(%rbp),%rdi
call   1030 <xfree@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<status_free>:
jmp    1030 <xfree@plt>

LLVM IR (-O0):
%struct.status = type { i32 }
define void @status_free(%struct.status* %0) {
%2 = alloca %struct.status*
store %struct.status* %0, %struct.status** %2
br label %3
3: ; preds = %1
br label %4
4: ; preds = %3
br label %5
5: ; preds = %4
br label %6
6: ; preds = %5
br label %7
7: ; preds = %6
br label %8
8: ; preds = %7
br label %9
9: ; preds = %8
br label %10
10: ; preds = %9
br label %11
11: ; preds = %10
br label %12
12: ; preds = %11
br label %13
13: ; preds = %12
br label %14
14: ; preds = %13
br label %15
15: ; preds = %14
br label %16
16: ; preds = %15
br label %17
17: ; preds = %16
br label %18
18: ; preds = %17
%19 = load %struct.status*, %struct.status** %2
%20 = call i32 @xfree(%struct.status* %19)
ret void
}

LLVM IR (-O2):
%struct.status = type { i32 }
define void @status_free(%struct.status* %0) {
%2 = tail call i32 @xfree(%struct.status* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ endtest();
int /*<<< orphan*/ foo();
int /*<<< orphan*/ test();
int main() {
  test();
  foo();
  foo();
  foo();
  endtest();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <test@plt>
mov    $0x0,%al
call   1030 <foo@plt>
mov    $0x0,%al
call   1030 <foo@plt>
mov    $0x0,%al
call   1030 <foo@plt>
mov    $0x0,%al
call   1040 <endtest@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @test()
%2 = call i32 (...) @foo()
%3 = call i32 (...) @foo()
%4 = call i32 (...) @foo()
%5 = call i32 (...) @endtest()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test()
%2 = tail call i32 (...) @foo()
%3 = tail call i32 (...) @foo()
%4 = tail call i32 (...) @foo()
%5 = tail call i32 (...) @endtest()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void got_isd(char *cp, int len) { printf("ISD len=%o\n", len); }


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"ISD len=%o\0A\00"
define void @got_isd(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"ISD len=%o\0A\00"
define void @got_isd(i8* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
void ar_cnt_incr(int my_cid, int dst_bid, int dst_cid, int dst_cnt, int val) {}


x86 assembly (clang, -O0):
<ar_cnt_incr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @ar_cnt_incr(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
ret void
}

LLVM IR (-O2):
define void @ar_cnt_incr(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
ret void
}
scs(g, c) int g;
char c;
{
  printf("%c%c%c%c%c%c%c", 27, g ? ')' : '(', c, 27, g ? '(' : ')', 'B',
         g ? 14 : 15);
}


x86 assembly (clang, -O0):
<scs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %edi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x28,%edx
mov    $0x29,%eax
cmp    $0x0,%ecx
cmovne %eax,%edx
movsbl -0x9(%rbp),%ecx
mov    -0x8(%rbp),%esi
mov    $0x29,%r9d
mov    $0x28,%eax
cmp    $0x0,%esi
cmovne %eax,%r9d
mov    -0x8(%rbp),%edi
mov    $0xf,%eax
mov    $0xe,%esi
cmp    $0x0,%edi
cmovne %esi,%eax
lea    0xe99(%rip),%rdi
mov    $0x1b,%r8d
mov    %r8d,%esi
movl   $0x42,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scs>:
push   %rax
xor    %r10d,%r10d
test   %edi,%edi
sete   %r10b
mov    %r10d,%edx
xor    $0x29,%edx
movsbl %sil,%ecx
lea    0x28(%r10),%r9d
or     $0xe,%r10d
lea    0xecd(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1b,%r8d
xor    %eax,%eax
push   %r10
push   $0x42
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%c%c%c%c%c%c%c\00"
define i32 @scs(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = trunc i32 %1 to i8
store i32 %0, i32* %4
store i8 %6, i8* %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 41, i32 40
%11 = load i8, i8* %5
%12 = sext i8 %11 to i32
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 40, i32 41
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 0
%19 = zext i1 %18 to i64
%20 = select i1 %18, i32 14, i32 15
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 27, i32 %10, i32 %12, i32 27, i32 %16, i32 66, i32 %20)
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str = [15 x i8] c"%c%c%c%c%c%c%c\00"
define i32 @scs(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = select i1 %3, i32 40, i32 41
%5 = shl i32 %1, 24
%6 = ashr exact i32 %5, 24
%7 = select i1 %3, i32 41, i32 40
%8 = select i1 %3, i32 15, i32 14
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 27, i32 %4, i32 %6, i32 27, i32 %7, i32 66, i32 %8)
ret i32 undef
}
/* Variables and functions */
int get_mdterm();
void md_draw_string_gray(int x, int y, char *str) {
  switch (get_mdterm()) {}
}


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

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

LLVM IR (-O0):
define void @md_draw_string_gray(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = call i32 (...) @get_mdterm()
switch i32 %7, label %8 [
]
8: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @md_draw_string_gray(i32 %0, i32 %1, i8* nocapture readnone %2) {
%4 = tail call i32 (...) @get_mdterm()
ret void
}
int error_simgen_clearerrorcodes(void *gen) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @error_simgen_clearerrorcodes(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ lgen(char *, char *, int);
void cgjump(int n) { lgen("%s\t%c%d", "jmp", n); }


x86 assembly (clang, -O0):
<cgjump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xedb(%rip),%rdi
lea    0xedc(%rip),%rsi
call   1030 <lgen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgjump>:
mov    %edi,%edx
lea    0xee7(%rip),%rdi
lea    0xee8(%rip),%rsi
jmp    1030 <lgen@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"%s\09%c%d\00"
@.str.1 = [4 x i8] c"jmp\00"
define void @cgjump(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @lgen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s\09%c%d\00"
@.str.1 = [4 x i8] c"jmp\00"
define void @cgjump(i32 %0) {
%2 = tail call i32 @lgen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EIO;
int /*<<< orphan*/ errno;
size_t getentropy_sysctl(void *, size_t);
int getentropy(void *buf, size_t len) {
  if (len <= 256 && getentropy_sysctl(buf, len) == len)
    return (0);
  errno = EIO;
  return (-1);
}


x86 assembly (clang, -O0):
<getentropy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x100,-0x18(%rbp)
ja     1151 <getentropy+0x41>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <getentropy_sysctl@plt>
cmp    -0x18(%rbp),%rax
jne    1151 <getentropy+0x41>
movl   $0x0,-0x4(%rbp)
jmp    116a <getentropy+0x5a>
mov    0x2e88(%rip),%rax
mov    (%rax),%ecx
mov    0x2e77(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getentropy>:
push   %rbx
cmp    $0x100,%rsi
ja     112c <getentropy+0x1c>
mov    %rsi,%rbx
call   1030 <getentropy_sysctl@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rbx,%rcx
je     1143 <getentropy+0x33>
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
mov    0x2e9c(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@EIO = global i32 0
@errno = global i32 0
define i32 @getentropy(i8* %0, i64 %1) {
%3 = icmp ult i64 %1, 257
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i64 @getentropy_sysctl(i8* %0, i64 %1)
%6 = icmp eq i64 %5, %1
br i1 %6, label %9, label %7
7: ; preds = %4, %2
%8 = load i32, i32* @EIO
store i32 %8, i32* @errno
br label %9
9: ; preds = %4, %7
%10 = phi i32 [ -1, %7 ], [ 0, %4 ]
ret i32 %10
}
void of_reserved_mem_device_release(struct device *dev) {}


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

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

LLVM IR (-O0):
%struct.device = type opaque
define void @of_reserved_mem_device_release(%struct.device* %0) {
%2 = alloca %struct.device*
store %struct.device* %0, %struct.device** %2
ret void
}

LLVM IR (-O2):
%struct.device = type opaque
define void @of_reserved_mem_device_release(%struct.device* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _Mem_Free(void *, int, int /*<<< orphan*/, char const *,
                             int);
void CL_UIModule_MemFree(void *data, const char *filename, int fileline) {
  _Mem_Free(data, 4, 0, filename, fileline);
}


x86 assembly (clang, -O0):
<CL_UIModule_MemFree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    $0x4,%esi
xor    %edx,%edx
call   1030 <_Mem_Free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CL_UIModule_MemFree>:
mov    %edx,%r8d
mov    %rsi,%rcx
mov    $0x4,%esi
xor    %edx,%edx
jmp    1030 <_Mem_Free@plt>

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

LLVM IR (-O2):
define void @CL_UIModule_MemFree(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @_Mem_Free(i8* %0, i32 4, i32 0, i8* %1, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_55() {
  Assert_real((isqrt(55) == 7),
              "/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",
              280, ("Integer square root of 55 should be 7"));
}


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

x86 assembly (clang, -O2):
<t_sqrt_55>:
push   %rax
mov    $0x37,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0x7,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x118,%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 = [38 x i8] c"Integer square root of 55 should be 7\00"
define void @t_sqrt_55() {
%1 = call i32 @isqrt(i32 55)
%2 = icmp eq i32 %1, 7
%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 280, i8* getelementptr inbounds ([38 x i8], [38 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 = [38 x i8] c"Integer square root of 55 should be 7\00"
define void @t_sqrt_55() {
%1 = tail call i32 @isqrt(i32 55)
%2 = icmp eq i32 %1, 7
%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 280, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void gtk_label_get_layout() {}


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

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

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

LLVM IR (-O2):
define void @gtk_label_get_layout() {
ret void
}
void test33(void) {
  short int a;
  long int b;
  b = (int)a;
}


x86 assembly (clang, -O0):
<test33>:
push   %rbp
mov    %rsp,%rbp
movswl -0x2(%rbp),%eax
cltq
mov    %rax,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test33() {
%1 = alloca i16
%2 = alloca i64
%3 = load i16, i16* %1
%4 = sext i16 %3 to i32
%5 = sext i32 %4 to i64
store i64 %5, i64* %2
ret void
}

LLVM IR (-O2):
define void @test33() {
ret void
}
unsigned int f2(unsigned int diff) {
  return ((unsigned int)((signed int)diff < 0 ? -diff : diff));
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111e <f2+0x1e>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <f2+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sub i32 0, %6
br label %10
8: ; preds = %1
%9 = load i32, i32* %2
br label %10
10: ; preds = %8, %5
%11 = phi i32 [ %7, %5 ], [ %9, %8 ]
ret i32 %11
}

LLVM IR (-O2):
define i32 @f2(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 false)
ret i32 %2
}
/* Variables and functions */
unsigned char getk();
int /*<<< orphan*/ printf(char *, unsigned char);
main() {
  unsigned char a;
  while (1) {
    a = getk();
    printf("%u\n", a);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getk@plt>
mov    %al,-0x5(%rbp)
lea    0xec0(%rip),%rdi
movzbl -0x5(%rbp),%esi
call   1030 <printf@plt>
jmp    112f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getk@plt>
movzbl %al,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
jmp    1130 <main+0x10>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%u\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call zeroext i8 (...) @getk()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext %2)
br label %1
}
/* Variables and functions */
int op_lock2(int, int /*<<< orphan*/);
int op_lock(int timeout) { return (op_lock2(timeout, 0)); }


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

x86 assembly (clang, -O2):
<op_lock>:
xor    %esi,%esi
jmp    1030 <op_lock2@plt>

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

LLVM IR (-O2):
define i32 @op_lock(i32 %0) {
%2 = tail call i32 @op_lock2(i32 %0, i32 0)
ret i32 %2
}
/* Variables and functions */
int XSUM_main(int, char **);
int main(int argc, char *argv[]) { return XSUM_main(argc, argv); }


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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <XSUM_main@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1030 <XSUM_main@plt>

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 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @XSUM_main(i32 %6, i8** %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @XSUM_main(i32 %0, i8** %1)
ret i32 %3
}
void genlw() {}


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

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

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

LLVM IR (-O2):
define void @genlw() {
ret void
}
/* Variables and functions */
int rand();
int DM_Friend(int min_num, int max_num) {
  int result = 0, low_num = 0, hi_num = 0;
  if (min_num < max_num) {
    low_num = min_num;
    hi_num = max_num + 1;
  } else {
    low_num = max_num + 1;
    hi_num = min_num;
  }
  result = (rand() % (hi_num - low_num)) + low_num;
  return result;
}


x86 assembly (clang, -O0):
<DM_Friend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1153 <DM_Friend+0x43>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1162 <DM_Friend+0x52>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x14(%rbp),%ecx
sub    -0x10(%rbp),%ecx
cltd
idiv   %ecx
add    -0x10(%rbp),%edx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DM_Friend>:
push   %rbp
push   %rbx
push   %rax
lea    0x1(%rsi),%ebp
cmp    %esi,%edi
mov    %ebp,%ebx
cmovl  %edi,%ebx
cmovge %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
sub    %ebx,%ebp
cltd
idiv   %ebp
add    %edx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @DM_Friend(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
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* %3
store i32 %12, i32* %6
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 1
store i32 %14, i32* %7
br label %19
15: ; preds = %2
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %6
%18 = load i32, i32* %3
store i32 %18, i32* %7
br label %19
19: ; preds = %15, %11
%20 = call i32 (...) @rand()
%21 = load i32, i32* %7
%22 = load i32, i32* %6
%23 = sub nsw i32 %21, %22
%24 = srem i32 %20, %23
%25 = load i32, i32* %6
%26 = add nsw i32 %24, %25
store i32 %26, i32* %5
%27 = load i32, i32* %5
ret i32 %27
}

LLVM IR (-O2):
define i32 @DM_Friend(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = add nsw i32 %1, 1
%5 = select i1 %3, i32 %0, i32 %4
%6 = select i1 %3, i32 %4, i32 %0
%7 = tail call i32 (...) @rand()
%8 = sub nsw i32 %6, %5
%9 = srem i32 %7, %8
%10 = add nsw i32 %9, %5
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ check_supported_features();
void initialize(void) { check_supported_features(); }


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

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

LLVM IR (-O0):
define void @initialize() {
%1 = call i32 (...) @check_supported_features()
ret void
}

LLVM IR (-O2):
define void @initialize() {
%1 = tail call i32 (...) @check_supported_features()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void bill(char *arg) { printf("bill: you passed %s\n", arg); }


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"bill: you passed %s\0A\00"
define void @bill(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"bill: you passed %s\0A\00"
define void @bill(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
unsigned int __rthal_do_div(unsigned long long *, unsigned int const);
unsigned long long __rthal_generic_ulldiv(unsigned long long ull,
                                          const unsigned uld,
                                          unsigned long *const rp) {
  const unsigned r = __rthal_do_div(&(ull), (uld));
  if (rp)
    *rp = r;
  return ull;
}


x86 assembly (clang, -O0):
<__rthal_generic_ulldiv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%esi
lea    -0x8(%rbp),%rdi
call   1030 <__rthal_do_div@plt>
mov    %eax,-0x1c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1149 <__rthal_generic_ulldiv+0x39>
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__rthal_generic_ulldiv>:
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %rdi,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <__rthal_do_div@plt>
test   %rbx,%rbx
je     1131 <__rthal_generic_ulldiv+0x21>
mov    %eax,%eax
mov    %rax,(%rbx)
mov    0x8(%rsp),%rax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @__rthal_generic_ulldiv(i64 %0, i32 %1, i64* writeonly %2) {
%4 = alloca i64
store i64 %0, i64* %4
%5 = call i32 @__rthal_do_div(i64* %4, i32 %1)
%6 = icmp eq i64* %2, null
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = zext i32 %5 to i64
store i64 %8, i64* %2
br label %9
9: ; preds = %7, %3
%10 = load i64, i64* %4
ret i64 %10
}
/* Variables and functions */
scalar_t__ EINTR;
scalar_t__ errno;
int waitpid(int, int *, int);
int my_waitpid(int pid, int *status, int flags) {
  int ret;
  do {
    ret = waitpid(pid, status, flags);
  } while (ret == -1 && errno == EINTR);
  return ret;
}


x86 assembly (clang, -O0):
<my_waitpid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <waitpid@plt>
mov    %eax,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0xffffffff,-0x18(%rbp)
mov    %al,-0x19(%rbp)
jne    115d <my_waitpid+0x4d>
mov    0x2e96(%rip),%rax
mov    (%rax),%rax
mov    0x2e84(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1122 <my_waitpid+0x12>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_waitpid>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2eb9(%rip),%r15
mov    0x2eaa(%rip),%r12
xchg   %ax,%ax
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1030 <waitpid@plt>
cmp    $0xffffffff,%eax
jne    114b <my_waitpid+0x3b>
mov    (%r12),%rcx
cmp    %rcx,(%r15)
je     1130 <my_waitpid+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i64 0
@EINTR = global i64 0
define i32 @my_waitpid(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32 %2, i32* %6
br label %8
8: ; preds = %20, %3
%9 = load i32, i32* %4
%10 = load i32*, i32** %5
%11 = load i32, i32* %6
%12 = call i32 @waitpid(i32 %9, i32* %10, i32 %11)
store i32 %12, i32* %7
br label %13
13: ; preds = %8
%14 = load i32, i32* %7
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i64, i64* @errno
%18 = load i64, i64* @EINTR
%19 = icmp eq i64 %17, %18
br label %20
20: ; preds = %16, %13
%21 = phi i1 [ false, %13 ], [ %19, %16 ]
br i1 %21, label %8, label %22
22: ; preds = %20
%23 = load i32, i32* %7
ret i32 %23
}

LLVM IR (-O2):
@errno = global i64 0
@EINTR = global i64 0
define i32 @my_waitpid(i32 %0, i32* %1, i32 %2) {
br label %4
4: ; preds = %4, %3
%5 = tail call i32 @waitpid(i32 %0, i32* %1, i32 %2)
%6 = icmp eq i32 %5, -1
%7 = load i64, i64* @errno
%8 = load i64, i64* @EINTR
%9 = icmp eq i64 %7, %8
%10 = select i1 %6, i1 %9, i1 false
br i1 %10, label %4, label %11
11: ; preds = %4
ret i32 %5
}
/* Type definitions */
struct CANRCVBUF {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CAN_gateway_send(struct CANRCVBUF *);
void msg_out_can(struct CANRCVBUF *p) {
  CAN_gateway_send(p);
  return;
}


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

x86 assembly (clang, -O2):
<msg_out_can>:
jmp    1030 <CAN_gateway_send@plt>

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

LLVM IR (-O2):
%struct.CANRCVBUF = type { i32 }
define void @msg_out_can(%struct.CANRCVBUF* %0) {
%2 = tail call i32 @CAN_gateway_send(%struct.CANRCVBUF* %0)
ret void
}
float readTemperature() { return 20; }


x86 assembly (clang, -O0):
<readTemperature>:
push   %rbp
mov    %rsp,%rbp
movss  0xef4(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<readTemperature>:
movss  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @readTemperature() {
ret float 2.000000e+01
}

LLVM IR (-O2):
define float @readTemperature() {
ret float 2.000000e+01
}
/* Variables and functions */
int /*<<< orphan*/ QSlog(char *, int);
scalar_t__ malloc(size_t);
void *ILLutil_allocrus(size_t size) {
  void *mem = (void *)NULL;
  if (size == 0) {
  }
  mem = (void *)malloc(size);
  if (mem == (void *)NULL) {
    QSlog("Out of memory. Asked for %d bytes", (int)size);
  }
  return mem;
}


x86 assembly (clang, -O0):
<ILLutil_allocrus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1144 <ILLutil_allocrus+0x24>
jmp    1144 <ILLutil_allocrus+0x24>
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116e <ILLutil_allocrus+0x4e>
mov    -0x8(%rbp),%rax
mov    %eax,%esi
lea    0xe97(%rip),%rdi
call   1040 <QSlog@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ILLutil_allocrus>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <ILLutil_allocrus+0x23>
lea    0xec5(%rip),%rdi
mov    %r14d,%esi
call   1040 <QSlog@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [34 x i8] c"Out of memory. Asked for %d bytes\00"
define i8* @ILLutil_allocrus(i64 %0) {
%2 = tail call i64 @malloc(i64 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = trunc i64 %0 to i32
%6 = tail call i32 @QSlog(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %7
7: ; preds = %4, %1
%8 = inttoptr i64 %2 to i8*
ret i8* %8
}
/* Variables and functions */
scalar_t__ alloc(scalar_t__);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *cat2(char *a, char *b) {
  char *ret = (char *)alloc(strlen(a) + strlen(b) + 1);
  strcpy(ret, a);
  strcat(ret, b);
  return ret;
}


x86 assembly (clang, -O0):
<cat2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   1050 <alloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cat2>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    (%r15,%rax,1),%rdi
add    $0x1,%rdi
call   1050 <alloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @cat2(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
%10 = add nsw i64 %7, %9
%11 = add nsw i64 %10, 1
%12 = call i64 @alloc(i64 %11)
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %5
%14 = load i8*, i8** %5
%15 = load i8*, i8** %3
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = load i8*, i8** %5
%18 = load i8*, i8** %4
%19 = call i32 @strcat(i8* %17, i8* %18)
%20 = load i8*, i8** %5
ret i8* %20
}

LLVM IR (-O2):
define i8* @cat2(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add i64 %3, 1
%6 = add i64 %5, %4
%7 = tail call i64 @alloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i32 @strcpy(i8* %8, i8* %0)
%10 = tail call i32 @strcat(i8* %8, i8* %1)
ret i8* %8
}
void __terminate(ptr, filename, linenumber) void *ptr;
char *filename;
int linenumber;
{
  if (!ptr)
    __cause_ex1("empty", filename, linenumber);
  free(ptr);
}


x86 assembly (clang, -O0):
<__terminate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1153 <__terminate+0x33>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1040 <__cause_ex1@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__terminate>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
jne    1137 <__terminate+0x17>
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1040 <__cause_ex1@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"empty\00"
define void @__terminate(i8* %0, i8* %1, i32 %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @__cause_ex1 to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %2)
br label %7
7: ; preds = %5, %3
tail call void @free(i8* %0)
ret void
}
int valid_d_char(char c) {
  return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c == '_');
}


x86 assembly (clang, -O0):
<valid_d_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     1129 <valid_d_char+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x39,%ecx
mov    %al,-0x2(%rbp)
jle    1155 <valid_d_char+0x55>
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1148 <valid_d_char+0x48>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x5a,%ecx
mov    %al,-0x2(%rbp)
jle    1155 <valid_d_char+0x55>
movsbl -0x1(%rbp),%eax
cmp    $0x5f,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_d_char>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
setb   %al
lea    -0x41(%rdi),%ecx
cmp    $0x1a,%cl
setb   %cl
or     %al,%cl
cmp    $0x5f,%dil
sete   %al
or     %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @valid_d_char(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br i1 %9, label %22, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 65
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 90
br i1 %17, label %22, label %18
18: ; preds = %14, %10
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 95
br label %22
22: ; preds = %18, %14, %6
%23 = phi i1 [ true, %14 ], [ true, %6 ], [ %21, %18 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @valid_d_char(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = add i8 %0, -65
%5 = icmp ult i8 %4, 26
%6 = or i1 %3, %5
%7 = icmp eq i8 %0, 95
%8 = or i1 %7, %6
%9 = zext i1 %8 to i32
ret i32 %9
}