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

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
void monotime(struct timespec *tp) { clock_gettime(CLOCK_MONOTONIC, tp); }


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

x86 assembly (clang, -O2):
<monotime>:
mov    %rdi,%rsi
mov    0x2ece(%rip),%rax
mov    (%rax),%edi
jmp    1030 <clock_gettime@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_MONOTONIC = global i32 0
define void @monotime(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %2
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = load %struct.timespec*, %struct.timespec** %2
%5 = call i32 @clock_gettime(i32 %3, %struct.timespec* %4)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_MONOTONIC = global i32 0
define void @monotime(%struct.timespec* %0) {
%2 = load i32, i32* @CLOCK_MONOTONIC
%3 = tail call i32 @clock_gettime(i32 %2, %struct.timespec* %0)
ret void
}
__attribute__((no)) void without_restrict(int *p) {
  int i;
  int *q = p - 1;
  for (i = 0; i < 1000; ++i) {
    p[i] = q[i];
  }
}


x86 assembly (clang, -O0):
<without_restrict>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    114c <without_restrict+0x4c>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    111b <without_restrict+0x1b>
pop    %rbp
ret

x86 assembly (clang, -O2):
<without_restrict>:
mov    -0x4(%rdi),%eax
mov    $0x7,%ecx
nopl   0x0(%rax,%rax,1)
mov    %eax,-0x1c(%rdi,%rcx,4)
mov    %eax,-0x18(%rdi,%rcx,4)
mov    %eax,-0x14(%rdi,%rcx,4)
mov    %eax,-0x10(%rdi,%rcx,4)
mov    %eax,-0xc(%rdi,%rcx,4)
mov    %eax,-0x8(%rdi,%rcx,4)
mov    %eax,-0x4(%rdi,%rcx,4)
mov    %eax,(%rdi,%rcx,4)
add    $0x8,%rcx
cmp    $0x3ef,%rcx
jne    1110 <without_restrict+0x10>
ret

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

LLVM IR (-O2):
define void @without_restrict(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 -1
%3 = load i32, i32* %2
br label %4
4: ; preds = %4, %1
%5 = phi i64 [ 0, %1 ], [ %21, %4 ]
%6 = getelementptr inbounds i32, i32* %0, i64 %5
store i32 %3, i32* %6
%7 = or i64 %5, 1
%8 = getelementptr inbounds i32, i32* %0, i64 %7
store i32 %3, i32* %8
%9 = or i64 %5, 2
%10 = getelementptr inbounds i32, i32* %0, i64 %9
store i32 %3, i32* %10
%11 = or i64 %5, 3
%12 = getelementptr inbounds i32, i32* %0, i64 %11
store i32 %3, i32* %12
%13 = or i64 %5, 4
%14 = getelementptr inbounds i32, i32* %0, i64 %13
store i32 %3, i32* %14
%15 = or i64 %5, 5
%16 = getelementptr inbounds i32, i32* %0, i64 %15
store i32 %3, i32* %16
%17 = or i64 %5, 6
%18 = getelementptr inbounds i32, i32* %0, i64 %17
store i32 %3, i32* %18
%19 = or i64 %5, 7
%20 = getelementptr inbounds i32, i32* %0, i64 %19
store i32 %3, i32* %20
%21 = add nuw nsw i64 %5, 8
%22 = icmp eq i64 %21, 1000
br i1 %22, label %23, label %4
23: ; preds = %4
ret void
}
void le_uint16_write(void *ptr, unsigned v) {
  unsigned char *ptr8 = (unsigned char *)ptr;
  ptr8[0] = v & 0xFF;
  ptr8[1] = (v >> 8) & 0xFF;
}


x86 assembly (clang, -O0):
<le_uint16_write>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<le_uint16_write>:
mov    %si,(%rdi)
ret

LLVM IR (-O0):
define void @le_uint16_write(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
%7 = load i32, i32* %4
%8 = and i32 %7, 255
%9 = trunc i32 %8 to i8
%10 = load i8*, i8** %5
%11 = getelementptr inbounds i8, i8* %10, i64 0
store i8 %9, i8* %11
%12 = load i32, i32* %4
%13 = lshr i32 %12, 8
%14 = and i32 %13, 255
%15 = trunc i32 %14 to i8
%16 = load i8*, i8** %5
%17 = getelementptr inbounds i8, i8* %16, i64 1
store i8 %15, i8* %17
ret void
}

LLVM IR (-O2):
define void @le_uint16_write(i8* nocapture writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i8
store i8 %3, i8* %0
%4 = lshr i32 %1, 8
%5 = trunc i32 %4 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
ret void
}
void moves_(x, y, z) short *x, *y, *z;
{ move((float)*x, (float)*y, (float)*z); }


x86 assembly (clang, -O0):
<moves_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%eax
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movswl (%rax),%eax
cvtsi2ss %eax,%xmm1
cvtss2sd %xmm1,%xmm1
mov    -0x18(%rbp),%rax
movswl (%rax),%eax
cvtsi2ss %eax,%xmm2
cvtss2sd %xmm2,%xmm2
mov    $0x3,%al
call   1030 <move@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<moves_>:
movswl (%rdi),%eax
cvtsi2sd %eax,%xmm0
movswl (%rsi),%eax
cvtsi2sd %eax,%xmm1
movswl (%rdx),%eax
cvtsi2sd %eax,%xmm2
mov    $0x3,%al
jmp    1030 <move@plt>

LLVM IR (-O0):
define void @moves_(i16* %0, i16* %1, i16* %2) {
%4 = alloca i16*
%5 = alloca i16*
%6 = alloca i16*
store i16* %0, i16** %4
store i16* %1, i16** %5
store i16* %2, i16** %6
%7 = load i16*, i16** %4
%8 = load i16, i16* %7
%9 = sitofp i16 %8 to float
%10 = fpext float %9 to double
%11 = load i16*, i16** %5
%12 = load i16, i16* %11
%13 = sitofp i16 %12 to float
%14 = fpext float %13 to double
%15 = load i16*, i16** %6
%16 = load i16, i16* %15
%17 = sitofp i16 %16 to float
%18 = fpext float %17 to double
%19 = call i32 (double, double, double, ...) bitcast (i32 (...)* @move to i32 (double, double, double, ...)*)(double %10, double %14, double %18)
ret void
}

LLVM IR (-O2):
define void @moves_(i16* nocapture %0, i16* nocapture %1, i16* nocapture %2) {
%4 = load i16, i16* %0
%5 = sitofp i16 %4 to double
%6 = load i16, i16* %1
%7 = sitofp i16 %6 to double
%8 = load i16, i16* %2
%9 = sitofp i16 %8 to double
%10 = tail call i32 (double, double, double, ...) bitcast (i32 (...)* @move to i32 (double, double, double, ...)*)(double %5, double %7, double %9)
ret void
}
/* Variables and functions */
bool nrf52_errata_8(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf52_errata_8() {
ret i32 0
}
int test_imm_2Fint8_reg(signed char val) {
  return ((val) & (-0x2F << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_2Fint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffffd1,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_2Fint8_reg>:
test   $0xd1,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_2Fint8_reg(i8 signext %0) {
%2 = and i8 %0, -47
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void busy_work(int loops) {
  int i = 0;
  while (i < loops)
    i++;
}


x86 assembly (clang, -O0):
<busy_work>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1128 <busy_work+0x28>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <busy_work+0xe>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @busy_work(i32 %0) {
ret void
}
/* Variables and functions */
scalar_t__ g_malloc(int, int /*<<< orphan*/);
int /*<<< orphan*/ g_strcpy(char *, char const *);
int g_strlen(char const *);
char *g_strdup(const char *in) {
  int len;
  char *p;
  if (in == 0) {
    return 0;
  }
  len = g_strlen(in);
  p = (char *)g_malloc(len + 1, 0);
  g_strcpy(p, in);
  return p;
}


x86 assembly (clang, -O0):
<g_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <g_strdup+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1186 <g_strdup+0x56>
mov    -0x10(%rbp),%rdi
call   1040 <g_strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
add    $0x1,%edi
xor    %esi,%esi
call   1030 <g_malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <g_strcpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_strdup>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     115b <g_strdup+0x2b>
mov    %rdi,%rbx
call   1040 <g_strlen@plt>
lea    0x1(%rax),%edi
xor    %esi,%esi
call   1030 <g_malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbx,%rsi
call   1050 <g_strcpy@plt>
jmp    115e <g_strdup+0x2e>
xor    %r14d,%r14d
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @g_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %9
8: ; preds = %1
store i8* null, i8** %2
br label %20
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i32 @g_strlen(i8* %10)
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 1
%14 = call i64 @g_malloc(i32 %13, i32 0)
%15 = inttoptr i64 %14 to i8*
store i8* %15, i8** %5
%16 = load i8*, i8** %5
%17 = load i8*, i8** %3
%18 = call i32 @g_strcpy(i8* %16, i8* %17)
%19 = load i8*, i8** %5
store i8* %19, i8** %2
br label %20
20: ; preds = %9, %8
%21 = load i8*, i8** %2
ret i8* %21
}

LLVM IR (-O2):
define i8* @g_strdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = tail call i32 @g_strlen(i8* %0)
%5 = add nsw i32 %4, 1
%6 = tail call i64 @g_malloc(i32 %5, i32 0)
%7 = inttoptr i64 %6 to i8*
%8 = tail call i32 @g_strcpy(i8* %7, i8* %0)
br label %9
9: ; preds = %1, %3
%10 = phi i8* [ %7, %3 ], [ null, %1 ]
ret i8* %10
}
void integrator_wh_synchronize(void) {}


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

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

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

LLVM IR (-O2):
define void @integrator_wh_synchronize() {
ret void
}
/* Variables and functions */
int ntohl(int);
void ints_array_ntohl(int *hostlong, int nmemb) {
  int i;
  for (i = 0; i < nmemb; i++)
    hostlong[i] = ntohl(hostlong[i]);
}


x86 assembly (clang, -O0):
<ints_array_ntohl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115d <ints_array_ntohl+0x4d>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <ntohl@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <ints_array_ntohl+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ints_array_ntohl>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1146 <ints_array_ntohl+0x36>
mov    %rdi,%r15
mov    %esi,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%edi
call   1030 <ntohl@plt>
mov    %eax,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1130 <ints_array_ntohl+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @ints_array_ntohl(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @ntohl(i32 %9)
store i32 %10, i32* %8
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
bool megamaniac_type_is_enemy(int game_object_type) {
  assert(game_object_type > -1);
  switch (game_object_type) {
  case 9:
  case 10:
  case 11:
  case 12:
  case 13:
  case 28:
  case 25:
    return true;
  default:
    return false;
  }
}


x86 assembly (clang, -O0):
<megamaniac_type_is_enemy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
not    %edi
shr    $0x1f,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xfffffff7,%eax
sub    $0x5,%eax
jb     1161 <megamaniac_type_is_enemy+0x51>
jmp    113f <megamaniac_type_is_enemy+0x2f>
mov    -0xc(%rbp),%eax
sub    $0x19,%eax
je     1161 <megamaniac_type_is_enemy+0x51>
jmp    1150 <megamaniac_type_is_enemy+0x40>
mov    -0xc(%rbp),%eax
sub    $0x1c,%eax
jne    116d <megamaniac_type_is_enemy+0x5d>
jmp    1161 <megamaniac_type_is_enemy+0x51>
movl   $0x1,-0x4(%rbp)
jmp    1174 <megamaniac_type_is_enemy+0x64>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<megamaniac_type_is_enemy>:
push   %rbx
mov    %edi,%ebx
not    %edi
shr    $0x1f,%edi
call   1030 <assert@plt>
cmp    $0x1c,%ebx
ja     1133 <megamaniac_type_is_enemy+0x23>
mov    $0x1,%eax
mov    $0x12003e00,%ecx
bt     %ebx,%ecx
jae    1133 <megamaniac_type_is_enemy+0x23>
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @megamaniac_type_is_enemy(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, -1
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load i32, i32* %3
switch i32 %8, label %10 [
i32 9, label %9
i32 10, label %9
i32 11, label %9
i32 12, label %9
i32 13, label %9
i32 28, label %9
i32 25, label %9
]
9: ; preds = %1, %1, %1, %1, %1, %1, %1
store i32 1, i32* %2
br label %11
10: ; preds = %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @megamaniac_type_is_enemy(i32 %0) {
%2 = xor i32 %0, -1
%3 = lshr i32 %2, 31
%4 = tail call i32 @assert(i32 %3)
switch i32 %0, label %5 [
i32 9, label %6
i32 10, label %6
i32 11, label %6
i32 12, label %6
i32 13, label %6
i32 28, label %6
i32 25, label %6
]
5: ; preds = %1
br label %6
6: ; preds = %1, %1, %1, %1, %1, %1, %1, %5
%7 = phi i32 [ 0, %5 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ read(int /*<<< orphan*/, int *, int);
void fill_from_stdin(int *value) { read(0, value, sizeof *value); }


x86 assembly (clang, -O0):
<fill_from_stdin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
mov    $0x4,%edx
call   1030 <read@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_from_stdin>:
mov    %rdi,%rsi
xor    %edi,%edi
mov    $0x4,%edx
jmp    1030 <read@plt>

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

LLVM IR (-O2):
define void @fill_from_stdin(i32* nocapture %0) {
%2 = tail call i32 @read(i32 0, i32* %0, i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ memmove(void *, void const *, size_t);
void Mmove(void *dest, const void *src, size_t n) {
  assert(dest != NULL);
  assert(src != NULL);
  assert(n > 0);
  memmove(dest, src, n);
}


x86 assembly (clang, -O0):
<Mmove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memmove@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mmove>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %r15,%r15
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <memmove@plt>

LLVM IR (-O0):
define void @Mmove(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i8*, i8** %5
%12 = icmp ne i8* %11, null
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i64, i64* %6
%16 = icmp ugt i64 %15, 0
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load i8*, i8** %4
%20 = load i8*, i8** %5
%21 = load i64, i64* %6
%22 = call i32 @memmove(i8* %19, i8* %20, i64 %21)
ret void
}

LLVM IR (-O2):
define void @Mmove(i8* %0, i8* %1, i64 %2) {
%4 = icmp ne i8* %0, null
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = icmp ne i8* %1, null
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = icmp ne i64 %2, 0
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @memmove(i8* %0, i8* %1, i64 %2)
ret void
}
int is_prime(unsigned int in) {
  int i;
  if (in < 2)
    return -1;
  if (in == 2 || in == 3)
    return 1;
  if (in % 2 == 0 || in % 3 == 0)
    return 0;
  else
    return 1;
  return -1;
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jae    111d <is_prime+0x1d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1174 <is_prime+0x74>
cmpl   $0x2,-0x8(%rbp)
je     1131 <is_prime+0x31>
cmpl   $0x3,-0x8(%rbp)
jne    113d <is_prime+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    1174 <is_prime+0x74>
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1161 <is_prime+0x61>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x0,%edx
jne    116d <is_prime+0x6d>
movl   $0x0,-0x4(%rbp)
jmp    1174 <is_prime+0x74>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
mov    $0xffffffff,%eax
cmp    $0x2,%edi
jb     112d <is_prime+0x2d>
mov    %edi,%ecx
and    $0xfffffffe,%ecx
mov    $0x1,%eax
cmp    $0x2,%ecx
je     112d <is_prime+0x2d>
imul   $0xaaaaaaab,%edi,%eax
cmp    $0x55555556,%eax
setae  %al
and    %dil,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @is_prime(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp ult i32 %5, 2
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 -1, i32* %2
br label %25
8: ; preds = %1
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 2
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 3
br i1 %13, label %14, label %15
14: ; preds = %11, %8
store i32 1, i32* %2
br label %25
15: ; preds = %11
%16 = load i32, i32* %3
%17 = urem i32 %16, 2
%18 = icmp eq i32 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %15
%20 = load i32, i32* %3
%21 = urem i32 %20, 3
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %19, %15
store i32 0, i32* %2
br label %25
24: ; preds = %19
store i32 1, i32* %2
br label %25
25: ; preds = %24, %23, %14, %7
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
define i32 @is_prime(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = and i32 %0, -2
%5 = icmp eq i32 %4, 2
br i1 %5, label %13, label %6
6: ; preds = %3
%7 = and i32 %0, 1
%8 = icmp ne i32 %7, 0
%9 = urem i32 %0, 3
%10 = icmp ne i32 %9, 0
%11 = and i1 %8, %10
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %6, %3, %1
%14 = phi i32 [ -1, %1 ], [ 1, %3 ], [ %12, %6 ]
ret i32 %14
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ setgid(int);
int /*<<< orphan*/ setuid(int);
int stat(char *, struct stat *);
void group_test_2() {
  struct stat buf;
  int res;
  do {
    setgid((100) + 1);
    setuid(101);
  } while (0);
  res = stat("DIR_046/.", &buf);
  exit(res == 0);
}


x86 assembly (clang, -O0):
<group_test_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x65,%edi
call   1040 <setgid@plt>
mov    $0x65,%edi
call   1060 <setuid@plt>
lea    0xe9d(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <stat@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<group_test_2>:
push   %rax
mov    $0x65,%edi
call   1040 <setgid@plt>
mov    $0x65,%edi
call   1060 <setuid@plt>
lea    0xea4(%rip),%rdi
mov    %rsp,%rsi
call   1030 <stat@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [10 x i8] c"DIR_046/.\00"
define void @group_test_2() {
%1 = alloca %struct.stat
%2 = alloca i32
br label %3
3: ; preds = %0
%4 = call i32 @setgid(i32 101)
%5 = call i32 @setuid(i32 101)
br label %6
6: ; preds = %3
%7 = call i32 @stat(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
%11 = call i32 @exit(i32 %10)
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [10 x i8] c"DIR_046/.\00"
define void @group_test_2() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = tail call i32 @setgid(i32 101)
%4 = tail call i32 @setuid(i32 101)
%5 = call i32 @stat(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @exit(i32 %7)
unreachable
}
/* Variables and functions */
double floor(double);
double range(double x) {
  double a, b;
  b = x / 360;
  a = 360 * (b - floor(b));
  if (a < 0)
    a = 360 + a;
  return (a);
}


x86 assembly (clang, -O0):
<range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <floor@plt>
movsd  -0x20(%rbp),%xmm1
subsd  %xmm0,%xmm1
movsd  0xea8(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1181 <range+0x71>
movsd  0xe89(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<range>:
sub    $0x18,%rsp
movsd  0xee4(%rip),%xmm1
divsd  %xmm1,%xmm0
movapd %xmm0,(%rsp)
call   1030 <floor@plt>
movapd (%rsp),%xmm3
subsd  %xmm0,%xmm3
movsd  0xec5(%rip),%xmm2
mulsd  %xmm2,%xmm3
addsd  %xmm3,%xmm2
xorpd  %xmm1,%xmm1
movapd %xmm3,%xmm0
cmpltsd %xmm1,%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm3,%xmm0
orpd   %xmm2,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @range(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = fdiv double %5, 3.600000e+02
store double %6, double* %4
%7 = load double, double* %4
%8 = load double, double* %4
%9 = call double @llvm.floor.f64(double %8)
%10 = fsub double %7, %9
%11 = fmul double 3.600000e+02, %10
store double %11, double* %3
%12 = load double, double* %3
%13 = fcmp olt double %12, 0.000000e+00
br i1 %13, label %14, label %17
14: ; preds = %1
%15 = load double, double* %3
%16 = fadd double 3.600000e+02, %15
store double %16, double* %3
br label %17
17: ; preds = %14, %1
%18 = load double, double* %3
ret double %18
}

LLVM IR (-O2):
define double @range(double %0) {
%2 = fdiv double %0, 3.600000e+02
%3 = tail call double @llvm.floor.f64(double %2)
%4 = fsub double %2, %3
%5 = fmul double %4, 3.600000e+02
%6 = fcmp olt double %5, 0.000000e+00
%7 = fadd double %5, 3.600000e+02
%8 = select i1 %6, double %7, double %5
ret double %8
}
/* Type definitions */
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef int /*<<< orphan*/ ASN1_ITEM;

/* Variables and functions */
int /*<<< orphan*/ asn1_item_embed_free(int /*<<< orphan*/ **,
                                        int /*<<< orphan*/ const *,
                                        int /*<<< orphan*/);
void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it) {
  asn1_item_embed_free(&val, it, 0);
}


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

x86 assembly (clang, -O2):
<ASN1_item_free>:
push   %rax
mov    %rdi,(%rsp)
mov    %rsp,%rdi
xor    %edx,%edx
call   1030 <asn1_item_embed_free@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @ASN1_item_free(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 = call i32 @asn1_item_embed_free(i32** %3, i32* %5, i32 0)
ret void
}

LLVM IR (-O2):
define void @ASN1_item_free(i32* %0, i32* %1) {
%3 = alloca i32*
store i32* %0, i32** %3
%4 = call i32 @asn1_item_embed_free(i32** %3, i32* %1, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void updateDB(void) { system("/usr/local/clamav/bin/freshclam"); }


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

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

LLVM IR (-O0):
@.str = [32 x i8] c"/usr/local/clamav/bin/freshclam\00"
define void @updateDB() {
%1 = call i32 @system(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"/usr/local/clamav/bin/freshclam\00"
define void @updateDB() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *julian_to_yyyy_mm_dd(double);
char *julian_get_yyyy_mm_dd_string(double current) {
  return julian_to_yyyy_mm_dd(current);
}


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

x86 assembly (clang, -O2):
<julian_get_yyyy_mm_dd_string>:
jmp    1030 <julian_to_yyyy_mm_dd@plt>

LLVM IR (-O0):
define i8* @julian_get_yyyy_mm_dd_string(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i8* @julian_to_yyyy_mm_dd(double %3)
ret i8* %4
}

LLVM IR (-O2):
define i8* @julian_get_yyyy_mm_dd_string(double %0) {
%2 = tail call i8* @julian_to_yyyy_mm_dd(double %0)
ret i8* %2
}
/* Variables and functions */
float floorf(float);
void __hv_floor_f(float bIn, float *bOut) { *bOut = floorf(bIn); }


x86 assembly (clang, -O0):
<__hv_floor_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <floorf@plt>
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__hv_floor_f>:
push   %rbx
mov    %rdi,%rbx
call   1030 <floorf@plt>
movss  %xmm0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @__hv_floor_f(float %0, float* %1) {
%3 = alloca float
%4 = alloca float*
store float %0, float* %3
store float* %1, float** %4
%5 = load float, float* %3
%6 = call float @llvm.floor.f32(float %5)
%7 = load float*, float** %4
store float %6, float* %7
ret void
}

LLVM IR (-O2):
define void @__hv_floor_f(float %0, float* nocapture writeonly %1) {
%3 = tail call float @llvm.floor.f32(float %0)
store float %3, float* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_usage(char *file) {
  printf("Usage : \n");
  printf("%s	<r8	|r16	 |r32> 	<phy addr> 	[num] \n", file);
  printf("%s	<w8	|w16 |w32> 	<phy addr> 	<val> \n", file);
}


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

x86 assembly (clang, -O2):
<print_usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xf24(%rip),%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee0(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Usage : \0A\00"
@.str.1 = [40 x i8] c"%s\09<r8\09|r16\09 |r32> \09<phy addr> \09[num] \0A\00"
@.str.2 = [39 x i8] c"%s\09<w8\09|w16 |w32> \09<phy addr> \09<val> \0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = load i8*, i8** %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str.1 = [40 x i8] c"%s\09<r8\09|r16\09 |r32> \09<phy addr> \09[num] \0A\00"
@.str.2 = [39 x i8] c"%s\09<w8\09|w16 |w32> \09<phy addr> \09<val> \0A\00"
@str = [9 x i8] c"Usage : \00"
define void @print_usage(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ std_err(char *);
usage() {
  std_err("chmem {=+-} amount file\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <std_err@plt>
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <std_err@plt>
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"chmem {=+-} amount file\0A\00"
define i32 @usage() {
%1 = call i32 @std_err(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [25 x i8] c"chmem {=+-} amount file\0A\00"
define i32 @usage() {
%1 = tail call i32 @std_err(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
unsigned int f20(unsigned int);
unsigned int f21(unsigned int a) { return f20(f20(a)); }


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

x86 assembly (clang, -O2):
<f21>:
push   %rax
call   1030 <f20@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <f20@plt>

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

LLVM IR (-O2):
define i32 @f21(i32 %0) {
%2 = tail call i32 @f20(i32 %0)
%3 = tail call i32 @f20(i32 %2)
ret i32 %3
}
unsigned strhash(const char *s) {
  unsigned hash = 2166136261U;
  for (; *s; s++)
    hash = (hash ^ *s) * 0x01000193;
  return hash;
}


x86 assembly (clang, -O0):
<strhash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x811c9dc5,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1142 <strhash+0x42>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
xor    %ecx,%eax
imul   $0x1000193,%eax,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <strhash+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strhash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1127 <strhash+0x27>
add    $0x1,%rdi
mov    $0x811c9dc5,%eax
nop
movsbl %cl,%ecx
xor    %eax,%ecx
imul   $0x1000193,%ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <strhash+0x10>
ret
mov    $0x811c9dc5,%eax
ret

LLVM IR (-O0):
define i32 @strhash(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 -2128831035, i32* %3
br label %4
4: ; preds = %15, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %18
8: ; preds = %4
%9 = load i32, i32* %3
%10 = load i8*, i8** %2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = xor i32 %9, %12
%14 = mul i32 %13, 16777619
store i32 %14, i32* %3
br label %15
15: ; preds = %8
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
br label %4
18: ; preds = %4
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @strhash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ -2128831035, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = xor i32 %6, %8
%10 = mul i32 %9, 16777619
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ -2128831035, %1 ], [ %10, %4 ]
ret i32 %15
}
/* Variables and functions */
int b(double a) { return a == 0; }


x86 assembly (clang, -O0):
<b>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<b>:
xorpd  %xmm1,%xmm1
cmpeqsd %xmm0,%xmm1
movq   %xmm1,%rax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @b(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp oeq double %3, 0.000000e+00
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @b(double %0) {
%2 = fcmp oeq double %0, 0.000000e+00
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef scalar_t__ int16_t;

/* Variables and functions */
int16_t min16(int16_t a, int16_t b) { return ((a) < (b) ? (a) : (b)); }


x86 assembly (clang, -O0):
<min16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1127 <min16+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <min16+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min16>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovl  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @min16(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
int Q_rand(int *seed) {
  *seed = *seed * 1103515245 + 12345;
  return ((unsigned int)(*seed / 65536) % 32768);
}


x86 assembly (clang, -O0):
<Q_rand>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x41c64e6d,(%rax),%ecx
add    $0x3039,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    $0x10000,%ecx
cltd
idiv   %ecx
and    $0x7fff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q_rand>:
imul   $0x41c64e6d,(%rdi),%eax
lea    0x3039(%rax),%ecx
mov    %ecx,(%rdi)
add    $0x13038,%eax
test   %ecx,%ecx
cmovns %ecx,%eax
shr    $0x10,%eax
and    $0x7fff,%eax
ret

LLVM IR (-O0):
define i32 @Q_rand(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1103515245
%6 = add nsw i32 %5, 12345
%7 = load i32*, i32** %2
store i32 %6, i32* %7
%8 = load i32*, i32** %2
%9 = load i32, i32* %8
%10 = sdiv i32 %9, 65536
%11 = urem i32 %10, 32768
ret i32 %11
}

LLVM IR (-O2):
define i32 @Q_rand(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = mul nsw i32 %2, 1103515245
%4 = add nsw i32 %3, 12345
store i32 %4, i32* %0
%5 = sdiv i32 %4, 65536
%6 = and i32 %5, 32767
ret i32 %6
}
void MD5_memcpy(output, input, len) void *output;
void *input;
unsigned int len;
{ memmove(output, input, len * sizeof(void)); }


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

x86 assembly (clang, -O2):
<MD5_memcpy>:
mov    %edx,%edx
jmp    1030 <memmove@plt>

LLVM IR (-O0):
define void @MD5_memcpy(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = zext i32 %9 to i64
%11 = mul i64 %10, 1
ret void
}

LLVM IR (-O2):
define void @MD5_memcpy(i8* nocapture writeonly %0, i8* nocapture %1, i32 %2) {
%4 = zext i32 %2 to i64
tail call void @llvm.memmove.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 %1, i64 %4, i1 false)
ret void
}
/* Variables and functions */
int Round(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", Round(3.123));
  printf("%d\n", Round(3.523));
  printf("%d\n", Round(3.6123));
  printf("%d\n", Round(3));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1040 <Round@plt>
mov    %eax,%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <Round@plt>
mov    %eax,%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <Round@plt>
mov    %eax,%esi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <Round@plt>
mov    %eax,%esi
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @Round(i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @Round(i32 3)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @Round(i32 3)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @Round(i32 3)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int syscon_standard_Laurent_size_limit(int k, int *szl) {
  int fail;
  double *c;
  fail = _ada_use_c2phc(604, &k, szl, c);
  return fail;
}


x86 assembly (clang, -O0):
<syscon_standard_Laurent_size_limit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x25c,%edi
lea    -0x4(%rbp),%rsi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscon_standard_Laurent_size_limit>:
push   %rax
mov    %rsi,%rdx
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x25c,%edi
call   1030 <_ada_use_c2phc@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @syscon_standard_Laurent_size_limit(i32 %0, i32* %1) {
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 @_ada_use_c2phc(i32 604, i32* %3, i32* %1, double* undef)
ret i32 %4
}
/* Type definitions */
struct re_registers {
  int dummy;
};
struct re_pattern_buffer {
  int dummy;
};

/* Variables and functions */
int re_search_stub(struct re_pattern_buffer *, char const *, int, int, int, int,
                   struct re_registers *, int /*<<< orphan*/);
int re_search(struct re_pattern_buffer *bufp, const char *string, int length,
              int start, int range, struct re_registers *regs) {
  return re_search_stub(bufp, string, length, start, range, length, regs, 0);
}


x86 assembly (clang, -O0):
<re_search>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    -0x28(%rbp),%rax
xor    %r10d,%r10d
mov    %rax,(%rsp)
movl   $0x0,0x8(%rsp)
call   1030 <re_search_stub@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<re_search>:
push   %rax
mov    %r9,%rax
mov    %edx,%r9d
push   $0x0
push   %rax
call   1030 <re_search_stub@plt>
add    $0x10,%rsp
pop    %rcx
ret

LLVM IR (-O0):
%struct.re_pattern_buffer = type { i32 }
%struct.re_registers = type { i32 }
define i32 @re_search(%struct.re_pattern_buffer* %0, i8* %1, i32 %2, i32 %3, i32 %4, %struct.re_registers* %5) {
%7 = alloca %struct.re_pattern_buffer*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca %struct.re_registers*
store %struct.re_pattern_buffer* %0, %struct.re_pattern_buffer** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store %struct.re_registers* %5, %struct.re_registers** %12
%13 = load %struct.re_pattern_buffer*, %struct.re_pattern_buffer** %7
%14 = load i8*, i8** %8
%15 = load i32, i32* %9
%16 = load i32, i32* %10
%17 = load i32, i32* %11
%18 = load i32, i32* %9
%19 = load %struct.re_registers*, %struct.re_registers** %12
%20 = call i32 @re_search_stub(%struct.re_pattern_buffer* %13, i8* %14, i32 %15, i32 %16, i32 %17, i32 %18, %struct.re_registers* %19, i32 0)
ret i32 %20
}

LLVM IR (-O2):
%struct.re_pattern_buffer = type { i32 }
%struct.re_registers = type { i32 }
define i32 @re_search(%struct.re_pattern_buffer* %0, i8* %1, i32 %2, i32 %3, i32 %4, %struct.re_registers* %5) {
%7 = tail call i32 @re_search_stub(%struct.re_pattern_buffer* %0, i8* %1, i32 %2, i32 %3, i32 %4, i32 %2, %struct.re_registers* %5, i32 0)
ret i32 %7
}