xunge/DecIR huggingface dataset:
__attribute__((__const__)) int clip(int x, int min, int max) {
  if (x < min)
    return min;
  if (x > max)
    return max;
  return x;
}


x86 assembly (clang, -O0):
<clip>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1124 <clip+0x24>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <clip+0x41>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    113b <clip+0x3b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <clip+0x41>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clip>:
mov    %edx,%eax
cmp    %edx,%edi
cmovle %edi,%eax
cmp    %esi,%edi
cmovl  %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @clip(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = icmp sgt i32 %0, %2
%6 = select i1 %5, i32 %2, i32 %0
%7 = select i1 %4, i32 %1, i32 %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello\n\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [7 x i8] c"Hello\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  typedef int num;
  num n1, n2;
  printf("Enter the 2 Numbers: ");
  scanf("%d %d", &n1, &n2);
  printf("Sum of two numbers is: %d \n", n1 + n2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
add    -0xc(%rbp),%esi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%esi
add    0x4(%rsp),%esi
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter the 2 Numbers: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [28 x i8] c"Sum of two numbers is: %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = add nsw i32 %6, %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Enter the 2 Numbers: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [28 x i8] c"Sum of two numbers is: %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = add nsw i32 %8, %7
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %9)
ret i32 0
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ send_event;
};
struct TYPE_4__ {
  TYPE_1__ xselectionclear;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
int get_XEvent_xselectionclear_send_event(void *_p) {
  return (int)((XEvent *)_p)->xselectionclear.send_event;
}


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

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

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64 }
define i32 @get_XEvent_xselectionclear_send_event(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_4__*
%5 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i32 0, i32 0
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @get_XEvent_xselectionclear_send_event(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
signed long long int
signedlonglongint_ignoring_signedlong(signed long long int x, signed long y) {
  return x;
}


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

x86 assembly (clang, -O2):
<signedlonglongint_ignoring_signedlong>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @signedlonglongint_ignoring_signedlong(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
ret i64 %5
}

LLVM IR (-O2):
define i64 @signedlonglongint_ignoring_signedlong(i64 returned %0, i64 %1) {
ret i64 %0
}
void outb(unsigned short port, unsigned char data) {
  asm volatile("out"
               "b"
               " %1,%0"
               :
               : "d"(port), "a"(data));
}


x86 assembly (clang, -O0):
<outb>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    -0x2(%rbp),%dx
mov    -0x3(%rbp),%al
out    %al,(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outb>:
mov    %esi,%eax
mov    %edi,%edx
out    %al,(%dx)
ret

LLVM IR (-O0):
define void @outb(i16 zeroext %0, i8 zeroext %1) {
%3 = alloca i16
%4 = alloca i8
store i16 %0, i16* %3
store i8 %1, i8* %4
%5 = load i16, i16* %3
%6 = load i8, i8* %4
ret void
}

LLVM IR (-O2):
define void @outb(i16 zeroext %0, i8 zeroext %1) {
tail call void asm sideeffect "outb $1,$0", "{dx},{ax},~{dirflag},~{fpsr},~{flags}"(i16 %0, i8 %1)
ret void
}
int minnum(int a, int b) {
  if (a < b) {
    return a;
  } else {
    return b;
  }
}


x86 assembly (clang, -O0):
<minnum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1121 <minnum+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <minnum+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<minnum>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @minnum(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
void ff_hevc_put_hevc_uni_w_pel_pixels16_10_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_w_pel_pixels16_10_sse4() {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ pn_is_power_of_two(int);
size_t pn_align_down(size_t size, uint32_t align) {
  assert(pn_is_power_of_two(align));
  return size & ~(align - 1);
}


x86 assembly (clang, -O0):
<pn_align_down>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <pn_is_power_of_two@plt>
mov    %eax,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
xor    $0xffffffff,%ecx
movslq %ecx,%rcx
and    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pn_align_down>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%edi
call   1040 <pn_is_power_of_two@plt>
mov    %eax,%edi
call   1030 <assert@plt>
neg    %ebx
movslq %ebx,%rax
and    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @pn_align_down(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @pn_is_power_of_two(i32 %5)
%7 = call i32 @assert(i32 %6)
%8 = load i64, i64* %3
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 1
%11 = xor i32 %10, -1
%12 = sext i32 %11 to i64
%13 = and i64 %8, %12
ret i64 %13
}

LLVM IR (-O2):
define i64 @pn_align_down(i64 %0, i32 %1) {
%3 = tail call i32 @pn_is_power_of_two(i32 %1)
%4 = tail call i32 @assert(i32 %3)
%5 = sub i32 0, %1
%6 = sext i32 %5 to i64
%7 = and i64 %6, %0
ret i64 %7
}
int test3(int c) { return ((c & 4) ^ 4) != 0; }


x86 assembly (clang, -O0):
<test3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x4,%eax
xor    $0x4,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test3>:
xor    %eax,%eax
test   $0x4,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @test3(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 4
%5 = xor i32 %4, 4
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @test3(i32 %0) {
%2 = lshr i32 %0, 2
%3 = and i32 %2, 1
%4 = xor i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr,
          "Usage: stamd interface latitude longitude altitude [time]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [59 x i8] c"Usage: stamd interface latitude longitude altitude [time]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [59 x i8] c"Usage: stamd interface latitude longitude altitude [time]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
char ft_con_ic(int i) {
  char c;
  c = '0' + i;
  return (c);
}


x86 assembly (clang, -O0):
<ft_con_ic>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_con_ic>:
lea    0x30(%rdi),%eax
ret

LLVM IR (-O0):
define signext i8 @ft_con_ic(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 48, %4
%6 = trunc i32 %5 to i8
store i8 %6, i8* %3
%7 = load i8, i8* %3
ret i8 %7
}

LLVM IR (-O2):
define signext i8 @ft_con_ic(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = add i8 %2, 48
ret i8 %3
}
/* Variables and functions */
int foo(char *);
int main(void) { return foo("hello"); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <foo@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
define i32 @main() {
%1 = tail call i32 @foo(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
int check_strict_monotonicity(double *, int);
int test2() {
  double arr[] = {0.0, 1.0};
  int n = 2;
  int i = check_strict_monotonicity(arr, n);
  return (i == 1);
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x2,-0x14(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <check_strict_monotonicity@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
sub    $0x18,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x2,%esi
call   1030 <check_strict_monotonicity@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
mov    %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.test2.arr = [2 x double] [double 0.000000e+00, double 1.000000e+00]
define i32 @test2() {
%1 = alloca [2 x double]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [2 x double]* %1 to i8*
store i32 2, i32* %2
%5 = getelementptr inbounds [2 x double], [2 x double]* %1, i64 0, i64 0
%6 = load i32, i32* %2
%7 = call i32 @check_strict_monotonicity(double* %5, i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 1
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
@__const.test2.arr = [2 x double] [double 0.000000e+00, double 1.000000e+00]
define i32 @test2() {
%1 = alloca [2 x double]
%2 = bitcast [2 x double]* %1 to i8*
%3 = getelementptr inbounds [2 x double], [2 x double]* %1, i64 0, i64 0
%4 = call i32 @check_strict_monotonicity(double* %3, i32 2)
%5 = icmp eq i32 %4, 1
%6 = zext i1 %5 to i32
ret i32 %6
}
unsigned int f8(unsigned int x, int y) { return x & ((1U << y) - 1); }


x86 assembly (clang, -O0):
<f8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
sub    $0x1,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f8>:
mov    %esi,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
and    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @f8(i32 %0, i32 %1) {
%3 = shl nsw i32 -1, %1
%4 = xor i32 %3, -1
%5 = and i32 %4, %0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ inicializarSemilla();
int rand();
int aleatorio(int numeroMax) {
  inicializarSemilla();
  return rand() % (numeroMax + 1);
}


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

x86 assembly (clang, -O2):
<aleatorio>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <inicializarSemilla@plt>
xor    %eax,%eax
call   1040 <rand@plt>
add    $0x1,%ebx
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @aleatorio(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @inicializarSemilla()
%4 = call i32 (...) @rand()
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
%7 = srem i32 %4, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @aleatorio(i32 %0) {
%2 = tail call i32 (...) @inicializarSemilla()
%3 = tail call i32 (...) @rand()
%4 = add nsw i32 %0, 1
%5 = srem i32 %3, %4
ret i32 %5
}
/* Type definitions */
typedef int uid_t;

/* Variables and functions */
uid_t geteuid32(void) { return 15001; }


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

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

LLVM IR (-O0):
define i32 @geteuid32() {
ret i32 15001
}

LLVM IR (-O2):
define i32 @geteuid32() {
ret i32 15001
}
int openHash(char lastname[]) { return (int)lastname[0] - 65; }


x86 assembly (clang, -O0):
<openHash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x41,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<openHash>:
movsbl (%rdi),%eax
add    $0xffffffbf,%eax
ret

LLVM IR (-O0):
define i32 @openHash(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %6, 65
ret i32 %7
}

LLVM IR (-O2):
define i32 @openHash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = add nsw i32 %3, -65
ret i32 %4
}
int f(int z) {
  extern int x;
  extern int y;
  extern int u;
  extern int v;
  static int s;
  register int a;
  int b;
  return x + y + u + v + s;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%eax
mov    0x2ec9(%rip),%rcx
add    (%rcx),%eax
mov    0x2ec8(%rip),%rcx
add    (%rcx),%eax
mov    0x2e9f(%rip),%rcx
add    (%rcx),%eax
add    0x2ef3(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    0x2ec9(%rip),%rcx
mov    0x2ed2(%rip),%rax
mov    (%rax),%eax
add    (%rcx),%eax
mov    0x2ecf(%rip),%rcx
add    (%rcx),%eax
mov    0x2ea6(%rip),%rcx
add    (%rcx),%eax
ret

LLVM IR (-O0):
@f.s = internal global i32 0
@x = external global i32
@y = external global i32
@u = external global i32
@v = external global i32
define i32 @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* @x
%6 = load i32, i32* @y
%7 = add nsw i32 %5, %6
%8 = load i32, i32* @u
%9 = add nsw i32 %7, %8
%10 = load i32, i32* @v
%11 = add nsw i32 %9, %10
%12 = load i32, i32* @f.s
%13 = add nsw i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
@x = external global i32
@y = external global i32
@u = external global i32
@v = external global i32
define i32 @f(i32 %0) {
%2 = load i32, i32* @x
%3 = load i32, i32* @y
%4 = add nsw i32 %3, %2
%5 = load i32, i32* @u
%6 = add nsw i32 %4, %5
%7 = load i32, i32* @v
%8 = add nsw i32 %6, %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ isalnum(int);
scalar_t__ isgraph(int);
int ispunct(int c) { return (isgraph(c) && !isalnum(c)); }


x86 assembly (clang, -O0):
<ispunct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <isgraph@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
je     1158 <ispunct+0x38>
mov    -0x4(%rbp),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ispunct>:
push   %rbx
mov    %edi,%ebx
call   1040 <isgraph@plt>
test   %rax,%rax
je     113f <ispunct+0x1f>
mov    %ebx,%edi
call   1030 <isalnum@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ispunct(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @isgraph(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @isalnum(i32 %7)
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
br label %11
11: ; preds = %6, %1
%12 = phi i1 [ false, %1 ], [ %10, %6 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @ispunct(i32 %0) {
%2 = tail call i64 @isgraph(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @isalnum(i32 %0)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ area(int, float *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  float ar;
  int radius;
  printf("Enter radius: ");
  scanf("%d", &radius);
  area(radius, &ar);
  printf("Area= %.2f\n", ar);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
lea    -0x4(%rbp),%rsi
call   1040 <area@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea0(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%edi
lea    0x4(%rsp),%rsi
call   1040 <area@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Enter radius: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"Area= %.2f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = call i32 @area(i32 %5, float* %1)
%7 = load float, float* %1
%8 = fpext float %7 to double
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), double %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Enter radius: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"Area= %.2f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca i32
%3 = bitcast float* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = call i32 @area(i32 %7, float* %1)
%9 = load float, float* %1
%10 = fpext float %9 to double
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), double %10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ mesg(char *);
void skip(int direction) {
  if (direction > 0)
    mesg(("...skipping forward\n"));
  else
    mesg(("...skipping backward\n"));
}


x86 assembly (clang, -O0):
<skip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1136 <skip+0x26>
lea    0xed4(%rip),%rdi
call   1030 <mesg@plt>
jmp    1142 <skip+0x32>
lea    0xed8(%rip),%rdi
call   1030 <mesg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip>:
test   %edi,%edi
lea    0xee7(%rip),%rax
lea    0xef5(%rip),%rdi
cmovg  %rax,%rdi
jmp    1030 <mesg@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"...skipping forward\0A\00"
@.str.1 = [22 x i8] c"...skipping backward\0A\00"
define void @skip(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @mesg(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %9
7: ; preds = %1
%8 = call i32 @mesg(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"...skipping forward\0A\00"
@.str.1 = [22 x i8] c"...skipping backward\0A\00"
define void @skip(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0)
%4 = tail call i32 @mesg(i8* %3)
ret void
}
/* Type definitions */
typedef scalar_t__ int64_t;

/* Variables and functions */
int64_t __attribute__((const)) lw6sys_llmin(int64_t a, int64_t b) {
  return (a < b) ? a : b;
}


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

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

LLVM IR (-O0):
define i64 @lw6sys_llmin(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 @lw6sys_llmin(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
scalar_t__ malloc(int);
int *make1DArray(int LENGTH) {
  int *longArray = (int *)malloc(LENGTH * sizeof(int));
  int i;
  for (i = 0; i < LENGTH; i++) {
    longArray[i] = -1;
  }
  return longArray;
}


x86 assembly (clang, -O0):
<make1DArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115e <make1DArray+0x4e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1135 <make1DArray+0x25>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make1DArray>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x0(,%rbx,4),%edi
call   1040 <malloc@plt>
mov    %rax,%r14
test   %ebx,%ebx
jle    114c <make1DArray+0x2c>
mov    %ebx,%edx
shl    $0x2,%rdx
mov    %r14,%rdi
mov    $0xff,%esi
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32* @make1DArray(i32 %0) {
%2 = shl i32 %0, 2
%3 = tail call i64 @malloc(i32 %2)
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = inttoptr i64 %3 to i8*
%7 = zext i32 %0 to i64
%8 = shl nuw nsw i64 %7, 2
br label %9
9: ; preds = %5, %1
%10 = inttoptr i64 %3 to i32*
ret i32* %10
}
/* Variables and functions */
int /*<<< orphan*/ CTEST_ERR(char *, char const *, int, long, long);
void assert_equal(long exp, long real, const char *caller, int line) {
  if (exp != real) {
    CTEST_ERR("%s:%d  expected %ld, got %ld", caller, line, exp, real);
  }
}


x86 assembly (clang, -O0):
<assert_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     1150 <assert_equal+0x40>
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xeb5(%rip),%rdi
call   1030 <CTEST_ERR@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_equal>:
cmp    %rsi,%rdi
jne    1116 <assert_equal+0x6>
ret
mov    %rsi,%r8
mov    %rdi,%rax
lea    0xedd(%rip),%rdi
mov    %rdx,%rsi
mov    %ecx,%edx
mov    %rax,%rcx
jmp    1030 <CTEST_ERR@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"%s:%d expected %ld, got %ld\00"
define void @assert_equal(i64 %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
store i64 %0, i64* %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i64, i64* %5
%10 = load i64, i64* %6
%11 = icmp ne i64 %9, %10
br i1 %11, label %12, label %18
12: ; preds = %4
%13 = load i8*, i8** %7
%14 = load i32, i32* %8
%15 = load i64, i64* %5
%16 = load i64, i64* %6
%17 = call i32 @CTEST_ERR(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %14, i64 %15, i64 %16)
br label %18
18: ; preds = %12, %4
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"%s:%d expected %ld, got %ld\00"
define void @assert_equal(i64 %0, i64 %1, i8* %2, i32 %3) {
%5 = icmp eq i64 %0, %1
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @CTEST_ERR(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %3, i64 %0, i64 %1)
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void show_usage(const char *pro_name) {
  fprintf(stderr,
          "Usage: %s [Options] [inputfile]\n"
          "\n"
          "Options:\n"
          "        -v show more info\n"
          "        -h show this help\n"
          "\n",
          pro_name);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [96 x i8] c"Usage: %s [Options] [inputfile]\0A\0AOptions:\0A -v show more info\0A -h show this help\0A\0A\00"
define void @show_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [96 x i8] c"Usage: %s [Options] [inputfile]\0A\0AOptions:\0A -v show more info\0A -h show this help\0A\0A\00"
define void @show_usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ WARN_ON(int);
void radix__flush_all_lpid_guest(unsigned int lpid) { WARN_ON(1); }


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

x86 assembly (clang, -O2):
<radix__flush_all_lpid_guest>:
mov    $0x1,%edi
jmp    1030 <WARN_ON@plt>

LLVM IR (-O0):
define void @radix__flush_all_lpid_guest(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @WARN_ON(i32 1)
ret void
}

LLVM IR (-O2):
define void @radix__flush_all_lpid_guest(i32 %0) {
%2 = tail call i32 @WARN_ON(i32 1)
ret void
}
/* Variables and functions */
int rmdir(char const *);
int lace_compat_file_rmdir(const char *dirpath) { return rmdir(dirpath); }


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

x86 assembly (clang, -O2):
<lace_compat_file_rmdir>:
jmp    1030 <rmdir@plt>

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

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


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

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

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

LLVM IR (-O2):
define void @gtk_notebook_insert_page() {
ret void
}
void xml_deinit(void) {}


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

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

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

LLVM IR (-O2):
define void @xml_deinit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cosh(double);
int /*<<< orphan*/ coshf(float);
int /*<<< orphan*/ coshl(long double);
void uninitvar_cosh(void) {
  float f;
  (void)coshf(f);
  double d;
  (void)cosh(d);
  long double ld;
  (void)coshl(ld);
}


x86 assembly (clang, -O0):
<uninitvar_cosh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  -0x4(%rbp),%xmm0
call   1040 <coshf@plt>
movsd  -0x10(%rbp),%xmm0
call   1050 <cosh@plt>
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <coshl@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uninitvar_cosh>:
sub    $0x18,%rsp
call   1040 <coshf@plt>
call   1050 <cosh@plt>
call   1030 <coshl@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @uninitvar_cosh() {
%1 = alloca float
%2 = alloca double
%3 = alloca x86_fp80
%4 = load float, float* %1
%5 = call i32 @coshf(float %4)
%6 = load double, double* %2
%7 = call i32 @cosh(double %6)
%8 = load x86_fp80, x86_fp80* %3
%9 = call i32 @coshl(x86_fp80 %8)
ret void
}

LLVM IR (-O2):
define void @uninitvar_cosh() {
%1 = tail call i32 @coshf(float undef)
%2 = tail call i32 @cosh(double undef)
%3 = tail call i32 @coshl(x86_fp80 undef)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void *alloca(int);
int memcmp(void *, void *, int);
int /*<<< orphan*/ physmemcpy(void *, int /*<<< orphan*/, int);
int physmemcmp(void *dest, uint32_t src, int len) {
  void *buf;
  buf = alloca(len);
  physmemcpy(buf, src, len);
  return memcmp(dest, buf, len);
}


x86 assembly (clang, -O0):
<physmemcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1050 <alloca@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <physmemcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%edx
call   1040 <memcmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<physmemcmp>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%r15d
mov    %rdi,%r14
mov    %edx,%edi
call   1050 <alloca@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %r15d,%esi
mov    %ebx,%edx
call   1030 <physmemcpy@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <memcmp@plt>

LLVM IR (-O0):
define i32 @physmemcmp(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = call i8* @alloca(i32 %8)
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = call i32 @physmemcpy(i8* %10, i32 %11, i32 %12)
%14 = load i8*, i8** %4
%15 = load i8*, i8** %7
%16 = load i32, i32* %6
%17 = call i32 @memcmp(i8* %14, i8* %15, i32 %16)
ret i32 %17
}

LLVM IR (-O2):
define i32 @physmemcmp(i8* %0, i32 %1, i32 %2) {
%4 = tail call i8* @alloca(i32 %2)
%5 = tail call i32 @physmemcpy(i8* %4, i32 %1, i32 %2)
%6 = tail call i32 @memcmp(i8* %0, i8* %4, i32 %2)
ret i32 %6
}
void WIN32_SetServiceCommandLine(void) {}


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

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

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

LLVM IR (-O2):
define void @WIN32_SetServiceCommandLine() {
ret void
}
int main(void) {
  int i = 10, n = 0;
  while (i) {
    n = n + i;
    i = i - 1;
  }
  return n;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     113a <main+0x3a>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1119 <main+0x19>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 55
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_dvector(double *V, long n0, long N) { free((char *)(V + n0 - 1)); }


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

x86 assembly (clang, -O2):
<free_dvector>:
lea    (%rdi,%rsi,8),%rdi
add    $0xfffffffffffffff8,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_dvector(double* %0, i64 %1, i64 %2) {
%4 = alloca double*
%5 = alloca i64
%6 = alloca i64
store double* %0, double** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load double*, double** %4
%8 = load i64, i64* %5
%9 = getelementptr inbounds double, double* %7, i64 %8
%10 = getelementptr inbounds double, double* %9, i64 -1
%11 = bitcast double* %10 to i8*
%12 = call i32 @free(i8* %11)
ret void
}

LLVM IR (-O2):
define void @free_dvector(double* nocapture %0, i64 %1, i64 %2) {
%4 = getelementptr inbounds double, double* %0, i64 %1
%5 = getelementptr inbounds double, double* %4, i64 -1
%6 = bitcast double* %5 to i8*
%7 = tail call i32 @free(i8* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putc(unsigned char);
unsigned char serial_recv_byte(int);
unsigned char getc(void) {
  unsigned char c = serial_recv_byte(1);
  c = (c == '\r') ? '\n' : c;
  putc(c);
  return c;
}


x86 assembly (clang, -O0):
<getc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1040 <serial_recv_byte@plt>
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0xd,%eax
jne    114f <getc+0x2f>
mov    $0xa,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <getc+0x36>
movzbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <putc@plt>
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getc>:
push   %rbx
mov    $0x1,%edi
call   1040 <serial_recv_byte@plt>
cmp    $0xd,%al
movzbl %al,%eax
mov    $0xa,%ecx
cmovne %eax,%ecx
movzbl %cl,%ebx
mov    %ebx,%edi
call   1030 <putc@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i8 @getc() {
%1 = alloca i8
%2 = call zeroext i8 @serial_recv_byte(i32 1)
store i8 %2, i8* %1
%3 = load i8, i8* %1
%4 = zext i8 %3 to i32
%5 = icmp eq i32 %4, 13
br i1 %5, label %6, label %7
6: ; preds = %0
br label %10
7: ; preds = %0
%8 = load i8, i8* %1
%9 = zext i8 %8 to i32
br label %10
10: ; preds = %7, %6
%11 = phi i32 [ 10, %6 ], [ %9, %7 ]
%12 = trunc i32 %11 to i8
store i8 %12, i8* %1
%13 = load i8, i8* %1
%14 = call i32 @putc(i8 zeroext %13)
%15 = load i8, i8* %1
ret i8 %15
}

LLVM IR (-O2):
define zeroext i8 @getc() {
%1 = tail call zeroext i8 @serial_recv_byte(i32 1)
%2 = icmp eq i8 %1, 13
%3 = select i1 %2, i8 10, i8 %1
%4 = tail call i32 @putc(i8 zeroext %3)
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ Lcd4_Cmd(int);
void Lcd4_Shift_Left() {
  Lcd4_Cmd(0x01);
  Lcd4_Cmd(0x08);
}


x86 assembly (clang, -O0):
<Lcd4_Shift_Left>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <Lcd4_Cmd@plt>
mov    $0x8,%edi
call   1030 <Lcd4_Cmd@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Lcd4_Shift_Left>:
push   %rax
mov    $0x1,%edi
call   1030 <Lcd4_Cmd@plt>
mov    $0x8,%edi
pop    %rax
jmp    1030 <Lcd4_Cmd@plt>

LLVM IR (-O0):
define void @Lcd4_Shift_Left() {
%1 = call i32 @Lcd4_Cmd(i32 1)
%2 = call i32 @Lcd4_Cmd(i32 8)
ret void
}

LLVM IR (-O2):
define void @Lcd4_Shift_Left() {
%1 = tail call i32 @Lcd4_Cmd(i32 1)
%2 = tail call i32 @Lcd4_Cmd(i32 8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ finish();
GS_FINISH() { finish(); }


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

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

LLVM IR (-O0):
define i32 @GS_FINISH() {
%1 = alloca i32
%2 = call i32 (...) @finish()
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @GS_FINISH() {
%1 = tail call i32 (...) @finish()
ret i32 undef
}
__attribute__((weak)) void ADCC1_IrqHandler(void) {
  while (1)
    ;
}


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

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

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

LLVM IR (-O2):
define weak void @ADCC1_IrqHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
uint32_t FP32_MAKE(bool sign, int exp, uint32_t fract) {
  assert(exp >= 0 && exp <= 0xff);
  assert(fract < 0x800000);
  return sign << 31 | exp << 23 | fract;
}


x86 assembly (clang, -O0):
<FP32_MAKE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
jl     113d <FP32_MAKE+0x2d>
cmpl   $0xff,-0x8(%rbp)
setle  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x800000,-0xc(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
shl    $0x1f,%eax
mov    -0x8(%rbp),%ecx
shl    $0x17,%ecx
or     %ecx,%eax
or     -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FP32_MAKE>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x100,%esi
setb   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmp    $0x800000,%r14d
setl   %dil
call   1030 <assert@plt>
shl    $0x1f,%ebx
shl    $0x17,%ebp
or     %ebx,%ebp
or     %r14d,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @FP32_MAKE(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = icmp sge i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = load i32, i32* %5
%11 = icmp sle i32 %10, 255
br label %12
12: ; preds = %9, %3
%13 = phi i1 [ false, %3 ], [ %11, %9 ]
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 8388608
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load i32, i32* %4
%21 = shl i32 %20, 31
%22 = load i32, i32* %5
%23 = shl i32 %22, 23
%24 = or i32 %21, %23
%25 = load i32, i32* %6
%26 = or i32 %24, %25
ret i32 %26
}

LLVM IR (-O2):
define i32 @FP32_MAKE(i32 %0, i32 %1, i32 %2) {
%4 = icmp ult i32 %1, 256
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = icmp slt i32 %2, 8388608
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = shl i32 %0, 31
%11 = shl i32 %1, 23
%12 = or i32 %11, %10
%13 = or i32 %12, %2
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ TimerIntClear(int, int);
void wave_interrupt_clean(void) { TimerIntClear(0x40031000, 0x00000001); }


x86 assembly (clang, -O0):
<wave_interrupt_clean>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40031000,%edi
mov    $0x1,%esi
call   1030 <TimerIntClear@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<wave_interrupt_clean>:
mov    $0x40031000,%edi
mov    $0x1,%esi
jmp    1030 <TimerIntClear@plt>

LLVM IR (-O0):
define void @wave_interrupt_clean() {
%1 = call i32 @TimerIntClear(i32 1073942528, i32 1)
ret void
}

LLVM IR (-O2):
define void @wave_interrupt_clean() {
%1 = tail call i32 @TimerIntClear(i32 1073942528, i32 1)
ret void
}