#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__ fnCheckPrime(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(void) {
  int iVal1, iVal2, i;
  printf("\nEnter the range\n");
  scanf("%d%d", &iVal1, &iVal2);
  printf("\nPrime numbers in the range %d to %d is\n", iVal1, iVal2);
  for (i = iVal1; i <= iVal2; i++) {
    if (fnCheckPrime(i))
      printf("%d\t", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11bd <main+0x8d>
mov    -0x10(%rbp),%edi
call   1030 <fnCheckPrime@plt>
cmp    $0x0,%rax
je     11aa <main+0x7a>
mov    -0x10(%rbp),%esi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11af <main+0x7f>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117b <main+0x4b>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee7(%rip),%rdi
call   1040 <puts@plt>
lea    0xea9(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1060 <scanf@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xe93(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%ebx
cmp    (%rsp),%ebx
jle    118c <main+0x4c>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe9b(%rip),%r14
jmp    11aa <main+0x6a>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x1(%rbx),%eax
cmp    (%rsp),%ebx
mov    %eax,%ebx
jge    1182 <main+0x42>
mov    %ebx,%edi
call   1030 <fnCheckPrime@plt>
test   %rax,%rax
je     11a0 <main+0x60>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11a0 <main+0x60>

LLVM IR (-O0):
@.str = [18 x i8] c"\0AEnter the range\0A\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [41 x i8] c"\0APrime numbers in the range %d to %d is\0A\00"
@.str.3 = [4 x i8] c"%d\09\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8)
%10 = load i32, i32* %2
store i32 %10, i32* %4
br label %11
11: ; preds = %23, %0
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %26
15: ; preds = %11
%16 = load i32, i32* %4
%17 = call i64 @fnCheckPrime(i32 %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i32, i32* %4
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %19, %15
br label %23
23: ; preds = %22
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %11
26: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [41 x i8] c"\0APrime numbers in the range %d to %d is\0A\00"
@.str.3 = [4 x i8] c"%d\09\00"
@str = [17 x i8] c"\0AEnter the range\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 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = icmp sgt i32 %10, %11
br i1 %12, label %23, label %13
13: ; preds = %0, %19
%14 = phi i32 [ %20, %19 ], [ %10, %0 ]
%15 = call i64 @fnCheckPrime(i32 %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %14)
br label %19
19: ; preds = %13, %17
%20 = add nsw i32 %14, 1
%21 = load i32, i32* %2
%22 = icmp slt i32 %14, %21
br i1 %22, label %13, label %23
23: ; preds = %19, %0
ret i32 0
}