#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 main() {
  int num1, num2, i, j;
  char op;
  do {
    printf("\nInforme um numero: ");
    scanf("%i", &num1);
    printf("\nInforme um numero: ");
    scanf("%i", &num2);
    for (i = num1; i <= num2; i++) {
      for (j = 2; j < i; j++)
        if (i % j == 0)
          break;
      if (i == j)
        printf("\n%i - Primos!", i);
      else
        printf("\n%i - Nao primos!", i);
    }
    printf("\nDeseja calcular outra sequencia de numeros? ");
    scanf("%s", &op);
  } while (op == 's' || op == 'S');
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1202 <main+0xe2>
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11bc <main+0x9c>
mov    -0x10(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%edx
jne    11a9 <main+0x89>
jmp    11bc <main+0x9c>
jmp    11ae <main+0x8e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1188 <main+0x68>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    11de <main+0xbe>
mov    -0x10(%rbp),%esi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ef <main+0xcf>
mov    -0x10(%rbp),%esi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f4 <main+0xd4>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1175 <main+0x55>
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe4f(%rip),%rdi
lea    -0x15(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x15(%rbp),%ecx
mov    $0x1,%al
cmp    $0x73,%ecx
mov    %al,-0x16(%rbp)
je     1241 <main+0x121>
movsbl -0x15(%rbp),%eax
cmp    $0x53,%eax
sete   %al
mov    %al,-0x16(%rbp)
mov    -0x16(%rbp),%al
test   $0x1,%al
jne    112f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecb(%rip),%r14
lea    0xed9(%rip),%rbx
lea    0xf(%rsp),%r15
lea    0xed0(%rip),%r13
lea    0xed7(%rip),%rbp
jmp    118d <main+0x6d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xed1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xf(%rsp),%al
and    $0xdf,%al
cmp    $0x53,%al
jne    1227 <main+0x107>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x14(%rsp),%r12d
cmp    0x10(%rsp),%r12d
jle    11f7 <main+0xd7>
jmp    1160 <main+0x40>
nopl   (%rax)
cmp    %ecx,%r12d
mov    %rbp,%rdi
cmove  %r13,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x1(%r12),%eax
cmp    0x10(%rsp),%r12d
mov    %eax,%r12d
jge    1160 <main+0x40>
mov    $0x2,%ecx
cmp    $0x3,%r12d
jl     11d0 <main+0xb0>
mov    $0x2,%ecx
nopw   0x0(%rax,%rax,1)
mov    %r12d,%eax
cltd
idiv   %ecx
test   %edx,%edx
je     11d0 <main+0xb0>
add    $0x1,%ecx
cmp    %ecx,%r12d
jne    1210 <main+0xf0>
mov    %r12d,%ecx
jmp    11d0 <main+0xb0>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"\0AInforme um numero: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [14 x i8] c"\0A%i - Primos!\00"
@.str.3 = [18 x i8] c"\0A%i - Nao primos!\00"
@.str.4 = [46 x i8] c"\0ADeseja calcular outra sequencia de numeros? \00"
@.str.5 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i32 0, i32* %1
br label %7
7: ; preds = %57, %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %2
store i32 %12, i32* %4
br label %13
13: ; preds = %43, %7
%14 = load i32, i32* %4
%15 = load i32, i32* %3
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %46
17: ; preds = %13
store i32 2, i32* %5
br label %18
18: ; preds = %29, %17
%19 = load i32, i32* %5
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %32
22: ; preds = %18
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = srem i32 %23, %24
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %22
br label %32
28: ; preds = %22
br label %29
29: ; preds = %28
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %18
32: ; preds = %27, %18
%33 = load i32, i32* %4
%34 = load i32, i32* %5
%35 = icmp eq i32 %33, %34
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = load i32, i32* %4
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %37)
br label %42
39: ; preds = %32
%40 = load i32, i32* %4
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %39, %36
br label %43
43: ; preds = %42
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 1
store i32 %45, i32* %4
br label %13
46: ; preds = %13
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
%48 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %6)
br label %49
49: ; preds = %46
%50 = load i8, i8* %6
%51 = sext i8 %50 to i32
%52 = icmp eq i32 %51, 115
br i1 %52, label %57, label %53
53: ; preds = %49
%54 = load i8, i8* %6
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 83
br label %57
57: ; preds = %53, %49
%58 = phi i1 [ true, %49 ], [ %56, %53 ]
br i1 %58, label %7, label %59
59: ; preds = %57
%60 = load i32, i32* %1
ret i32 %60
}

LLVM IR (-O2):
@.str = [21 x i8] c"\0AInforme um numero: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [14 x i8] c"\0A%i - Primos!\00"
@.str.3 = [18 x i8] c"\0A%i - Nao primos!\00"
@.str.4 = [46 x i8] c"\0ADeseja calcular outra sequencia de numeros? \00"
@.str.5 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
br label %6
6: ; preds = %32, %0
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = icmp sgt i32 %11, %12
br i1 %13, label %32, label %14
14: ; preds = %6, %24
%15 = phi i32 [ %29, %24 ], [ %11, %6 ]
%16 = icmp sgt i32 %15, 2
br i1 %16, label %17, label %24
17: ; preds = %14, %21
%18 = phi i32 [ %22, %21 ], [ 2, %14 ]
%19 = srem i32 %15, %18
%20 = icmp eq i32 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %17
%22 = add nuw nsw i32 %18, 1
%23 = icmp eq i32 %22, %15
br i1 %23, label %24, label %17
24: ; preds = %21, %17, %14
%25 = phi i32 [ 2, %14 ], [ %18, %17 ], [ %15, %21 ]
%26 = icmp eq i32 %15, %25
%27 = select i1 %26, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %27, i32 %15)
%29 = add nsw i32 %15, 1
%30 = load i32, i32* %2
%31 = icmp slt i32 %15, %30
br i1 %31, label %14, label %32
32: ; preds = %24, %6
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
%34 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %3)
%35 = load i8, i8* %3
%36 = and i8 %35, -33
%37 = icmp eq i8 %36, 83
br i1 %37, label %6, label %38
38: ; preds = %32
ret i32 0
}