#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 */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int sqrt(int);
int main() {
  int a, b, i;
  printf("Enter two numbers (a, b) b > a:\n");
  scanf("%d %d", &a, &b);
  for (i = a; i <= b; i++) {
    int j, isPrime = 1;
    for (j = 2; j <= sqrt(i); j++)
      if (i % j == 0)
        isPrime = 0;
    if (isPrime)
      printf("%3d", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11f4 <main+0xc4>
movl   $0x1,-0x18(%rbp)
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%edi
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jg     11c6 <main+0x96>
mov    -0x10(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%edx
jne    11b3 <main+0x83>
movl   $0x0,-0x18(%rbp)
jmp    11b8 <main+0x88>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1181 <main+0x51>
cmpl   $0x0,-0x18(%rbp)
je     11e1 <main+0xb1>
mov    -0x10(%rbp),%esi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e6 <main+0xb6>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1167 <main+0x37>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
lea    0xea6(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    0x4(%rsp),%r15d
cmp    (%rsp),%r15d
jle    117f <main+0x3f>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe80(%rip),%r14
jmp    11aa <main+0x6a>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1(%r15),%eax
cmp    (%rsp),%r15d
mov    %eax,%r15d
jge    1172 <main+0x32>
mov    %r15d,%edi
call   1060 <sqrt@plt>
cmp    $0x2,%eax
jl     1190 <main+0x50>
mov    $0x1,%ebp
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    %r15d,%eax
cltd
idiv   %ebp
test   %edx,%edx
cmove  %edx,%ebx
mov    %r15d,%edi
call   1060 <sqrt@plt>
cmp    %eax,%ebp
jl     11d0 <main+0x90>
test   %ebx,%ebx
jne    1190 <main+0x50>
jmp    119d <main+0x5d>

LLVM IR (-O0):
@.str = [33 x i8] c"Enter two numbers (a, b) b > a:\0A\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [4 x i8] c"%3d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%9 = load i32, i32* %2
store i32 %9, i32* %4
br label %10
10: ; preds = %37, %0
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %40
14: ; preds = %10
store i32 1, i32* %6
store i32 2, i32* %5
br label %15
15: ; preds = %27, %14
%16 = load i32, i32* %5
%17 = load i32, i32* %4
%18 = call i32 @sqrt(i32 %17)
%19 = icmp sle i32 %16, %18
br i1 %19, label %20, label %30
20: ; preds = %15
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = srem i32 %21, %22
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %20
store i32 0, i32* %6
br label %26
26: ; preds = %25, %20
br label %27
27: ; preds = %26
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %15
30: ; preds = %15
%31 = load i32, i32* %6
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i32, i32* %4
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %33, %30
br label %37
37: ; preds = %36
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %10
40: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [4 x i8] c"%3d\00"
@str = [32 x i8] c"Enter two numbers (a, b) b > a:\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 ([32 x i8], [32 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 = icmp sgt i32 %7, %8
br i1 %9, label %31, label %10
10: ; preds = %0, %27
%11 = phi i32 [ %28, %27 ], [ %7, %0 ]
%12 = call i32 @sqrt(i32 %11)
%13 = icmp slt i32 %12, 2
br i1 %13, label %25, label %14
14: ; preds = %10, %14
%15 = phi i32 [ %19, %14 ], [ 1, %10 ]
%16 = phi i32 [ %20, %14 ], [ 2, %10 ]
%17 = srem i32 %11, %16
%18 = icmp eq i32 %17, 0
%19 = select i1 %18, i32 0, i32 %15
%20 = add nuw nsw i32 %16, 1
%21 = call i32 @sqrt(i32 %11)
%22 = icmp slt i32 %16, %21
br i1 %22, label %14, label %23
23: ; preds = %14
%24 = icmp eq i32 %19, 0
br i1 %24, label %27, label %25
25: ; preds = %10, %23
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %11)
br label %27
27: ; preds = %25, %23
%28 = add nsw i32 %11, 1
%29 = load i32, i32* %2
%30 = icmp slt i32 %11, %29
br i1 %30, label %10, label %31
31: ; preds = %27, %0
ret i32 0
}