xunge/DecIR huggingface dataset:
/* Type definitions */
struct timespec {
  int dummy;
};
typedef int /*<<< orphan*/ clockid_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int clock_gettime(clockid_t clock_id, struct timespec *tp) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<clock_gettime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.timespec = type { i32 }
@ENOSYS = global i32 0
define i32 @clock_gettime(i32 %0, %struct.timespec* %1) {
%3 = alloca i32
%4 = alloca %struct.timespec*
store i32 %0, i32* %3
store %struct.timespec* %1, %struct.timespec** %4
%5 = load i32, i32* @ENOSYS
%6 = call i32 @__set_errno(i32 %5)
ret i32 -1
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@ENOSYS = global i32 0
define i32 @clock_gettime(i32 %0, %struct.timespec* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
%4 = tail call i32 @__set_errno(i32 %3)
ret i32 -1
}
/* Variables and functions */
int Float2Int(float);
int CellFromCoord(int cellwidth, float f) {
  if (f < 0.0f) {
    return Float2Int(f + (16384)) / cellwidth;
  } else {
    return Float2Int(f) / cellwidth + ((16384) / cellwidth);
  }
}


x86 assembly (clang, -O0):
<CellFromCoord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    114b <CellFromCoord+0x3b>
movss  0xecb(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
call   1030 <Float2Int@plt>
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x4(%rbp)
jmp    116f <CellFromCoord+0x5f>
movss  -0xc(%rbp),%xmm0
call   1030 <Float2Int@plt>
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x10(%rbp)
mov    $0x4000,%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CellFromCoord>:
push   %rbx
mov    %edi,%ebx
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jbe    112d <CellFromCoord+0x1d>
addss  0xedd(%rip),%xmm0
call   1030 <Float2Int@plt>
cltd
idiv   %ebx
pop    %rbx
ret
call   1030 <Float2Int@plt>
cltd
idiv   %ebx
mov    %eax,%ecx
mov    $0x4000,%eax
xor    %edx,%edx
idiv   %ebx
add    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @CellFromCoord(i32 %0, float %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
store i32 %0, i32* %4
store float %1, float* %5
%6 = load float, float* %5
%7 = fcmp olt float %6, 0.000000e+00
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load float, float* %5
%10 = fadd float %9, 1.638400e+04
%11 = call i32 @Float2Int(float %10)
%12 = load i32, i32* %4
%13 = sdiv i32 %11, %12
store i32 %13, i32* %3
br label %22
14: ; preds = %2
%15 = load float, float* %5
%16 = call i32 @Float2Int(float %15)
%17 = load i32, i32* %4
%18 = sdiv i32 %16, %17
%19 = load i32, i32* %4
%20 = sdiv i32 16384, %19
%21 = add nsw i32 %18, %20
store i32 %21, i32* %3
br label %22
22: ; preds = %14, %8
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @CellFromCoord(i32 %0, float %1) {
%3 = fcmp olt float %1, 0.000000e+00
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = fadd float %1, 1.638400e+04
%6 = tail call i32 @Float2Int(float %5)
%7 = sdiv i32 %6, %0
br label %13
8: ; preds = %2
%9 = tail call i32 @Float2Int(float %1)
%10 = sdiv i32 %9, %0
%11 = sdiv i32 16384, %0
%12 = add nsw i32 %11, %10
br label %13
13: ; preds = %8, %4
%14 = phi i32 [ %7, %4 ], [ %12, %8 ]
ret i32 %14
}
int test_imm_72int16_mem(short *val) {
  return ((*val) & (-0x72 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_72int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -114
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int max_height;
};
typedef TYPE_1__ XSizeHints;

/* Variables and functions */
void set_XSizeHints_max_height(void *_p, int _v) {
  ((XSizeHints *)_p)->max_height = (int)_v;
}


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

x86 assembly (clang, -O2):
<set_XSizeHints_max_height>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XSizeHints_max_height(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XSizeHints_max_height(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
unsigned long sys_brk(unsigned long addr) {
  unsigned long ret;
  __asm__ __volatile__("int $0x80"
                       : "=a"(ret)
                       : "0"((long)0x2d), "b"((long)addr));
  return ret;
}


x86 assembly (clang, -O0):
<sys_brk>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rbx
mov    $0x2d,%eax
int    $0x80
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_brk>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2d,%eax
int    $0x80
pop    %rbx
ret

LLVM IR (-O0):
define i64 @sys_brk(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i64 asm sideeffect "int $$0x80", "={ax},0,{bx},~{dirflag},~{fpsr},~{flags}"(i64 45, i64 %4)
store i64 %5, i64* %3
%6 = load i64, i64* %3
ret i64 %6
}

LLVM IR (-O2):
define i64 @sys_brk(i64 %0) {
%2 = tail call i64 asm sideeffect "int $$0x80", "={ax},0,{bx},~{dirflag},~{fpsr},~{flags}"(i64 45, i64 %0)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main() { printf("Stack!\n"); }


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

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

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

LLVM IR (-O2):
@str = [7 x i8] c"Stack!\00"
define void @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret void
}
int hasWhiteSpaceToEnd(char *s, int n) {
  s += n;
  while (*s != '\0') {
    if (*s > ' ') {
      return 0;
    }
    s++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<hasWhiteSpaceToEnd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1159 <hasWhiteSpaceToEnd+0x59>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jle    1148 <hasWhiteSpaceToEnd+0x48>
movl   $0x0,-0x4(%rbp)
jmp    1160 <hasWhiteSpaceToEnd+0x60>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <hasWhiteSpaceToEnd+0x1c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hasWhiteSpaceToEnd>:
movslq %esi,%rdx
mov    (%rdi,%rdx,1),%cl
mov    $0x1,%eax
test   %cl,%cl
je     1130 <hasWhiteSpaceToEnd+0x30>
add    %rdi,%rdx
add    $0x1,%rdx
cs nopw 0x0(%rax,%rax,1)
cmp    $0x21,%cl
jge    1131 <hasWhiteSpaceToEnd+0x31>
movzbl (%rdx),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1120 <hasWhiteSpaceToEnd+0x20>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @hasWhiteSpaceToEnd(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = load i8*, i8** %4
%8 = sext i32 %6 to i64
%9 = getelementptr inbounds i8, i8* %7, i64 %8
store i8* %9, i8** %4
br label %10
10: ; preds = %21, %2
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %24
15: ; preds = %10
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp sgt i32 %18, 32
br i1 %19, label %20, label %21
20: ; preds = %15
store i32 0, i32* %3
br label %25
21: ; preds = %15
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %4
br label %10
24: ; preds = %10
store i32 1, i32* %3
br label %25
25: ; preds = %24, %20
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @hasWhiteSpaceToEnd(i8* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %15, label %10
7: ; preds = %10
%8 = load i8, i8* %14
%9 = icmp eq i8 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %2, %7
%11 = phi i8 [ %8, %7 ], [ %5, %2 ]
%12 = phi i8* [ %14, %7 ], [ %4, %2 ]
%13 = icmp sgt i8 %11, 32
%14 = getelementptr inbounds i8, i8* %12, i64 1
br i1 %13, label %15, label %7
15: ; preds = %10, %7, %2
%16 = phi i32 [ 1, %2 ], [ 1, %7 ], [ 0, %10 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ UpnpResponse_MediaRenderer_RenderingControl_GetVolume(void *,
                                                                         int);
int /*<<< orphan*/ printf(char *, unsigned int, char *);
void UpnpMediaRenderer_RenderingControl_GetVolume(void *upnptoken,
                                                  unsigned int InstanceID,
                                                  char *Channel) {
  printf("Invoke: UpnpMediaRenderer_RenderingControl_GetVolume(%u,%s);\r\n",
         InstanceID, Channel);
  UpnpResponse_MediaRenderer_RenderingControl_GetVolume(upnptoken, 250);
}


x86 assembly (clang, -O0):
<UpnpMediaRenderer_RenderingControl_GetVolume>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0xfa,%esi
call   1040 <UpnpResponse_MediaRenderer_RenderingControl_GetVolume@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UpnpMediaRenderer_RenderingControl_GetVolume>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xfa,%esi
pop    %rbx
jmp    1040 <UpnpResponse_MediaRenderer_RenderingControl_GetVolume@plt>

LLVM IR (-O0):
@.str = [63 x i8] c"Invoke: UpnpMediaRenderer_RenderingControl_GetVolume(%u,%s);\0D\0A\00"
define void @UpnpMediaRenderer_RenderingControl_GetVolume(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %5
%8 = load i8*, i8** %6
%9 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %8)
%10 = load i8*, i8** %4
%11 = call i32 @UpnpResponse_MediaRenderer_RenderingControl_GetVolume(i8* %10, i32 250)
ret void
}

LLVM IR (-O2):
@.str = [63 x i8] c"Invoke: UpnpMediaRenderer_RenderingControl_GetVolume(%u,%s);\0D\0A\00"
define void @UpnpMediaRenderer_RenderingControl_GetVolume(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %2)
%5 = tail call i32 @UpnpResponse_MediaRenderer_RenderingControl_GetVolume(i8* %0, i32 250)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ little_endian_read_16(int /*<<< orphan*/ const *, int);
uint16_t bnep_event_can_send_now_get_destination_uuid(const uint8_t *event) {
  return little_endian_read_16(event, 6);
}


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

x86 assembly (clang, -O2):
<bnep_event_can_send_now_get_destination_uuid>:
mov    $0x6,%esi
jmp    1030 <little_endian_read_16@plt>

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

LLVM IR (-O2):
define i32 @bnep_event_can_send_now_get_destination_uuid(i32* %0) {
%2 = tail call i32 @little_endian_read_16(i32* %0, i32 6)
ret i32 %2
}
void flush_i_cache() {}


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

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

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

LLVM IR (-O2):
define void @flush_i_cache() {
ret void
}
void dummy(double *a, double *b, double *c, double *d) {}


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

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

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

LLVM IR (-O2):
define void @dummy(double* nocapture %0, double* nocapture %1, double* nocapture %2, double* nocapture %3) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ hwaddr_str(char *, char *, size_t);
int hwaddr_str_len(size_t);
char *malloc(int);
char *a_hwaddr_str(char *hwaddr, size_t len) {
  char *str;
  str = malloc(sizeof(char) * hwaddr_str_len(len));
  if (!str)
    return NULL;
  hwaddr_str(str, hwaddr, len);
  return str;
}


x86 assembly (clang, -O0):
<a_hwaddr_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <hwaddr_str_len@plt>
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1172 <a_hwaddr_str+0x42>
movq   $0x0,-0x8(%rbp)
jmp    118b <a_hwaddr_str+0x5b>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <hwaddr_str@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_hwaddr_str>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <hwaddr_str_len@plt>
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1160 <a_hwaddr_str+0x30>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <hwaddr_str@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @a_hwaddr_str(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
%7 = load i64, i64* %5
%8 = call i32 @hwaddr_str_len(i64 %7)
%9 = sext i32 %8 to i64
%10 = mul i64 1, %9
%11 = trunc i64 %10 to i32
%12 = call i8* @malloc(i32 %11)
store i8* %12, i8** %6
%13 = load i8*, i8** %6
%14 = icmp ne i8* %13, null
br i1 %14, label %16, label %15
15: ; preds = %2
store i8* null, i8** %3
br label %22
16: ; preds = %2
%17 = load i8*, i8** %6
%18 = load i8*, i8** %4
%19 = load i64, i64* %5
%20 = call i32 @hwaddr_str(i8* %17, i8* %18, i64 %19)
%21 = load i8*, i8** %6
store i8* %21, i8** %3
br label %22
22: ; preds = %16, %15
%23 = load i8*, i8** %3
ret i8* %23
}

LLVM IR (-O2):
define i8* @a_hwaddr_str(i8* %0, i64 %1) {
%3 = tail call i32 @hwaddr_str_len(i64 %1)
%4 = tail call i8* @malloc(i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @hwaddr_str(i8* %4, i8* %0, i64 %1)
br label %8
8: ; preds = %2, %6
ret i8* %4
}
int repeatedLeftShift(int x, int count) {
  while (count-- > 0) {
    x <<= 1;
  }
  return x;
}


x86 assembly (clang, -O0):
<repeatedLeftShift>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    112c <repeatedLeftShift+0x2c>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110a <repeatedLeftShift+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<repeatedLeftShift>:
mov    %edi,%eax
test   %esi,%esi
jle    114b <repeatedLeftShift+0x4b>
lea    -0x1(%rsi),%ecx
mov    %esi,%edx
and    $0x7,%edx
je     112b <repeatedLeftShift+0x2b>
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    %eax,%eax
add    $0x1,%edi
cmp    %edi,%edx
jne    1120 <repeatedLeftShift+0x20>
sub    %edi,%esi
cmp    $0x7,%ecx
jb     114b <repeatedLeftShift+0x4b>
add    $0xffffffff,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
shl    $0x8,%eax
add    $0xfffffff8,%esi
cmp    $0xfffffffe,%esi
jb     1140 <repeatedLeftShift+0x40>
ret

LLVM IR (-O0):
define i32 @repeatedLeftShift(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
br label %5
5: ; preds = %9, %2
%6 = load i32, i32* %4
%7 = add nsw i32 %6, -1
store i32 %7, i32* %4
%8 = icmp sgt i32 %6, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i32, i32* %3
%11 = shl i32 %10, 1
store i32 %11, i32* %3
br label %5
12: ; preds = %5
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @repeatedLeftShift(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %28
4: ; preds = %2
%5 = add i32 %1, -1
%6 = and i32 %1, 7
%7 = icmp eq i32 %6, 0
br i1 %7, label %16, label %8
8: ; preds = %4, %8
%9 = phi i32 [ %12, %8 ], [ %1, %4 ]
%10 = phi i32 [ %13, %8 ], [ %0, %4 ]
%11 = phi i32 [ %14, %8 ], [ 0, %4 ]
%12 = add nsw i32 %9, -1
%13 = shl i32 %10, 1
%14 = add i32 %11, 1
%15 = icmp eq i32 %14, %6
br i1 %15, label %16, label %8
16: ; preds = %8, %4
%17 = phi i32 [ %1, %4 ], [ %12, %8 ]
%18 = phi i32 [ %0, %4 ], [ %13, %8 ]
%19 = phi i32 [ undef, %4 ], [ %13, %8 ]
%20 = icmp ult i32 %5, 7
br i1 %20, label %28, label %21
21: ; preds = %16, %21
%22 = phi i32 [ %25, %21 ], [ %17, %16 ]
%23 = phi i32 [ %24, %21 ], [ %18, %16 ]
%24 = shl i32 %23, 8
%25 = add nsw i32 %22, -8
%26 = add i32 %22, -9
%27 = icmp ult i32 %26, -2
br i1 %27, label %21, label %28
28: ; preds = %16, %21, %2
%29 = phi i32 [ %0, %2 ], [ %19, %16 ], [ %24, %21 ]
ret i32 %29
}
/* Variables and functions */
int llib_str_cmp(char *, char *);
int zcmp(void *pa, void *pb) { return llib_str_cmp((char *)pa, (char *)pb); }


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

x86 assembly (clang, -O2):
<zcmp>:
jmp    1030 <llib_str_cmp@plt>

LLVM IR (-O0):
define i32 @zcmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @llib_str_cmp(i8* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @zcmp(i8* %0, i8* %1) {
%3 = tail call i32 @llib_str_cmp(i8* %0, i8* %1)
ret i32 %3
}
void __attribute__((weak)) usart6_isr() { debug_handler(__FUNCTION__); }


x86 assembly (clang, -O0):
<usart6_isr>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <debug_handler@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usart6_isr>:
lea    0xee9(%rip),%rdi
xor    %eax,%eax
jmp    1030 <debug_handler@plt>

LLVM IR (-O0):
@__FUNCTION__.usart6_isr = [11 x i8] c"usart6_isr\00"
define weak void @usart6_isr() {
%1 = call i32 (i8*, ...) bitcast (i32 (...)* @debug_handler to i32 (i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__FUNCTION__.usart6_isr, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__FUNCTION__.usart6_isr = [11 x i8] c"usart6_isr\00"
define weak void @usart6_isr() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @debug_handler to i32 (i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__FUNCTION__.usart6_isr, i64 0, i64 0))
ret void
}
/* Variables and functions */
double exp(double);
double elg(double x) {
  double elg_x;
  elg_x = 1.0 / (1.0 + exp(x));
  return elg_x;
}


x86 assembly (clang, -O0):
<elg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movsd  0xed1(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xec5(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<elg>:
push   %rax
call   1030 <exp@plt>
movsd  0xee2(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @elg(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call double @exp(double %4)
%6 = fadd double 1.000000e+00, %5
%7 = fdiv double 1.000000e+00, %6
store double %7, double* %3
%8 = load double, double* %3
ret double %8
}

LLVM IR (-O2):
define double @elg(double %0) {
%2 = tail call double @exp(double %0)
%3 = fadd double %2, 1.000000e+00
%4 = fdiv double 1.000000e+00, %3
ret double %4
}
/* Variables and functions */
int read_real(double *, char const *);
int option_read_real(void *out, const char *in) {
  double *out_real = out;
  return read_real(out_real, in);
}


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

x86 assembly (clang, -O2):
<option_read_real>:
jmp    1030 <read_real@plt>

LLVM IR (-O0):
define i32 @option_read_real(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca double*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to double*
store double* %7, double** %5
%8 = load double*, double** %5
%9 = load i8*, i8** %4
%10 = call i32 @read_real(double* %8, i8* %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @option_read_real(i8* %0, i8* %1) {
%3 = bitcast i8* %0 to double*
%4 = tail call i32 @read_real(double* %3, i8* %1)
ret i32 %4
}
/* Variables and functions */
unsigned long long rdmsr(int);
bool cpu_isbsp(void) { return (rdmsr(0x1b) & (1ULL << 8)) != 0; }


x86 assembly (clang, -O0):
<cpu_isbsp>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1b,%edi
call   1030 <rdmsr@plt>
and    $0x100,%rax
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_isbsp>:
push   %rax
mov    $0x1b,%edi
call   1030 <rdmsr@plt>
shr    $0x8,%eax
and    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @cpu_isbsp() {
%1 = call i64 @rdmsr(i32 27)
%2 = and i64 %1, 256
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @cpu_isbsp() {
%1 = tail call i64 @rdmsr(i32 27)
%2 = trunc i64 %1 to i32
%3 = lshr i32 %2, 8
%4 = and i32 %3, 1
ret i32 %4
}
/* Variables and functions */
double erfinv(int);
double frand();
double sqrt(double);
double normrand(double mu, double sigma) {
  double u = frand();
  return mu + sigma * sqrt(2.0) * erfinv(2 * u - 1);
}


x86 assembly (clang, -O0):
<normrand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    $0x0,%al
call   1040 <frand@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe9e(%rip),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xe6f(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <erfinv@plt>
movsd  -0x28(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normrand>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1040 <frand@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0xebb(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
addsd  %xmm0,%xmm0
addsd  0xeb1(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <erfinv@plt>
mulsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @normrand(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = call double (...) @frand()
store double %6, double* %5
%7 = load double, double* %3
%8 = load double, double* %4
%9 = call double @sqrt(double 2.000000e+00)
%10 = fmul double %8, %9
%11 = load double, double* %5
%12 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %11, double -1.000000e+00)
%13 = fptosi double %12 to i32
%14 = call double @erfinv(i32 %13)
%15 = call double @llvm.fmuladd.f64(double %10, double %14, double %7)
ret double %15
}

LLVM IR (-O2):
define double @normrand(double %0, double %1) {
%3 = tail call double (...) @frand()
%4 = fmul double %1, 0x3FF6A09E667F3BCD
%5 = tail call double @llvm.fmuladd.f64(double %3, double 2.000000e+00, double -1.000000e+00)
%6 = fptosi double %5 to i32
%7 = tail call double @erfinv(i32 %6)
%8 = tail call double @llvm.fmuladd.f64(double %4, double %7, double %0)
ret double %8
}
/* Type definitions */
struct utsname {
  int dummy;
};

/* Variables and functions */
int syscall(int, struct utsname *);
int uname(struct utsname *uts) { return syscall(122, uts); }


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

x86 assembly (clang, -O2):
<uname>:
mov    %rdi,%rsi
mov    $0x7a,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.utsname = type { i32 }
define i32 @uname(%struct.utsname* %0) {
%2 = alloca %struct.utsname*
store %struct.utsname* %0, %struct.utsname** %2
%3 = load %struct.utsname*, %struct.utsname** %2
%4 = call i32 @syscall(i32 122, %struct.utsname* %3)
ret i32 %4
}

LLVM IR (-O2):
%struct.utsname = type { i32 }
define i32 @uname(%struct.utsname* %0) {
%2 = tail call i32 @syscall(i32 122, %struct.utsname* %0)
ret i32 %2
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ memcpy(void *, void *, size_t);
void *stb_copy(void *p, size_t sz) {
  void *q = malloc(sz);
  memcpy(q, p, sz);
  return q;
}


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

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

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

LLVM IR (-O2):
define i8* @stb_copy(i8* %0, i64 %1) {
%3 = tail call i8* @malloc(i64 %1)
%4 = tail call i32 @memcpy(i8* %3, i8* %0, i64 %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, int);
void pic_init(void) {
  outb(0x20, 0x11);
  outb(0xA0, 0x11);
  outb(0x21, 0x20);
  outb(0xA1, 0x20 + 8);
  outb(0x21, 0x04);
  outb(0xA1, 0x02);
  outb(0x21, 0x01);
  outb(0xA1, 0x01);
  outb(0x21, 0xfb);
  outb(0xA1, 0xff);
}


x86 assembly (clang, -O0):
<pic_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20,%edi
mov    $0x11,%esi
call   1030 <outb@plt>
mov    $0xa0,%edi
mov    $0x11,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x20,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x28,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x4,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x2,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x1,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x1,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0xfb,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0xff,%esi
call   1030 <outb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pic_init>:
push   %rax
mov    $0x20,%edi
mov    $0x11,%esi
call   1030 <outb@plt>
mov    $0xa0,%edi
mov    $0x11,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x20,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x28,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x4,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x2,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x1,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x1,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0xfb,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0xff,%esi
pop    %rax
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @pic_init() {
%1 = call i32 @outb(i32 32, i32 17)
%2 = call i32 @outb(i32 160, i32 17)
%3 = call i32 @outb(i32 33, i32 32)
%4 = call i32 @outb(i32 161, i32 40)
%5 = call i32 @outb(i32 33, i32 4)
%6 = call i32 @outb(i32 161, i32 2)
%7 = call i32 @outb(i32 33, i32 1)
%8 = call i32 @outb(i32 161, i32 1)
%9 = call i32 @outb(i32 33, i32 251)
%10 = call i32 @outb(i32 161, i32 255)
ret void
}

LLVM IR (-O2):
define void @pic_init() {
%1 = tail call i32 @outb(i32 32, i32 17)
%2 = tail call i32 @outb(i32 160, i32 17)
%3 = tail call i32 @outb(i32 33, i32 32)
%4 = tail call i32 @outb(i32 161, i32 40)
%5 = tail call i32 @outb(i32 33, i32 4)
%6 = tail call i32 @outb(i32 161, i32 2)
%7 = tail call i32 @outb(i32 33, i32 1)
%8 = tail call i32 @outb(i32 161, i32 1)
%9 = tail call i32 @outb(i32 33, i32 251)
%10 = tail call i32 @outb(i32 161, i32 255)
ret void
}
unsigned int ETree_nFactorEntriesInFront(unsigned int b, unsigned int m) {
  unsigned int nent = b * b + 2 * b * m;
  return nent;
}


x86 assembly (clang, -O0):
<ETree_nFactorEntriesInFront>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
imul   -0x8(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ETree_nFactorEntriesInFront>:
lea    (%rdi,%rsi,2),%eax
imul   %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @ETree_nFactorEntriesInFront(i32 %0, i32 %1) {
%3 = shl i32 %1, 1
%4 = add i32 %3, %0
%5 = mul i32 %4, %0
ret i32 %5
}
/* Variables and functions */
int rand();
int random_rank(int n) { return rand() % n; }


x86 assembly (clang, -O0):
<random_rank>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_rank>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @random_rank(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = load i32, i32* %2
%5 = srem i32 %3, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @random_rank(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ invalid_phase(char *);
void phase_2(char *input) { invalid_phase("2b"); }


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

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

LLVM IR (-O0):
@.str = [3 x i8] c"2b\00"
define void @phase_2(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @invalid_phase(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"2b\00"
define void @phase_2(i8* nocapture readnone %0) {
%2 = tail call i32 @invalid_phase(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}
int test8(void) {
  int i, sum = 0;
  int tab[10];
  for (i = 0; i < 10; i++) {
    sum += tab[i];
  }
  return sum;
}


x86 assembly (clang, -O0):
<test8>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1138 <test8+0x38>
movslq -0x4(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1112 <test8+0x12>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test8() {
ret i32 undef
}
int nsvg__isdigit(char c) { return c >= '0' && c <= '9'; }


x86 assembly (clang, -O0):
<nsvg__isdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <nsvg__isdigit+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nsvg__isdigit>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

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

LLVM IR (-O2):
define i32 @nsvg__isdigit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
scalar_t__ stat(char *, struct stat *);
int file_exists(char *path) {
  struct stat buffer;
  return stat(path, &buffer) == 0;
}


x86 assembly (clang, -O0):
<file_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_exists>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @file_exists(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @stat(i8* %4, %struct.stat* %3)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @file_exists(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ FromBE16(int /*<<< orphan*/ const);
uint16_t ReadUnalignedBE16(const uint16_t *p) { return FromBE16(*p); }


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

x86 assembly (clang, -O2):
<ReadUnalignedBE16>:
mov    (%rdi),%edi
jmp    1030 <FromBE16@plt>

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

LLVM IR (-O2):
define i32 @ReadUnalignedBE16(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @FromBE16(i32 %2)
ret i32 %3
}
unsigned int testfn(void) { return 0xbead0107; }


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

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

LLVM IR (-O0):
define i32 @testfn() {
ret i32 -1095958265
}

LLVM IR (-O2):
define i32 @testfn() {
ret i32 -1095958265
}
/* Variables and functions */
int /*<<< orphan*/ madbr(double, double, double);
int /*<<< orphan*/ maebr(float, double, double);
int /*<<< orphan*/ msdbr(double, double, double);
int /*<<< orphan*/ msebr(float, double, double);
int main(void) {
  maebr(10.5f, 20.25, 3.0);
  madbr(-10.5, 42.75, -2.0);
  msebr(10.5f, 20.25, 3.0);
  msdbr(-10.5, 42.75, -2.0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xed1(%rip),%xmm0
movsd  0xeb9(%rip),%xmm1
movsd  0xeb9(%rip),%xmm2
call   1050 <maebr@plt>
movsd  0xe8c(%rip),%xmm0
movsd  0xe8c(%rip),%xmm1
movsd  0xe8c(%rip),%xmm2
call   1040 <madbr@plt>
movss  0xe97(%rip),%xmm0
movsd  0xe7f(%rip),%xmm1
movsd  0xe7f(%rip),%xmm2
call   1030 <msebr@plt>
movsd  0xe52(%rip),%xmm0
movsd  0xe52(%rip),%xmm1
movsd  0xe52(%rip),%xmm2
call   1060 <msdbr@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movss  0xeb7(%rip),%xmm0
movsd  0xeb7(%rip),%xmm1
movsd  0xeb7(%rip),%xmm2
call   1050 <maebr@plt>
movsd  0xeb2(%rip),%xmm0
movsd  0xeb2(%rip),%xmm1
movsd  0xeb2(%rip),%xmm2
call   1040 <madbr@plt>
movss  0xe7d(%rip),%xmm0
movsd  0xe7d(%rip),%xmm1
movsd  0xe7d(%rip),%xmm2
call   1030 <msebr@plt>
movsd  0xe78(%rip),%xmm0
movsd  0xe78(%rip),%xmm1
movsd  0xe78(%rip),%xmm2
call   1060 <msdbr@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @maebr(float 1.050000e+01, double 2.025000e+01, double 3.000000e+00)
%3 = call i32 @madbr(double -1.050000e+01, double 4.275000e+01, double -2.000000e+00)
%4 = call i32 @msebr(float 1.050000e+01, double 2.025000e+01, double 3.000000e+00)
%5 = call i32 @msdbr(double -1.050000e+01, double 4.275000e+01, double -2.000000e+00)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @maebr(float 1.050000e+01, double 2.025000e+01, double 3.000000e+00)
%2 = tail call i32 @madbr(double -1.050000e+01, double 4.275000e+01, double -2.000000e+00)
%3 = tail call i32 @msebr(float 1.050000e+01, double 2.025000e+01, double 3.000000e+00)
%4 = tail call i32 @msdbr(double -1.050000e+01, double 4.275000e+01, double -2.000000e+00)
ret i32 0
}
void STC311x_Reset_Adj(void) {}


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

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

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

LLVM IR (-O2):
define void @STC311x_Reset_Adj() {
ret void
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ snprintf(char *, size_t, char *, char const *, char const *);
int strlen(char const *);
char *cg_name(const char *root, const char *name) {
  size_t len = strlen(root) + strlen(name) + 2;
  char *ret = malloc(len);
  snprintf(ret, len, "%s/%s", root, name);
  return ret;
}


x86 assembly (clang, -O0):
<cg_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
add    $0x2,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xe77(%rip),%rdx
call   1040 <snprintf@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cg_name>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1030 <strlen@plt>
add    %ebx,%eax
add    $0x2,%eax
movslq %eax,%rbx
mov    %rbx,%rdi
call   1050 <malloc@plt>
mov    %rax,%r12
lea    0xe99(%rip),%rdx
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r15,%rcx
mov    %r14,%r8
call   1040 <snprintf@plt>
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s/%s\00"
define i8* @cg_name(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = load i8*, i8** %4
%10 = call i32 @strlen(i8* %9)
%11 = add nsw i32 %8, %10
%12 = add nsw i32 %11, 2
%13 = sext i32 %12 to i64
store i64 %13, i64* %5
%14 = load i64, i64* %5
%15 = call i8* @malloc(i64 %14)
store i8* %15, i8** %6
%16 = load i8*, i8** %6
%17 = load i64, i64* %5
%18 = load i8*, i8** %3
%19 = load i8*, i8** %4
%20 = call i32 @snprintf(i8* %16, i64 %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %18, i8* %19)
%21 = load i8*, i8** %6
ret i8* %21
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s/%s\00"
define i8* @cg_name(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = add i32 %3, 2
%6 = add i32 %5, %4
%7 = sext i32 %6 to i64
%8 = tail call i8* @malloc(i64 %7)
%9 = tail call i32 @snprintf(i8* %8, i64 %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int volatile);
void SYS_IRQ_Shell(void) {
  printf("ISR not found! ISNR=%d\n",
         (*((volatile unsigned int *)((0xB0042000 + 0x120)))));
}


x86 assembly (clang, -O0):
<SYS_IRQ_Shell>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb0042120,%eax
mov    (%rax),%esi
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SYS_IRQ_Shell>:
mov    $0xb0042120,%eax
mov    (%rax),%esi
lea    0xee2(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"ISR not found! ISNR=%d\0A\00"
define void @SYS_IRQ_Shell() {
%1 = load volatile i32, i32* inttoptr (i64 2953060640 to i32*)
%2 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"ISR not found! ISNR=%d\0A\00"
define void @SYS_IRQ_Shell() {
%1 = load volatile i32, i32* inttoptr (i64 2953060640 to i32*)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ basic_daytime(int *, int *, int *, int *);
double basic_seconds() {
  int seconds, microseconds, w, d;
  basic_daytime(&seconds, &microseconds, &w, &d);
  return ((double)seconds + microseconds / 1000000.0);
}


x86 assembly (clang, -O0):
<basic_seconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1030 <basic_daytime@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xec1(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basic_seconds>:
sub    $0x18,%rsp
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1030 <basic_daytime@plt>
cvtsi2sdl 0xc(%rsp),%xmm1
cvtsi2sdl 0x8(%rsp),%xmm0
divsd  0xebf(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @basic_seconds() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 @basic_daytime(i32* %1, i32* %2, i32* %3, i32* %4)
%6 = load i32, i32* %1
%7 = sitofp i32 %6 to double
%8 = load i32, i32* %2
%9 = sitofp i32 %8 to double
%10 = fdiv double %9, 1.000000e+06
%11 = fadd double %7, %10
ret double %11
}

LLVM IR (-O2):
define double @basic_seconds() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @basic_daytime(i32* %1, i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %1
%11 = sitofp i32 %10 to double
%12 = load i32, i32* %2
%13 = sitofp i32 %12 to double
%14 = fdiv double %13, 1.000000e+06
%15 = fadd double %14, %11
ret double %15
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int sscanf(char *, char *, float *, int *);
char *parseFloat(char *s, float *fp) {
  int r, sz;
  r = sscanf(s, "%f%n", fp, &sz);
  assert(r == 1);
  return (s + sz);
}


x86 assembly (clang, -O0):
<parseFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xec1(%rip),%rsi
lea    -0x18(%rbp),%rcx
call   1040 <sscanf@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
add    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseFloat>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rdx
mov    %rdi,%rbx
lea    0xece(%rip),%rsi
lea    0xc(%rsp),%rcx
call   1040 <sscanf@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1030 <assert@plt>
movslq 0xc(%rsp),%rax
add    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%f%n\00"
define i8* @parseFloat(i8* %0, float* %1) {
%3 = alloca i8*
%4 = alloca float*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store float* %1, float** %4
%7 = load i8*, i8** %3
%8 = load float*, float** %4
%9 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float* %8, i32* %6)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, 1
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i8*, i8** %3
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
ret i8* %17
}

LLVM IR (-O2):
@.str = [5 x i8] c"%f%n\00"
define i8* @parseFloat(i8* %0, float* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float* %1, i32* %3)
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
ret i8* %11
}