#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 ePrimo(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int first, last, i, count = 0;
  puts("Informe inicio do intervalo");
  scanf("%d", &first);
  puts("Informe fim do intervalo");
  scanf("%d", &last);
  for (i = first; i < last + 1; i++) {
    if (ePrimo(i)) {
      printf("%d e primo\n", ePrimo(i));
      count++;
    }
  }
  printf("no total foram %d primos", count);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
lea    0xe97(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11e8 <main+0xa8>
mov    -0x10(%rbp),%edi
call   1040 <ePrimo@plt>
cmp    $0x0,%eax
je     11d5 <main+0x95>
mov    -0x10(%rbp),%edi
call   1040 <ePrimo@plt>
mov    %eax,%esi
lea    0xe71(%rip),%rdi
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11da <main+0x9a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1194 <main+0x54>
mov    -0x14(%rbp),%esi
lea    0xe52(%rip),%rdi
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <puts@plt>
lea    0xec1(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    0xc(%rsp),%ebx
xor    %ebp,%ebp
cmp    0x8(%rsp),%ebx
jle    11a6 <main+0x66>
lea    0xeb0(%rip),%rdi
mov    %ebp,%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %ebp,%ebp
lea    0xe89(%rip),%r14
jmp    11cb <main+0x8b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0x1(%rbx),%eax
cmp    0x8(%rsp),%ebx
mov    %eax,%ebx
jge    118d <main+0x4d>
mov    %ebx,%edi
call   1040 <ePrimo@plt>
test   %eax,%eax
je     11c0 <main+0x80>
mov    %ebx,%edi
call   1040 <ePrimo@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
add    $0x1,%ebp
jmp    11c0 <main+0x80>

LLVM IR (-O0):
@.str = [28 x i8] c"Informe inicio do intervalo\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"Informe fim do intervalo\00"
@.str.3 = [12 x i8] c"%d e primo\0A\00"
@.str.4 = [25 x i8] c"no total foram %d primos\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
%6 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %2
store i32 %10, i32* %4
br label %11
11: ; preds = %27, %0
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
%15 = icmp slt i32 %12, %14
br i1 %15, label %16, label %30
16: ; preds = %11
%17 = load i32, i32* %4
%18 = call i32 @ePrimo(i32 %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %16
%21 = load i32, i32* %4
%22 = call i32 @ePrimo(i32 %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %26
26: ; preds = %20, %16
br label %27
27: ; preds = %26
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %11
30: ; preds = %11
%31 = load i32, i32* %5
%32 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
@.str = [28 x i8] c"Informe inicio do intervalo\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"Informe fim do intervalo\00"
@.str.3 = [12 x i8] c"%d e primo\0A\00"
@.str.4 = [25 x i8] c"no total foram %d primos\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 ([28 x i8], [28 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* %1)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = icmp sgt i32 %9, %10
br i1 %11, label %26, label %12
12: ; preds = %0, %21
%13 = phi i32 [ %22, %21 ], [ 0, %0 ]
%14 = phi i32 [ %23, %21 ], [ %9, %0 ]
%15 = call i32 @ePrimo(i32 %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %12
%18 = call i32 @ePrimo(i32 %14)
%19 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = add nsw i32 %13, 1
br label %21
21: ; preds = %12, %17
%22 = phi i32 [ %20, %17 ], [ %13, %12 ]
%23 = add nsw i32 %14, 1
%24 = load i32, i32* %2
%25 = icmp slt i32 %14, %24
br i1 %25, label %12, label %26
26: ; preds = %21, %0
%27 = phi i32 [ 0, %0 ], [ %22, %21 ]
%28 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %27)
ret i32 0
}