#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int num, div, copia;
  int resultado, resto;
  printf("Introduzca un numero entero mayor que 1: ");
  scanf("%d", &num);
  0;
  while (0) {
    printf("Introduzca un numero entero mayor que 1: ");
    scanf("%d", &num);
    if (num <= 1) {
      printf("\nEl numero ha de ser mayor que 1.");
    } else {
      if (num == 2) {
        printf("\nEl numero es primo y acabamos.");
        1;
      } else {
        div = num - 1;
        resto = num % div;
        while (div >= 2 && resto == 0) {
          div = div - 1;
        }
        if (div == 1) {
          1;
          printf("\nEl numero es primo.");
        } else
          printf("\nEl numero no es primo y continua.");
      }
    }
    div = 2;
    copia = num;
    printf(" %d = 1", num);
    resultado = copia % div;
    while (copia != 1) {
      if (resultado == 0) {
        printf(" * %d ", div);
        copia = copia / div;
      } else
        div++;
    }
    if (num == div) {
      1;
      printf("\nEl numero es primo y acaba.");
    } else
      printf("\nEl numero no es primo y continua.");
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
xor    %eax,%eax
test   $0x1,%al
jne    1163 <main+0x43>
jmp    12d6 <main+0x1b6>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb2(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
jg     119e <main+0x7e>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123a <main+0x11a>
cmpl   $0x2,-0x14(%rbp)
jne    11bb <main+0x9b>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1235 <main+0x115>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %edx,-0x24(%rbp)
xor    %eax,%eax
cmpl   $0x2,-0x18(%rbp)
mov    %al,-0x25(%rbp)
jl     11e7 <main+0xc7>
cmpl   $0x0,-0x24(%rbp)
sete   %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    11f7 <main+0xd7>
jmp    1205 <main+0xe5>
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ce <main+0xae>
cmpl   $0x1,-0x18(%rbp)
jne    1222 <main+0x102>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1230 <main+0x110>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1235 <main+0x115>
jmp    123a <main+0x11a>
movl   $0x2,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %edx,-0x20(%rbp)
cmpl   $0x1,-0x1c(%rbp)
je     12a4 <main+0x184>
cmpl   $0x0,-0x20(%rbp)
jne    1296 <main+0x176>
mov    -0x18(%rbp),%esi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %eax,-0x1c(%rbp)
jmp    129f <main+0x17f>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1262 <main+0x142>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    12c3 <main+0x1a3>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d1 <main+0x1b1>
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1154 <main+0x34>
mov    0x2d03(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Introduzca un numero entero mayor que 1: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [34 x i8] c"\0AEl numero ha de ser mayor que 1.\00"
@.str.3 = [32 x i8] c"\0AEl numero es primo y acabamos.\00"
@.str.4 = [21 x i8] c"\0AEl numero es primo.\00"
@.str.5 = [35 x i8] c"\0AEl numero no es primo y continua.\00"
@.str.6 = [8 x i8] c" %d = 1\00"
@.str.7 = [7 x i8] c" * %d \00"
@.str.8 = [29 x i8] c"\0AEl numero es primo y acaba.\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
br label %13
13: ; preds = %83, %2
br i1 false, label %14, label %84
14: ; preds = %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%17 = load i32, i32* %6
%18 = icmp sle i32 %17, 1
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %52
21: ; preds = %14
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, 2
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
br label %51
26: ; preds = %21
%27 = load i32, i32* %6
%28 = sub nsw i32 %27, 1
store i32 %28, i32* %7
%29 = load i32, i32* %6
%30 = load i32, i32* %7
%31 = srem i32 %29, %30
store i32 %31, i32* %10
br label %32
32: ; preds = %40, %26
%33 = load i32, i32* %7
%34 = icmp sge i32 %33, 2
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* %10
%37 = icmp eq i32 %36, 0
br label %38
38: ; preds = %35, %32
%39 = phi i1 [ false, %32 ], [ %37, %35 ]
br i1 %39, label %40, label %43
40: ; preds = %38
%41 = load i32, i32* %7
%42 = sub nsw i32 %41, 1
store i32 %42, i32* %7
br label %32
43: ; preds = %38
%44 = load i32, i32* %7
%45 = icmp eq i32 %44, 1
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %50
48: ; preds = %43
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
br label %50
50: ; preds = %48, %46
br label %51
51: ; preds = %50, %24
br label %52
52: ; preds = %51, %19
store i32 2, i32* %7
%53 = load i32, i32* %6
store i32 %53, i32* %8
%54 = load i32, i32* %6
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 %54)
%56 = load i32, i32* %8
%57 = load i32, i32* %7
%58 = srem i32 %56, %57
store i32 %58, i32* %9
br label %59
59: ; preds = %74, %52
%60 = load i32, i32* %8
%61 = icmp ne i32 %60, 1
br i1 %61, label %62, label %75
62: ; preds = %59
%63 = load i32, i32* %9
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %71
65: ; preds = %62
%66 = load i32, i32* %7
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 %66)
%68 = load i32, i32* %8
%69 = load i32, i32* %7
%70 = sdiv i32 %68, %69
store i32 %70, i32* %8
br label %74
71: ; preds = %62
%72 = load i32, i32* %7
%73 = add nsw i32 %72, 1
store i32 %73, i32* %7
br label %74
74: ; preds = %71, %65
br label %59
75: ; preds = %59
%76 = load i32, i32* %6
%77 = load i32, i32* %7
%78 = icmp eq i32 %76, %77
br i1 %78, label %79, label %81
79: ; preds = %75
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0))
br label %83
81: ; preds = %75
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
br label %83
83: ; preds = %81, %79
br label %13
84: ; preds = %13
%85 = load i32, i32* @EXIT_SUCCESS
ret i32 %85
}

LLVM IR (-O2):
@.str = [42 x i8] c"Introduzca un numero entero mayor que 1: \00"
@.str.1 = [3 x i8] c"%d\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 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* %3)
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}