xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef scalar_t__ uint32_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ write86(scalar_t__, int /*<<< orphan*/);
void writew86(uint32_t addr32, uint16_t value) {
  write86(addr32, (uint8_t)value);
  write86(addr32 + 1, (uint8_t)(value >> 8));
}


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

x86 assembly (clang, -O2):
<writew86>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <write86@plt>
add    $0x1,%rbx
sar    $0x8,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <write86@plt>

LLVM IR (-O0):
define void @writew86(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = load i32, i32* %4
%7 = call i32 @write86(i64 %5, i32 %6)
%8 = load i64, i64* %3
%9 = add nsw i64 %8, 1
%10 = load i32, i32* %4
%11 = ashr i32 %10, 8
%12 = call i32 @write86(i64 %9, i32 %11)
ret void
}

LLVM IR (-O2):
define void @writew86(i64 %0, i32 %1) {
%3 = tail call i32 @write86(i64 %0, i32 %1)
%4 = add nsw i64 %0, 1
%5 = ashr i32 %1, 8
%6 = tail call i32 @write86(i64 %4, i32 %5)
ret void
}
unsigned SetBlue(const unsigned int color, const unsigned int blue) {
  return ((color & 0xFFFFFF00) | (blue));
}


x86 assembly (clang, -O0):
<SetBlue>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffff00,%eax
or     -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetBlue>:
mov    %edi,%eax
and    $0xffffff00,%eax
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @SetBlue(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = and i32 %5, -256
%7 = load i32, i32* %4
%8 = or i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @SetBlue(i32 %0, i32 %1) {
%3 = and i32 %0, -256
%4 = or i32 %3, %1
ret i32 %4
}
/* Variables and functions */
float sqrt(float);
float g2(float xOld) {
  float xNew = 0;
  xNew = -sqrt(xOld + 6);
  return xNew;
}


x86 assembly (clang, -O0):
<g2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xed3(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
call   1030 <sqrt@plt>
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g2>:
push   %rax
addss  0xee7(%rip),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1127 <g2+0x17>
sqrtss %xmm0,%xmm0
jmp    112c <g2+0x1c>
call   1030 <sqrt@plt>
xorps  0xedd(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @g2(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
store float 0.000000e+00, float* %3
%4 = load float, float* %2
%5 = fadd float %4, 6.000000e+00
%6 = call float @sqrt(float %5)
%7 = fneg float %6
store float %7, float* %3
%8 = load float, float* %3
ret float %8
}

LLVM IR (-O2):
define float @g2(float %0) {
%2 = fadd float %0, 6.000000e+00
%3 = tail call float @sqrt(float %2)
%4 = fneg float %3
ret float %4
}
void ctl_dt_req_free(struct ctl_ha_dt_req *req) { return; }


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

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

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

LLVM IR (-O2):
%struct.ctl_ha_dt_req = type opaque
define void @ctl_dt_req_free(%struct.ctl_ha_dt_req* nocapture %0) {
ret void
}
int foo() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @foo() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void main() {
  struct node {
    int a;
    int b;
    int c;
  };
  struct node s = {3, 5, 6};
  struct node *pt = &s;
  printf("%d", *(int *)pt + 2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xedf(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
add    $0x2,%esi
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.node = type { i32, i32, i32 }
@__const.main.s = %struct.node { i32 3, i32 5, i32 6 }
@.str = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca %struct.node
%2 = alloca %struct.node*
%3 = bitcast %struct.node* %1 to i8*
store %struct.node* %1, %struct.node** %2
%4 = load %struct.node*, %struct.node** %2
%5 = bitcast %struct.node* %4 to i32*
%6 = load i32, i32* %5
%7 = add nsw i32 %6, 2
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
%struct.node = type { i32, i32, i32 }
@.str = [3 x i8] c"%d\00"
define void @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 5)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3_vfs;

/* Variables and functions */
int SQLITE_READONLY;
int memDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync) {
  return SQLITE_READONLY;
}


x86 assembly (clang, -O0):
<memDelete>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2ed2(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memDelete>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@SQLITE_READONLY = global i32 0
define i32 @memDelete(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* @SQLITE_READONLY
ret i32 %7
}

LLVM IR (-O2):
@SQLITE_READONLY = global i32 0
define i32 @memDelete(i32* nocapture readnone %0, i8* nocapture readnone %1, i32 %2) {
%4 = load i32, i32* @SQLITE_READONLY
ret i32 %4
}
void fd194(int n) {
P0A:
  goto P0A;
  {
    typedef int(*b)[n];
  P01A:
    goto P01A;
    {
      typedef int(*c)[n];
    P012A:
      goto P012A;
      0;
    }
  P01B:
    goto P01B;
    {
      typedef int(*d)[n];
    P013A:
      goto P013A;
      0;
    }
  P01C:
    goto P01C;
    ;
    typedef int(*e)[n];
  P014A:
    goto P014A;
    0;
  };
a : {
  typedef int(*f)[n];
P02A:
  goto P02A;
  {
    typedef int(*g)[n];
  P024A:
    goto P024A;
    0;
  };
P02B:
  goto P02B;
  {
    typedef int(*h)[n];
  p025A:
    goto p025A;
    goto a;
  P025A:
    goto P025A;
    0;
  };
P02C:
  goto P02C;
  ;
  typedef int(*i)[n];
P026A:
  goto P026A;
  0;
};
P0C:
  goto P0C;
  ;
  typedef int(*j)[n];
P03A:
  goto P03A;
  0;
P03B:
  goto P03B;
}


x86 assembly (clang, -O0):
<fd194>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    1107 <fd194+0x7>

x86 assembly (clang, -O2):
<fd194>:
jmp    1100 <fd194>

LLVM IR (-O0):
define void @fd194(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %3, %1
br label %3
4: ; No predecessors!
%5 = load i32, i32* %2
%6 = zext i32 %5 to i64
br label %7
7: ; preds = %7, %4
br label %7
8: ; No predecessors!
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
br label %11
11: ; preds = %11, %8
br label %11
12: ; preds = %12
br label %12
13: ; No predecessors!
%14 = load i32, i32* %2
%15 = zext i32 %14 to i64
br label %16
16: ; preds = %16, %13
br label %16
17: ; preds = %17
br label %17
18: ; No predecessors!
%19 = load i32, i32* %2
%20 = zext i32 %19 to i64
br label %21
21: ; preds = %21, %18
br label %21
22: ; No predecessors!
%23 = load i32, i32* %2
%24 = zext i32 %23 to i64
br label %25
25: ; preds = %25, %22
br label %25
26: ; No predecessors!
%27 = load i32, i32* %2
%28 = zext i32 %27 to i64
br label %29
29: ; preds = %29, %26
br label %29
30: ; preds = %30
br label %30
31: ; No predecessors!
%32 = load i32, i32* %2
%33 = zext i32 %32 to i64
br label %34
34: ; preds = %34, %31
br label %34
35: ; preds = %35
br label %35
36: ; preds = %36
br label %36
37: ; No predecessors!
%38 = load i32, i32* %2
%39 = zext i32 %38 to i64
br label %40
40: ; preds = %40, %37
br label %40
41: ; preds = %41
br label %41
42: ; No predecessors!
%43 = load i32, i32* %2
%44 = zext i32 %43 to i64
br label %45
45: ; preds = %45, %42
br label %45
46: ; preds = %46
br label %46
}

LLVM IR (-O2):
define void @fd194(i32 %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ ft_putchar(int);
void ft_putnbr(int num) {
  if (num >= 10) {
    ft_putnbr(num / 10);
    ft_putnbr(num % 10);
  } else {
    ft_putchar(num + '0');
  }
}


x86 assembly (clang, -O0):
<ft_putnbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jl     115e <ft_putnbr+0x3e>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <ft_putnbr@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1040 <ft_putnbr@plt>
jmp    1169 <ft_putnbr+0x49>
mov    -0x4(%rbp),%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
cmp    $0xa,%edi
jl     1147 <ft_putnbr+0x27>
mov    %ebp,%eax
mov    $0xcccccccd,%ebx
imul   %rax,%rbx
shr    $0x23,%rbx
mov    %ebx,%edi
call   1040 <ft_putnbr@plt>
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%eax
sub    %eax,%ebp
add    $0x30,%ebp
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <ft_putchar@plt>

LLVM IR (-O0):
define void @ft_putnbr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 10
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sdiv i32 %6, 10
%8 = load i32, i32* %2
%9 = srem i32 %8, 10
br label %14
10: ; preds = %1
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 48
%13 = call i32 @ft_putchar(i32 %12)
br label %14
14: ; preds = %10, %5
ret void
}

LLVM IR (-O2):
define void @ft_putnbr(i32 %0) {
%2 = icmp sgt i32 %0, 9
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = udiv i32 %0, 10
tail call void @ft_putnbr(i32 %4)
%5 = urem i32 %0, 10
br label %6
6: ; preds = %3, %1
%7 = phi i32 [ %0, %1 ], [ %5, %3 ]
%8 = add nsw i32 %7, 48
%9 = tail call i32 @ft_putchar(i32 %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *smb___new(size_t amt) {
  void *result = malloc(amt);
  if (!result) {
    fprintf(stderr, "smb_new: allocation error\n");
    exit(1);
  }
  return result;
}


x86 assembly (clang, -O0):
<smb___new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1173 <smb___new+0x43>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smb___new>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     113d <smb___new+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"smb_new: allocation error\0A\00"
define i8* @smb___new(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"smb_new: allocation error\0A\00"
define noalias i8* @smb___new(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ arm_arith_sub(int /*<<< orphan*/);
int /*<<< orphan*/ t16_data_imm8_op();
void t16_sub_imm8() { arm_arith_sub(t16_data_imm8_op()); }


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

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

LLVM IR (-O0):
define void @t16_sub_imm8() {
%1 = call i32 (...) @t16_data_imm8_op()
%2 = call i32 @arm_arith_sub(i32 %1)
ret void
}

LLVM IR (-O2):
define void @t16_sub_imm8() {
%1 = tail call i32 (...) @t16_data_imm8_op()
%2 = tail call i32 @arm_arith_sub(i32 %1)
ret void
}
void connectctx_init(struct connectctx *ctx) {}


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

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

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

LLVM IR (-O2):
%struct.connectctx = type opaque
define void @connectctx_init(%struct.connectctx* nocapture %0) {
ret void
}
/* Variables and functions */
scalar_t__ cut_beginning();
int /*<<< orphan*/ mf_write_midi_event(int, int, char *, int);
void copy_pitchbend(int chan, int c1, int c2) {
  char data[2];
  if (cut_beginning())
    return;
  data[0] = c1;
  data[1] = c2;
  mf_write_midi_event(0xe0, chan, data, 2);
}


x86 assembly (clang, -O0):
<copy_pitchbend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0x0,%al
call   1040 <cut_beginning@plt>
cmp    $0x0,%rax
je     1147 <copy_pitchbend+0x27>
jmp    1169 <copy_pitchbend+0x49>
mov    -0x8(%rbp),%eax
mov    %al,-0xe(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,-0xd(%rbp)
mov    -0x4(%rbp),%esi
lea    -0xe(%rbp),%rdx
mov    $0xe0,%edi
mov    $0x2,%ecx
call   1030 <mf_write_midi_event@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_pitchbend>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%ebp
mov    %esi,%ebx
mov    %edi,%r14d
xor    %eax,%eax
call   1040 <cut_beginning@plt>
test   %rax,%rax
jne    115b <copy_pitchbend+0x3b>
mov    %bl,0xe(%rsp)
mov    %bpl,0xf(%rsp)
lea    0xe(%rsp),%rdx
mov    $0xe0,%edi
mov    %r14d,%esi
mov    $0x2,%ecx
call   1030 <mf_write_midi_event@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @copy_pitchbend(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [2 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = call i64 (...) @cut_beginning()
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %3
br label %21
11: ; preds = %3
%12 = load i32, i32* %5
%13 = trunc i32 %12 to i8
%14 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
store i8 %13, i8* %14
%15 = load i32, i32* %6
%16 = trunc i32 %15 to i8
%17 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 1
store i8 %16, i8* %17
%18 = load i32, i32* %4
%19 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%20 = call i32 @mf_write_midi_event(i32 224, i32 %18, i8* %19, i32 2)
br label %21
21: ; preds = %11, %10
ret void
}

LLVM IR (-O2):
define void @copy_pitchbend(i32 %0, i32 %1, i32 %2) {
%4 = alloca [2 x i8]
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%6 = tail call i64 (...) @cut_beginning()
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = trunc i32 %1 to i8
store i8 %9, i8* %5
%10 = trunc i32 %2 to i8
%11 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 1
store i8 %10, i8* %11
%12 = call i32 @mf_write_midi_event(i32 224, i32 %0, i8* %5, i32 2)
br label %13
13: ; preds = %3, %8
ret void
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
size_t strlen(char const *);
char *strdup_self(const char *str) {
  size_t l = strlen(str);
  char *new_st = malloc(l + 1);
  memcpy(new_st, str, l + 1);
  return new_st;
}


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

x86 assembly (clang, -O2):
<strdup_self>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
lea    0x1(%rax),%r15
mov    %r15,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strdup_self(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = add i64 %7, 1
%9 = call i8* @malloc(i64 %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = load i8*, i8** %2
%12 = load i64, i64* %3
%13 = add i64 %12, 1
%14 = call i32 @memcpy(i8* %10, i8* %11, i64 %13)
%15 = load i8*, i8** %4
ret i8* %15
}

LLVM IR (-O2):
define i8* @strdup_self(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = tail call i32 @memcpy(i8* %4, i8* %0, i64 %3)
ret i8* %4
}
int string_nonempty(const char *str) { return str[0] == 0; }


x86 assembly (clang, -O0):
<string_nonempty>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_nonempty>:
xor    %eax,%eax
cmpb   $0x0,(%rdi)
sete   %al
ret

LLVM IR (-O0):
define i32 @string_nonempty(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @string_nonempty(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ sync();
void mysync() { (void)sync(); }


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

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

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

LLVM IR (-O2):
define void @mysync() {
%1 = tail call i32 (...) @sync()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void stampa_messaggi(unsigned int messaggio) {
  if (messaggio == 0) {
    printf("Inserire il numero di righe che compongono la matrice: ");
  } else if (messaggio == 1) {
    printf("Inserire il numero di colonne che compongono la matrice: ");
  }
  return;
}


x86 assembly (clang, -O0):
<stampa_messaggi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1136 <stampa_messaggi+0x26>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
jmp    1151 <stampa_messaggi+0x41>
cmpl   $0x1,-0x4(%rbp)
jne    114c <stampa_messaggi+0x3c>
lea    0xef1(%rip),%rdi
call   1030 <printf@plt>
jmp    1151 <stampa_messaggi+0x41>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stampa_messaggi>:
test   %edi,%edi
je     1125 <stampa_messaggi+0x15>
cmp    $0x1,%edi
jne    1131 <stampa_messaggi+0x21>
lea    0xf18(%rip),%rdi
jmp    1030 <printf@plt>
lea    0xed4(%rip),%rdi
jmp    1030 <printf@plt>
ret

LLVM IR (-O0):
@.str = [56 x i8] c"Inserire il numero di righe che compongono la matrice: \00"
@.str.1 = [58 x i8] c"Inserire il numero di colonne che compongono la matrice: \00"
define void @stampa_messaggi(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
br label %13
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
br label %13
13: ; preds = %12, %5
ret void
}

LLVM IR (-O2):
@.str = [56 x i8] c"Inserire il numero di righe che compongono la matrice: \00"
@.str.1 = [58 x i8] c"Inserire il numero di colonne che compongono la matrice: \00"
define void @stampa_messaggi(i32 %0) {
switch i32 %0, label %6 [
i32 0, label %3
i32 1, label %2
]
2: ; preds = %1
br label %3
3: ; preds = %1, %2
%4 = phi i8* [ getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), %1 ]
%5 = tail call i32 @printf(i8* dereferenceable(1) %4)
br label %6
6: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mkstemp(char *);
int /*<<< orphan*/ strcpy(char *, char const *);
void file_temporary_name(char buffer[]) {
  static char const pattern[] = "cuboid-XXXX.tmp";
  strcpy(buffer, pattern);
  mkstemp(buffer);
}


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

x86 assembly (clang, -O2):
<file_temporary_name>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <mkstemp@plt>

LLVM IR (-O0):
@file_temporary_name.pattern = internal constant [16 x i8] c"cuboid-XXXX.tmp\00"
define void @file_temporary_name(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @file_temporary_name.pattern, i64 0, i64 0))
%5 = load i8*, i8** %2
%6 = call i32 @mkstemp(i8* %5)
ret void
}

LLVM IR (-O2):
@file_temporary_name.pattern = internal constant [16 x i8] c"cuboid-XXXX.tmp\00"
define void @file_temporary_name(i8* %0) {
%2 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @file_temporary_name.pattern, i64 0, i64 0))
%3 = tail call i32 @mkstemp(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bictcp_register();
int /*<<< orphan*/ set_linux_file_name(char *);
void module_register(void) {
  bictcp_register();
  set_linux_file_name("tcp_bic.c");
}


x86 assembly (clang, -O0):
<module_register>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <bictcp_register@plt>
lea    0xece(%rip),%rdi
call   1040 <set_linux_file_name@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<module_register>:
push   %rax
xor    %eax,%eax
call   1030 <bictcp_register@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1040 <set_linux_file_name@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"tcp_bic.c\00"
define void @module_register() {
%1 = call i32 (...) @bictcp_register()
%2 = call i32 @set_linux_file_name(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"tcp_bic.c\00"
define void @module_register() {
%1 = tail call i32 (...) @bictcp_register()
%2 = tail call i32 @set_linux_file_name(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
double exp(int);
double bp_sw_EVDDistribution(float x, float mu, float lambda) {
  return (exp(-1. * exp(-1. * lambda * (x - mu))));
}


x86 assembly (clang, -O0):
<bp_sw_EVDDistribution>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xec8(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x4(%rbp),%xmm1
subss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xe9e(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <exp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bp_sw_EVDDistribution>:
push   %rax
cvtss2sd %xmm2,%xmm2
xorps  0xee4(%rip),%xmm2
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm2,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <exp@plt>
xorpd  0xec7(%rip),%xmm0
cvttsd2si %xmm0,%edi
pop    %rax
jmp    1030 <exp@plt>

LLVM IR (-O0):
define double @bp_sw_EVDDistribution(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %6
%8 = fpext float %7 to double
%9 = fmul double -1.000000e+00, %8
%10 = load float, float* %4
%11 = load float, float* %5
%12 = fsub float %10, %11
%13 = fpext float %12 to double
%14 = fmul double %9, %13
%15 = fptosi double %14 to i32
%16 = call double @exp(i32 %15)
%17 = fmul double -1.000000e+00, %16
%18 = fptosi double %17 to i32
%19 = call double @exp(i32 %18)
ret double %19
}

LLVM IR (-O2):
define double @bp_sw_EVDDistribution(float %0, float %1, float %2) {
%4 = fpext float %2 to double
%5 = fneg double %4
%6 = fsub float %0, %1
%7 = fpext float %6 to double
%8 = fmul double %5, %7
%9 = fptosi double %8 to i32
%10 = tail call double @exp(i32 %9)
%11 = fneg double %10
%12 = fptosi double %11 to i32
%13 = tail call double @exp(i32 %12)
ret double %13
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *prog) {
  fprintf(stderr,
          "%s -i <input_uimage_file> -o <output_file> [-l <padding bytes>]\n",
          prog);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [65 x i8] c"%s -i <input_uimage_file> -o <output_file> [-l <padding bytes>]\0A\00"
define void @usage(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 ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [65 x i8] c"%s -i <input_uimage_file> -o <output_file> [-l <padding bytes>]\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int tab[] = {1, 3, 7, 8, 9};
  int i;
  for (i = 4; i >= 0; i--)
    printf("tab[%d]=%d\n", i, tab[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed5(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x4,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jl     1174 <main+0x64>
mov    -0x24(%rbp),%esi
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edx
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1145 <main+0x35>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x9,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x8,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x7,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"tab[%d]=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 4, i32 9)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 3, i32 8)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 2, i32 7)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 1, i32 3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 0, i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ LOG_DAEMON;
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ LOG_MAKEPRI(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, char const *);
void error(const char *message, int terminate) {
  syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), "%s", message);
  if (terminate) {
    exit(errno);
  }
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
mov    0x2e79(%rip),%rax
mov    (%rax),%esi
call   1030 <LOG_MAKEPRI@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rdx
lea    0xe9d(%rip),%rsi
call   1040 <syslog@plt>
cmpl   $0x0,-0xc(%rbp)
je     1180 <error+0x50>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    0x2e80(%rip),%rax
mov    (%rax),%esi
call   1030 <LOG_MAKEPRI@plt>
lea    0xeaa(%rip),%rsi
mov    %eax,%edi
mov    %rbx,%rdx
call   1040 <syslog@plt>
test   %ebp,%ebp
jne    116b <error+0x3b>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@LOG_DAEMON = global i32 0
@LOG_ERR = global i32 0
@.str = [3 x i8] c"%s\00"
@errno = global i32 0
define void @error(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @LOG_DAEMON
%6 = load i32, i32* @LOG_ERR
%7 = call i32 @LOG_MAKEPRI(i32 %5, i32 %6)
%8 = load i8*, i8** %3
%9 = call i32 @syslog(i32 %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* @errno
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %2
ret void
}

LLVM IR (-O2):
@LOG_DAEMON = global i32 0
@LOG_ERR = global i32 0
@.str = [3 x i8] c"%s\00"
@errno = global i32 0
define void @error(i8* %0, i32 %1) {
%3 = load i32, i32* @LOG_DAEMON
%4 = load i32, i32* @LOG_ERR
%5 = tail call i32 @LOG_MAKEPRI(i32 %3, i32 %4)
%6 = tail call i32 @syslog(i32 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%7 = icmp eq i32 %1, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* @errno
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %2
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t fastrand() {
  uint32_t g_seed = 1234;
  g_seed = 214013 * g_seed + 2531011;
  return g_seed;
}


x86 assembly (clang, -O0):
<fastrand>:
push   %rbp
mov    %rsp,%rbp
movl   $0x4d2,-0x4(%rbp)
imul   $0x343fd,-0x4(%rbp),%eax
add    $0x269ec3,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fastrand() {
%1 = alloca i32
store i32 1234, i32* %1
%2 = load i32, i32* %1
%3 = mul nsw i32 214013, %2
%4 = add nsw i32 %3, 2531011
store i32 %4, i32* %1
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
define i32 @fastrand() {
ret i32 266623053
}
int main(void) {
  int var = 10;
  int *ptr = &var;
  printf("變數 var 的位址：%X\\n", &var);
  printf("指標 ptr 指向的位址：%X\\n", ptr);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0xa,0xc(%rsp)
lea    0xedc(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"\E8\AE\8A\E6\95\B8 var \E7\9A\84\E4\BD\8D\E5\9D\80\EF\BC\9A%X\\n\00"
@.str.1 = [34 x i8] c"\E6\8C\87\E6\A8\99 ptr \E6\8C\87\E5\90\91\E7\9A\84\E4\BD\8D\E5\9D\80\EF\BC\9A%X\\n\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
store i32 10, i32* %2
store i32* %2, i32** %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32*, i32** %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"\E8\AE\8A\E6\95\B8 var \E7\9A\84\E4\BD\8D\E5\9D\80\EF\BC\9A%X\\n\00"
@.str.1 = [34 x i8] c"\E6\8C\87\E6\A8\99 ptr \E6\8C\87\E5\90\91\E7\9A\84\E4\BD\8D\E5\9D\80\EF\BC\9A%X\\n\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 10, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32* %1)
ret i32 0
}
/* Variables and functions */
void backend_span_domain(int nos_threads, size_t stack_size) {}


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

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

LLVM IR (-O0):
define void @backend_span_domain(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
ret void
}

LLVM IR (-O2):
define void @backend_span_domain(i32 %0, i64 %1) {
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void put_be32_ptr(uint8_t *p, uint32_t v) {
  p[3] = (v & 0xFF);
  p[2] = (v >> 8) & 0xFF;
  p[1] = (v >> 16) & 0xFF;
  p[0] = (v >> 24) & 0xFF;
}


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

x86 assembly (clang, -O2):
<put_be32_ptr>:
mov    %esi,%eax
movzbl %al,%ecx
mov    %ecx,0xc(%rdi)
movzbl %ah,%ecx
mov    %ecx,0x8(%rdi)
mov    %esi,%ecx
shr    $0x10,%ecx
movzbl %cl,%ecx
mov    %ecx,0x4(%rdi)
shr    $0x18,%eax
mov    %eax,(%rdi)
ret

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

LLVM IR (-O2):
define void @put_be32_ptr(i32* nocapture writeonly %0, i32 %1) {
%3 = and i32 %1, 255
%4 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %3, i32* %4
%5 = lshr i32 %1, 8
%6 = and i32 %5, 255
%7 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %6, i32* %7
%8 = lshr i32 %1, 16
%9 = and i32 %8, 255
%10 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %9, i32* %10
%11 = lshr i32 %1, 24
store i32 %11, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set_variable(char *, char *);
char *strtok(char *, char *);
void exprEval(char *ex) {
  char *res[2];
  char *arra = strtok(ex, "=");
  res[0] = arra;
  arra = strtok(NULL, "=");
  res[1] = arra;
  set_variable(res[0], res[1]);
}


x86 assembly (clang, -O0):
<exprEval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xead(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <set_variable@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exprEval>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%r14
mov    %r14,%rsi
call   1040 <strtok@plt>
mov    %rax,%rbx
xor    %edi,%edi
mov    %r14,%rsi
call   1040 <strtok@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <set_variable@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"=\00"
define void @exprEval(i8* %0) {
%2 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @set_variable(i8* %2, i8* %3)
ret void
}
double round(double x) {
  int temp;
  if (x >= 0) {
    temp = x * 1000 + 0.5;
    return 1.0 * temp / 1000;
  } else {
    temp = x * 1000 - 0.5;
    return 1.0 * temp / 1000;
  }
}


x86 assembly (clang, -O0):
<round>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1166 <round+0x66>
movsd  -0x10(%rbp),%xmm0
movsd  0xed8(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee4(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xebc(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xea8(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11ac <round+0xac>
movsd  -0x10(%rbp),%xmm0
movsd  0xe8d(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe91(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xe71(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe5d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<round>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
setb   %al
movsd  0xeeb(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xee8(%rip),%rcx
addsd  (%rcx,%rax,8),%xmm0
cvttpd2dq %xmm0,%xmm0
cvtdq2pd %xmm0,%xmm0
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @round(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
%5 = load double, double* %3
%6 = fcmp oge double %5, 0.000000e+00
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load double, double* %3
%9 = call double @llvm.fmuladd.f64(double %8, double 1.000000e+03, double 5.000000e-01)
%10 = fptosi double %9 to i32
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = sitofp i32 %11 to double
%13 = fmul double 1.000000e+00, %12
%14 = fdiv double %13, 1.000000e+03
store double %14, double* %2
br label %23
15: ; preds = %1
%16 = load double, double* %3
%17 = call double @llvm.fmuladd.f64(double %16, double 1.000000e+03, double -5.000000e-01)
%18 = fptosi double %17 to i32
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = sitofp i32 %19 to double
%21 = fmul double 1.000000e+00, %20
%22 = fdiv double %21, 1.000000e+03
store double %22, double* %2
br label %23
23: ; preds = %15, %7
%24 = load double, double* %2
ret double %24
}

LLVM IR (-O2):
define double @round(double %0) {
%2 = fcmp ult double %0, 0.000000e+00
%3 = tail call double @llvm.fmuladd.f64(double %0, double 1.000000e+03, double 5.000000e-01)
%4 = tail call double @llvm.fmuladd.f64(double %0, double 1.000000e+03, double -5.000000e-01)
%5 = select i1 %2, double %4, double %3
%6 = fptosi double %5 to i32
%7 = sitofp i32 %6 to double
%8 = fdiv double %7, 1.000000e+03
ret double %8
}
void __attribute__((weak)) _irq() {
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<_irq>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <_irq+0x9>
jmp    1109 <_irq+0x9>

x86 assembly (clang, -O2):
<_irq>:
jmp    1100 <_irq>

LLVM IR (-O0):
define weak void @_irq() {
br label %1
1: ; preds = %1, %0
br label %1
}

LLVM IR (-O2):
define weak void @_irq() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Type definitions */
struct BX_Iter {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct BX_Iter *);
void BX_Iter_Del(struct BX_Iter *it) { free(it); }


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

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

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

LLVM IR (-O2):
%struct.BX_Iter = type { i32 }
define void @BX_Iter_Del(%struct.BX_Iter* nocapture %0) {
%2 = tail call i32 @free(%struct.BX_Iter* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ islower(int);
void t_islower_0x62() {
  Assert_real((islower(98)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_islower.c",
              495, ("islower should be 1 for b"));
}


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

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

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_islower.c\00"
@.str.1 = [26 x i8] c"islower should be 1 for b\00"
define void @t_islower_0x62() {
%1 = call i32 @islower(i32 98)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 495, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_islower.c\00"
@.str.1 = [26 x i8] c"islower should be 1 for b\00"
define void @t_islower_0x62() {
%1 = tail call i32 @islower(i32 98)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 495, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void PS_NullLinkCheck(void) {}


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

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

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

LLVM IR (-O2):
define void @PS_NullLinkCheck() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void MPPETermInput(void *v) { free(v); }


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

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

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

LLVM IR (-O2):
define void @MPPETermInput(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}