#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ check_prime(int);
int /*<<< orphan*/ printf(char *, int);
void print_prime(int n1, int n2) {
  int i;
  if ((n2 >= n1) && (n1 > 0)) {
    for (i = n1; i <= n2; i++) {
      if (check_prime(i))
        printf("%d ", i);
    }
  } else
    return;
}


x86 assembly (clang, -O0):
<print_prime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jl     118f <print_prime+0x6f>
cmpl   $0x0,-0x4(%rbp)
jle    118f <print_prime+0x6f>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     118a <print_prime+0x6a>
mov    -0xc(%rbp),%edi
call   1030 <check_prime@plt>
cmp    $0x0,%rax
je     1177 <print_prime+0x57>
mov    -0xc(%rbp),%esi
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
jmp    117c <print_prime+0x5c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114a <print_prime+0x2a>
jmp    1194 <print_prime+0x74>
jmp    1194 <print_prime+0x74>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_prime>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
jle    115f <print_prime+0x3f>
mov    %esi,%ebx
mov    %edi,%ebp
cmp    %edi,%esi
jl     115f <print_prime+0x3f>
add    $0x1,%ebx
lea    0xec6(%rip),%r14
jmp    1147 <print_prime+0x27>
nopl   0x0(%rax)
add    $0x1,%ebp
cmp    %ebp,%ebx
je     115f <print_prime+0x3f>
mov    %ebp,%edi
call   1030 <check_prime@plt>
test   %rax,%rax
je     1140 <print_prime+0x20>
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
jmp    1140 <print_prime+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define void @print_prime(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = icmp sge i32 %6, %7
br i1 %8, label %9, label %30
9: ; preds = %2
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %30
12: ; preds = %9
%13 = load i32, i32* %3
store i32 %13, i32* %5
br label %14
14: ; preds = %26, %12
%15 = load i32, i32* %5
%16 = load i32, i32* %4
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %29
18: ; preds = %14
%19 = load i32, i32* %5
%20 = call i64 @check_prime(i32 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load i32, i32* %5
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %22, %18
br label %26
26: ; preds = %25
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %14
29: ; preds = %14
br label %31
30: ; preds = %9, %2
br label %31
31: ; preds = %30, %29
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @print_prime(i32 %0, i32 %1) {
%3 = icmp sge i32 %1, %0
%4 = icmp sgt i32 %0, 0
%5 = and i1 %4, %3
br i1 %5, label %6, label %15
6: ; preds = %2, %12
%7 = phi i32 [ %13, %12 ], [ %0, %2 ]
%8 = tail call i64 @check_prime(i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %12
12: ; preds = %6, %10
%13 = add i32 %7, 1
%14 = icmp eq i32 %7, %1
br i1 %14, label %15, label %6
15: ; preds = %12, %2
ret void
}