xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ rec(int **, int);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int a;
  int *p;
  p = &a;
  scanf("%d", p);
  rec(&p, a);
}


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

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xc(%rsp),%rsi
mov    %rsi,0x10(%rsp)
lea    0xecb(%rip),%rdi
call   1030 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0x10(%rsp),%rdi
call   1040 <rec@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

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


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

x86 assembly (clang, -O2):
<enviarMensajeComp1>:
jmp    1030 <enviarCadena_1@plt>

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

LLVM IR (-O2):
define void @enviarMensajeComp1(i8* %0) {
%2 = tail call i32 @enviarCadena_1(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ nand_wait_idle();
void nand_reset(void) {
  ((*(volatile unsigned long *)(0x70200000 + 0x04)) &= ~(1 << 1));
  (*(volatile unsigned long *)(0x70200000 + 0x08)) = 0xff;
  nand_wait_idle();
  ((*(volatile unsigned long *)(0x70200000 + 0x04)) |= (1 << 1));
}


x86 assembly (clang, -O0):
<nand_reset>:
push   %rbp
mov    %rsp,%rbp
mov    $0x70200004,%eax
mov    (%rax),%rcx
and    $0xfffffffffffffffd,%rcx
mov    $0x70200004,%eax
mov    %rcx,(%rax)
mov    $0x70200008,%eax
movq   $0xff,(%rax)
mov    $0x0,%al
call   1030 <nand_wait_idle@plt>
mov    $0x70200004,%eax
mov    (%rax),%rcx
or     $0x2,%rcx
mov    $0x70200004,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<nand_reset>:
push   %rax
andq   $0xfffffffffffffffd,0x70200004
70 fd
movq   $0xff,0x70200008
xor    %eax,%eax
call   1030 <nand_wait_idle@plt>
orq    $0x2,0x70200004
70 02
pop    %rax
ret

LLVM IR (-O0):
define void @nand_reset() {
%1 = load volatile i64, i64* inttoptr (i64 1881145348 to i64*)
%2 = and i64 %1, -3
store volatile i64 %2, i64* inttoptr (i64 1881145348 to i64*)
store volatile i64 255, i64* inttoptr (i64 1881145352 to i64*)
%3 = call i32 (...) @nand_wait_idle()
%4 = load volatile i64, i64* inttoptr (i64 1881145348 to i64*)
%5 = or i64 %4, 2
store volatile i64 %5, i64* inttoptr (i64 1881145348 to i64*)
ret void
}

LLVM IR (-O2):
define void @nand_reset() {
%1 = load volatile i64, i64* inttoptr (i64 1881145348 to i64*)
%2 = and i64 %1, -3
store volatile i64 %2, i64* inttoptr (i64 1881145348 to i64*)
store volatile i64 255, i64* inttoptr (i64 1881145352 to i64*)
%3 = tail call i32 (...) @nand_wait_idle()
%4 = load volatile i64, i64* inttoptr (i64 1881145348 to i64*)
%5 = or i64 %4, 2
store volatile i64 %5, i64* inttoptr (i64 1881145348 to i64*)
ret void
}
OP(fd, eb) {
  illegal_1();
  op_eb();
}


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <illegal_1@plt>
mov    $0x0,%al
call   1040 <op_eb@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OP>:
push   %rax
xor    %eax,%eax
call   1030 <illegal_1@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <op_eb@plt>

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_1()
%4 = tail call i32 (...) @op_eb()
ret i32 undef
}
int usb_interrupt_read(void) { return 3; }


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

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

LLVM IR (-O0):
define i32 @usb_interrupt_read() {
ret i32 3
}

LLVM IR (-O2):
define i32 @usb_interrupt_read() {
ret i32 3
}
/* Variables and functions */
int maximo(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a = 100;
  int b = 200;
  int maior;
  printf("Maior: %d\n", maximo(a, b));
  maior = maximo(a, b);
  printf("Maior: %d\n", maior);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0x8(%rbp)
movl   $0xc8,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <maximo@plt>
mov    %eax,%esi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <maximo@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x64,%edi
mov    $0xc8,%esi
call   1040 <maximo@plt>
lea    0xec9(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x64,%edi
mov    $0xc8,%esi
call   1040 <maximo@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"Maior: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @maximo(i32 100, i32 200)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @maximo(i32 100, i32 200)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int gmx_disre(int, char **);
int main(int argc, char *argv[]) { return gmx_disre(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 <gmx_disre@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1030 <gmx_disre@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 @gmx_disre(i32 %6, i8** %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @gmx_disre(i32 %0, i8** %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ initsetuid();
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  if (!(initsetuid()))
    exit(1);
  system("/etc/rc.d/rc.vlan");
  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   1040 <initsetuid@plt>
cmp    $0x0,%eax
jne    1160 <main+0x30>
mov    $0x1,%edi
call   1050 <exit@plt>
lea    0xe99(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <initsetuid@plt>
test   %eax,%eax
je     114c <main+0x1c>
lea    0xebd(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"/etc/rc.d/rc.vlan\00"
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 (...) @initsetuid()
%7 = icmp ne i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = call i32 @system(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"/etc/rc.d/rc.vlan\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @initsetuid()
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
%8 = tail call i32 @system(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void i2d_PKCS7_SIGNER_INFO(void) {}


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

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

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

LLVM IR (-O2):
define void @i2d_PKCS7_SIGNER_INFO() {
ret void
}
int times(struct tms *buf) { return -1; }


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

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

LLVM IR (-O0):
%struct.tms = type opaque
define i32 @times(%struct.tms* %0) {
%2 = alloca %struct.tms*
store %struct.tms* %0, %struct.tms** %2
ret i32 -1
}

LLVM IR (-O2):
%struct.tms = type opaque
define i32 @times(%struct.tms* nocapture readnone %0) {
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int vfprintf(int /*<<< orphan*/ *, char const *, int /*<<< orphan*/);
int c_vfprintf(void *stream, const char *format, va_list ap) {
  return vfprintf((FILE *)stream, format, ap);
}


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

x86 assembly (clang, -O2):
<c_vfprintf>:
jmp    1030 <vfprintf@plt>

LLVM IR (-O0):
define i32 @c_vfprintf(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 = bitcast i8* %7 to i32*
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @vfprintf(i32* %8, i8* %9, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @c_vfprintf(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = bitcast i8* %0 to i32*
%5 = tail call i32 @vfprintf(i32* %4, i8* %1, i32 %2)
ret i32 %5
}
char hex_to_ascii(hexnum)
unsigned char hexnum;
{
  if (hexnum < 10)
    return ('0' + hexnum);
  else
    return ('a' + hexnum - 10);
}


x86 assembly (clang, -O0):
<hex_to_ascii>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
cmp    $0xa,%eax
jge    1126 <hex_to_ascii+0x26>
movzbl -0x2(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x1(%rbp)
jmp    1133 <hex_to_ascii+0x33>
movzbl -0x2(%rbp),%eax
add    $0x61,%eax
sub    $0xa,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex_to_ascii>:
mov    %edi,%eax
and    $0xfe,%eax
cmp    $0xa,%eax
mov    $0x30,%ecx
mov    $0x57,%eax
cmovb  %ecx,%eax
add    %dil,%al
ret

LLVM IR (-O0):
define signext i8 @hex_to_ascii(i32 %0) {
%2 = alloca i8
%3 = alloca i8
%4 = trunc i32 %0 to i8
store i8 %4, i8* %3
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = add nsw i32 48, %10
%12 = trunc i32 %11 to i8
store i8 %12, i8* %2
br label %19
13: ; preds = %1
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = add nsw i32 97, %15
%17 = sub nsw i32 %16, 10
%18 = trunc i32 %17 to i8
store i8 %18, i8* %2
br label %19
19: ; preds = %13, %8
%20 = load i8, i8* %2
ret i8 %20
}

LLVM IR (-O2):
define signext i8 @hex_to_ascii(i32 %0) {
%2 = and i32 %0, 254
%3 = icmp ult i32 %2, 10
%4 = trunc i32 %0 to i8
%5 = select i1 %3, i8 48, i8 87
%6 = add i8 %5, %4
ret i8 %6
}
/* Type definitions */
struct libxsvf_host {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long, unsigned long, unsigned long,
                          unsigned long);
void h_report_device(struct libxsvf_host *h, unsigned long idcode) {
  printf("Device found: idcode=0x%08lx, revision=0x%01lx, part=0x%04lx, "
         "manufactor=0x%03lx\n",
         idcode, (idcode >> 28) & 0xf, (idcode >> 12) & 0xffff,
         (idcode >> 1) & 0x7ff);
}


x86 assembly (clang, -O0):
<h_report_device>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rdx
shr    $0x1c,%rdx
and    $0xf,%rdx
mov    -0x10(%rbp),%rcx
shr    $0xc,%rcx
and    $0xffff,%rcx
mov    -0x10(%rbp),%r8
shr    $0x1,%r8
and    $0x7ff,%r8
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<h_report_device>:
mov    %esi,%eax
mov    %esi,%r8d
mov    %esi,%edx
shr    $0x1c,%edx
shr    $0xc,%eax
movzwl %ax,%ecx
shr    %r8d
and    $0x7ff,%r8d
lea    0xecf(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.libxsvf_host = type { i32 }
@.str = [82 x i8] c"Device found: idcode=0x%08lx, revision=0x%01lx, part=0x%04lx, manufactor=0x%03lx\0A\00"
define void @h_report_device(%struct.libxsvf_host* %0, i64 %1) {
%3 = alloca %struct.libxsvf_host*
%4 = alloca i64
store %struct.libxsvf_host* %0, %struct.libxsvf_host** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %4
%7 = lshr i64 %6, 28
%8 = and i64 %7, 15
%9 = load i64, i64* %4
%10 = lshr i64 %9, 12
%11 = and i64 %10, 65535
%12 = load i64, i64* %4
%13 = lshr i64 %12, 1
%14 = and i64 %13, 2047
%15 = call i32 @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0), i64 %5, i64 %8, i64 %11, i64 %14)
ret void
}

LLVM IR (-O2):
%struct.libxsvf_host = type { i32 }
@.str = [82 x i8] c"Device found: idcode=0x%08lx, revision=0x%01lx, part=0x%04lx, manufactor=0x%03lx\0A\00"
define void @h_report_device(%struct.libxsvf_host* nocapture readnone %0, i64 %1) {
%3 = lshr i64 %1, 28
%4 = and i64 %3, 15
%5 = lshr i64 %1, 12
%6 = and i64 %5, 65535
%7 = lshr i64 %1, 1
%8 = and i64 %7, 2047
%9 = tail call i32 @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0), i64 %1, i64 %4, i64 %6, i64 %8)
ret void
}
void initFaultCounter(unsigned int *counter) { *counter = 0; }


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

x86 assembly (clang, -O2):
<initFaultCounter>:
movl   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @initFaultCounter(i32* nocapture writeonly %0) {
store i32 0, i32* %0
ret void
}
/* Variables and functions */
void *calloc(size_t, int);
void *create_bitset(size_t N) { return calloc((N + 7) / 8, 1); }


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

x86 assembly (clang, -O2):
<create_bitset>:
add    $0x7,%rdi
shr    $0x3,%rdi
mov    $0x1,%esi
jmp    1030 <calloc@plt>

LLVM IR (-O0):
define i8* @create_bitset(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 7
%5 = udiv i64 %4, 8
%6 = call i8* @calloc(i64 %5, i32 1)
ret i8* %6
}

LLVM IR (-O2):
define i8* @create_bitset(i64 %0) {
%2 = add i64 %0, 7
%3 = lshr i64 %2, 3
%4 = tail call i8* @calloc(i64 %3, i32 1)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ sc();
main() {
  errno = -sc();
  perror("test of invalid syscall");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <sc@plt>
xor    %ecx,%ecx
sub    %eax,%ecx
mov    0x2eaa(%rip),%rax
mov    %ecx,(%rax)
lea    0xec1(%rip),%rdi
call   1040 <perror@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <sc@plt>
neg    %eax
mov    0x2eaf(%rip),%rcx
mov    %eax,(%rcx)
lea    0xec6(%rip),%rdi
call   1040 <perror@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@errno = global i32 0
@.str = [24 x i8] c"test of invalid syscall\00"
define i32 @main() {
%1 = call i32 (...) @sc()
%2 = sub nsw i32 0, %1
store i32 %2, i32* @errno
%3 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [24 x i8] c"test of invalid syscall\00"
define i32 @main() {
%1 = tail call i32 (...) @sc()
%2 = sub nsw i32 0, %1
store i32 %2, i32* @errno
%3 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int __VERIFIER_nondet_int();
int main() {
  int x;
  int y;
  int res;
  x = __VERIFIER_nondet_int();
  y = 2;
  res = 1;
  if (x < 0 || y < 1) {
  } else {
    while (x > y) {
      y = y * y;
      res = 2 * res;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     114b <main+0x3b>
cmpl   $0x1,-0xc(%rbp)
jge    1150 <main+0x40>
jmp    117e <main+0x6e>
jmp    1155 <main+0x45>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1179 <main+0x69>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1155 <main+0x45>
jmp    117e <main+0x6e>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %5, i32* %2
store i32 2, i32* %3
store i32 1, i32* %4
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 1
br i1 %10, label %11, label %12
11: ; preds = %8, %0
br label %24
12: ; preds = %8
br label %13
13: ; preds = %17, %12
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = icmp sgt i32 %14, %15
br i1 %16, label %17, label %23
17: ; preds = %13
%18 = load i32, i32* %3
%19 = load i32, i32* %3
%20 = mul nsw i32 %18, %19
store i32 %20, i32* %3
%21 = load i32, i32* %4
%22 = mul nsw i32 2, %21
store i32 %22, i32* %4
br label %13
23: ; preds = %13
br label %24
24: ; preds = %23, %11
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
ret i32 0
}
/* Variables and functions */
int STC31xx_Read(int, int, unsigned char *);
int STC311x_ReadRamData(unsigned char *RamData) {
  return (STC31xx_Read(16, 0x20, RamData));
}


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

x86 assembly (clang, -O2):
<STC311x_ReadRamData>:
mov    %rdi,%rdx
mov    $0x10,%edi
mov    $0x20,%esi
jmp    1030 <STC31xx_Read@plt>

LLVM IR (-O0):
define i32 @STC311x_ReadRamData(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @STC31xx_Read(i32 16, i32 32, i8* %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @STC311x_ReadRamData(i8* %0) {
%2 = tail call i32 @STC31xx_Read(i32 16, i32 32, i8* %0)
ret i32 %2
}
int isidchr(c)
char c;
{ return isalpha(c) || c == '$' || isdigit(c) || c == '.' || c == '_'; }


x86 assembly (clang, -O0):
<isidchr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <isalpha@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x2(%rbp)
jne    1191 <isidchr+0x71>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x24,%ecx
mov    %al,-0x2(%rbp)
je     1191 <isidchr+0x71>
movsbl -0x1(%rbp),%edi
call   1030 <isdigit@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x2(%rbp)
jne    1191 <isidchr+0x71>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2e,%ecx
mov    %al,-0x2(%rbp)
je     1191 <isidchr+0x71>
movsbl -0x1(%rbp),%eax
cmp    $0x5f,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isidchr>:
push   %rbp
push   %rbx
push   %rax
movsbl %dil,%ebx
mov    %edi,%ebp
shl    $0x18,%ebp
mov    %ebx,%edi
call   1030 <isalpha@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x24000000,%ebp
je     1151 <isidchr+0x41>
test   %ecx,%ecx
jne    1151 <isidchr+0x41>
cmp    $0x2e000000,%ebp
je     1151 <isidchr+0x41>
add    $0xffffffd0,%ebx
cmp    $0xa,%ebx
jb     1151 <isidchr+0x41>
xor    %eax,%eax
cmp    $0x5f000000,%ebp
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @isidchr(i32 %0) {
%2 = alloca i8
%3 = trunc i32 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = call i32 @isalpha(i32 %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %25, label %8
8: ; preds = %1
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 36
br i1 %11, label %25, label %12
12: ; preds = %8
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = call i32 @isdigit(i32 %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %25, label %17
17: ; preds = %12
%18 = load i8, i8* %2
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 46
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = load i8, i8* %2
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 95
br label %25
25: ; preds = %21, %17, %12, %8, %1
%26 = phi i1 [ true, %17 ], [ true, %12 ], [ true, %8 ], [ true, %1 ], [ %24, %21 ]
%27 = zext i1 %26 to i32
ret i32 %27
}

LLVM IR (-O2):
define i32 @isidchr(i32 %0) {
%2 = shl i32 %0, 24
%3 = ashr exact i32 %2, 24
%4 = tail call i32 @isalpha(i32 %3)
%5 = icmp ne i32 %4, 0
%6 = icmp eq i32 %2, 603979776
%7 = or i1 %6, %5
br i1 %7, label %16, label %8
8: ; preds = %1
%9 = add nsw i32 %3, -48
%10 = icmp ult i32 %9, 10
%11 = icmp eq i32 %2, 771751936
%12 = or i1 %11, %10
br i1 %12, label %16, label %13
13: ; preds = %8
%14 = icmp eq i32 %2, 1593835520
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %13, %8, %1
%17 = phi i32 [ 1, %8 ], [ 1, %1 ], [ %15, %13 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void die_sans_errno(const char *msg) {
  fprintf(stderr, "%s\n", msg);
  exit(EXIT_FAILURE);
}


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

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

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@EXIT_FAILURE = global i32 0
define void @die_sans_errno(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
void node_from_4byte(int node, int *letter, int *index, int *word_flag,
                     int *end_flag) {
  *letter = (0x000000FF) & node;
  *index = ((0xFFFFFF00) & node) >> 8;
  *word_flag = (node & (0x00000200)) > 0;
  *end_flag = (node & (0x00000100)) > 0;
}


x86 assembly (clang, -O0):
<node_from_4byte>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
and    $0xffffff00,%ecx
shr    $0x8,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
and    $0x200,%eax
cmp    $0x0,%eax
setg   %al
and    $0x1,%al
movzbl %al,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
and    $0x100,%eax
cmp    $0x0,%eax
setg   %al
and    $0x1,%al
movzbl %al,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<node_from_4byte>:
movzbl %dil,%eax
mov    %eax,(%rsi)
mov    %edi,%eax
shr    $0x8,%eax
mov    %eax,(%rdx)
shr    $0x9,%edi
and    $0x1,%edi
mov    %edi,(%rcx)
and    $0x1,%eax
mov    %eax,(%r8)
ret

LLVM IR (-O0):
define void @node_from_4byte(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
%11 = load i32, i32* %6
%12 = and i32 255, %11
%13 = load i32*, i32** %7
store i32 %12, i32* %13
%14 = load i32, i32* %6
%15 = and i32 -256, %14
%16 = lshr i32 %15, 8
%17 = load i32*, i32** %8
store i32 %16, i32* %17
%18 = load i32, i32* %6
%19 = and i32 %18, 512
%20 = icmp sgt i32 %19, 0
%21 = zext i1 %20 to i32
%22 = load i32*, i32** %9
store i32 %21, i32* %22
%23 = load i32, i32* %6
%24 = and i32 %23, 256
%25 = icmp sgt i32 %24, 0
%26 = zext i1 %25 to i32
%27 = load i32*, i32** %10
store i32 %26, i32* %27
ret void
}

LLVM IR (-O2):
define void @node_from_4byte(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4) {
%6 = and i32 %0, 255
store i32 %6, i32* %1
%7 = lshr i32 %0, 8
store i32 %7, i32* %2
%8 = lshr i32 %0, 9
%9 = and i32 %8, 1
store i32 %9, i32* %3
%10 = and i32 %7, 1
store i32 %10, i32* %4
ret void
}
/* Variables and functions */
int bin_proc(int const *, int /*<<< orphan*/, int, int);
int bin_search(const int arr[], int length, int element) {
  if (length < 1) {
    return -1;
  }
  return bin_proc(arr, 0, length - 1, element);
}


x86 assembly (clang, -O0):
<bin_search>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpl   $0x1,-0x14(%rbp)
jge    1138 <bin_search+0x28>
movl   $0xffffffff,-0x4(%rbp)
jmp    114f <bin_search+0x3f>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
mov    -0x18(%rbp),%ecx
xor    %esi,%esi
call   1030 <bin_proc@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin_search>:
test   %esi,%esi
jle    1122 <bin_search+0x12>
mov    %edx,%ecx
mov    %esi,%edx
add    $0xffffffff,%edx
xor    %esi,%esi
jmp    1030 <bin_proc@plt>
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @bin_search(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, 1
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = add nsw i32 %1, -1
%7 = tail call i32 @bin_proc(i32* %0, i32 0, i32 %6, i32 %2)
br label %8
8: ; preds = %3, %5
%9 = phi i32 [ %7, %5 ], [ -1, %3 ]
ret i32 %9
}
/* Variables and functions */
int tolower(int);
int hex_to_i(int c) {
  c = tolower(c);
  if (c >= '0' && c <= '9') {
    return c - '0';
  } else if (c >= 'a' && c <= 'f') {
    return 10 + c - 'a';
  } else {
    return (-3);
  }
}


x86 assembly (clang, -O0):
<hex_to_i>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <tolower@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x30,-0x8(%rbp)
jl     1148 <hex_to_i+0x38>
cmpl   $0x39,-0x8(%rbp)
jg     1148 <hex_to_i+0x38>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <hex_to_i+0x64>
cmpl   $0x61,-0x8(%rbp)
jl     116d <hex_to_i+0x5d>
cmpl   $0x66,-0x8(%rbp)
jg     116d <hex_to_i+0x5d>
mov    -0x8(%rbp),%eax
add    $0xa,%eax
sub    $0x61,%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <hex_to_i+0x64>
movl   $0xfffffffd,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex_to_i>:
push   %rax
call   1030 <tolower@plt>
lea    -0x30(%rax),%ecx
lea    -0x61(%rax),%edx
add    $0xffffffa9,%eax
cmp    $0x6,%edx
mov    $0xfffffffd,%edx
cmovae %edx,%eax
cmp    $0xa,%ecx
cmovb  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @hex_to_i(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 @tolower(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 48
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i32, i32* %3
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 48
store i32 %13, i32* %2
br label %25
14: ; preds = %8, %1
%15 = load i32, i32* %3
%16 = icmp sge i32 %15, 97
br i1 %16, label %17, label %24
17: ; preds = %14
%18 = load i32, i32* %3
%19 = icmp sle i32 %18, 102
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = load i32, i32* %3
%22 = add nsw i32 10, %21
%23 = sub nsw i32 %22, 97
store i32 %23, i32* %2
br label %25
24: ; preds = %17, %14
store i32 -3, i32* %2
br label %25
25: ; preds = %24, %20, %11
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
define i32 @hex_to_i(i32 %0) {
%2 = tail call i32 @tolower(i32 %0)
%3 = add i32 %2, -48
%4 = icmp ult i32 %3, 10
%5 = add i32 %2, -97
%6 = icmp ult i32 %5, 6
%7 = add nsw i32 %2, -87
%8 = select i1 %6, i32 %7, i32 -3
%9 = select i1 %4, i32 %3, i32 %8
ret i32 %9
}
int fn7(int a, int b) {
  int tem1 = a | b;
  int tem2 = b & a;
  return tem1 + tem2;
}


x86 assembly (clang, -O0):
<fn7>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn7>:
lea    (%rdi,%rsi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @fn7(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
void a64_translate_init(void) {}


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

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

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

LLVM IR (-O2):
define void @a64_translate_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_wfd_gas_comeback_usage(void) {
  printf("\nUsage : wfd_gas_comeback_request/response [CONFIG_FILE]\n");
  printf("CONFIG_FILE contains WFD GAS comeback request/response payload.\n");
  return;
}


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

x86 assembly (clang, -O2):
<print_wfd_gas_comeback_usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf15(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [58 x i8] c"\0AUsage : wfd_gas_comeback_request/response [CONFIG_FILE]\0A\00"
@.str.1 = [65 x i8] c"CONFIG_FILE contains WFD GAS comeback request/response payload.\0A\00"
define void @print_wfd_gas_comeback_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [57 x i8] c"\0AUsage : wfd_gas_comeback_request/response [CONFIG_FILE]\00"
@str.2 = [64 x i8] c"CONFIG_FILE contains WFD GAS comeback request/response payload.\00"
define void @print_wfd_gas_comeback_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Decomment(char *, char *);
int GetText(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char input[4096];
  char text[4096];
  int len;
  while ((len = GetText(input, 4096)) > 0) {
    Decomment(input, text);
    printf("%s", text);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2020,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1010(%rbp),%rdi
mov    $0x1000,%esi
call   1050 <GetText@plt>
mov    %eax,-0x2014(%rbp)
cmp    $0x0,%eax
jle    118d <main+0x5d>
lea    -0x1010(%rbp),%rdi
lea    -0x2010(%rbp),%rsi
call   1030 <Decomment@plt>
lea    -0x2010(%rbp),%rsi
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x2020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x2000,%rsp
mov    %rsp,%rdi
mov    $0x1000,%esi
call   1050 <GetText@plt>
test   %eax,%eax
jle    1187 <main+0x57>
mov    %rsp,%r14
lea    0x1000(%rsp),%rbx
lea    0xea1(%rip),%r15
nop
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <Decomment@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x1000,%esi
call   1050 <GetText@plt>
test   %eax,%eax
jg     1160 <main+0x30>
xor    %eax,%eax
add    $0x2000,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [4096 x i8]
%2 = alloca [4096 x i8]
%3 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%5 = call i32 @GetText(i8* %3, i32 4096)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %0, %7
%8 = call i32 @Decomment(i8* %3, i8* %4)
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%10 = call i32 @GetText(i8* %3, i32 4096)
%11 = icmp sgt i32 %10, 0
br i1 %11, label %7, label %12
12: ; preds = %7, %0
ret i32 0
}
/* Variables and functions */
char *build_fn(char const *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ read_events(char *);
int /*<<< orphan*/ read_unit_masks(char *);
void load_events_name(const char *cpu_name) {
  char *event_file;
  char *um_file;
  event_file = build_fn(cpu_name, "events");
  um_file = build_fn(cpu_name, "unit_masks");
  read_unit_masks(um_file);
  read_events(event_file);
  free(um_file);
  free(event_file);
}


x86 assembly (clang, -O0):
<load_events_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1050 <build_fn@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe9c(%rip),%rsi
call   1050 <build_fn@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <read_unit_masks@plt>
mov    -0x10(%rbp),%rdi
call   1040 <read_events@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_events_name>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xeb2(%rip),%rsi
call   1050 <build_fn@plt>
mov    %rax,%r14
lea    0xeaa(%rip),%rsi
mov    %rbx,%rdi
call   1050 <build_fn@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <read_unit_masks@plt>
mov    %r14,%rdi
call   1040 <read_events@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"events\00"
@.str.1 = [11 x i8] c"unit_masks\00"
define void @load_events_name(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @build_fn(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %3
%7 = load i8*, i8** %2
%8 = call i8* @build_fn(i8* %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i8* %8, i8** %4
%9 = load i8*, i8** %4
%10 = call i32 @read_unit_masks(i8* %9)
%11 = load i8*, i8** %3
%12 = call i32 @read_events(i8* %11)
%13 = load i8*, i8** %4
%14 = call i32 @free(i8* %13)
%15 = load i8*, i8** %3
%16 = call i32 @free(i8* %15)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"events\00"
@.str.1 = [11 x i8] c"unit_masks\00"
define void @load_events_name(i8* %0) {
%2 = tail call i8* @build_fn(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = tail call i8* @build_fn(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @read_unit_masks(i8* %3)
%5 = tail call i32 @read_events(i8* %2)
%6 = tail call i32 @free(i8* %3)
%7 = tail call i32 @free(i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outbyte(int, int);
void init_serial() {
  outbyte(0x3f8 + 1, 0x00);
  outbyte(0x3f8 + 3, 0x80);
  outbyte(0x3f8 + 0, 0x03);
  outbyte(0x3f8 + 1, 0x00);
  outbyte(0x3f8 + 3, 0x03);
  outbyte(0x3f8 + 2, 0xC7);
  outbyte(0x3f8 + 4, 0x0B);
}


x86 assembly (clang, -O0):
<init_serial>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3f9,%edi
xor    %esi,%esi
call   1030 <outbyte@plt>
mov    $0x3fb,%edi
mov    $0x80,%esi
call   1030 <outbyte@plt>
mov    $0x3f8,%edi
mov    $0x3,%esi
call   1030 <outbyte@plt>
mov    $0x3f9,%edi
xor    %esi,%esi
call   1030 <outbyte@plt>
mov    $0x3fb,%edi
mov    $0x3,%esi
call   1030 <outbyte@plt>
mov    $0x3fa,%edi
mov    $0xc7,%esi
call   1030 <outbyte@plt>
mov    $0x3fc,%edi
mov    $0xb,%esi
call   1030 <outbyte@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_serial>:
push   %rax
mov    $0x3f9,%edi
xor    %esi,%esi
call   1030 <outbyte@plt>
mov    $0x3fb,%edi
mov    $0x80,%esi
call   1030 <outbyte@plt>
mov    $0x3f8,%edi
mov    $0x3,%esi
call   1030 <outbyte@plt>
mov    $0x3f9,%edi
xor    %esi,%esi
call   1030 <outbyte@plt>
mov    $0x3fb,%edi
mov    $0x3,%esi
call   1030 <outbyte@plt>
mov    $0x3fa,%edi
mov    $0xc7,%esi
call   1030 <outbyte@plt>
mov    $0x3fc,%edi
mov    $0xb,%esi
pop    %rax
jmp    1030 <outbyte@plt>

LLVM IR (-O0):
define void @init_serial() {
%1 = call i32 @outbyte(i32 1017, i32 0)
%2 = call i32 @outbyte(i32 1019, i32 128)
%3 = call i32 @outbyte(i32 1016, i32 3)
%4 = call i32 @outbyte(i32 1017, i32 0)
%5 = call i32 @outbyte(i32 1019, i32 3)
%6 = call i32 @outbyte(i32 1018, i32 199)
%7 = call i32 @outbyte(i32 1020, i32 11)
ret void
}

LLVM IR (-O2):
define void @init_serial() {
%1 = tail call i32 @outbyte(i32 1017, i32 0)
%2 = tail call i32 @outbyte(i32 1019, i32 128)
%3 = tail call i32 @outbyte(i32 1016, i32 3)
%4 = tail call i32 @outbyte(i32 1017, i32 0)
%5 = tail call i32 @outbyte(i32 1019, i32 3)
%6 = tail call i32 @outbyte(i32 1018, i32 199)
%7 = tail call i32 @outbyte(i32 1020, i32 11)
ret void
}
/* Variables and functions */
int factorial(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("%d\n", factorial(5));
  printf("%d\n", factorial(8));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%edi
call   1030 <factorial@plt>
mov    %eax,%esi
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
mov    $0x8,%edi
call   1030 <factorial@plt>
mov    %eax,%esi
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x5,%edi
call   1030 <factorial@plt>
lea    0xece(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x8,%edi
call   1030 <factorial@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @factorial(i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @factorial(i32 8)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
void reg_w(void *base, int reg, unsigned long val) {
  volatile unsigned short *regs = base;
  regs[reg] = val;
  regs[reg + 2] = val >> 16;
}


x86 assembly (clang, -O0):
<reg_w>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %ax,%dx
mov    -0x20(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dx,(%rax,%rcx,2)
mov    -0x18(%rbp),%rax
shr    $0x10,%rax
mov    %ax,%dx
mov    -0x20(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    %dx,(%rax,%rcx,2)
pop    %rbp
ret

x86 assembly (clang, -O2):
<reg_w>:
movslq %esi,%rax
mov    %dx,(%rdi,%rax,2)
shr    $0x10,%rdx
mov    %dx,0x4(%rdi,%rax,2)
ret

LLVM IR (-O0):
define void @reg_w(i8* %0, i32 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64
%7 = alloca i16*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i16*
store i16* %9, i16** %7
%10 = load i64, i64* %6
%11 = trunc i64 %10 to i16
%12 = load i16*, i16** %7
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i16, i16* %12, i64 %14
store volatile i16 %11, i16* %15
%16 = load i64, i64* %6
%17 = lshr i64 %16, 16
%18 = trunc i64 %17 to i16
%19 = load i16*, i16** %7
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 2
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i16, i16* %19, i64 %22
store volatile i16 %18, i16* %23
ret void
}

LLVM IR (-O2):
define void @reg_w(i8* %0, i32 %1, i64 %2) {
%4 = bitcast i8* %0 to i16*
%5 = trunc i64 %2 to i16
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i16, i16* %4, i64 %6
store volatile i16 %5, i16* %7
%8 = lshr i64 %2, 16
%9 = trunc i64 %8 to i16
%10 = add nsw i32 %1, 2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i16, i16* %4, i64 %11
store volatile i16 %9, i16* %12
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void print_row(char *s, int n) {
  int i;
  for (i = 0; i < n; ++i)
    putchar(s[i]);
  putchar('\n');
}


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

x86 assembly (clang, -O2):
<print_row>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1143 <print_row+0x33>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <print_row+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

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