#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;
  printf("Introduce un numero entero mayor que 1: ");
  scanf("%d", &num);
  while (num <= 1) {
    printf("Vuelve a introducir un numero, tiene que ser mayor que 1:\n");
    scanf("%d", &num);
  }
  div = 2;
  printf("%d = 1 ", num);
  while (num != 1) {
    if (num % div == 0) {
      printf("* %d ", div);
      num = num / div;
    } else
      div++;
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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    0xede(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
jg     1181 <main+0x61>
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1154 <main+0x34>
movl   $0x2,-0x18(%rbp)
mov    -0x14(%rbp),%esi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x14(%rbp)
je     11e1 <main+0xc1>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x18(%rbp)
cmp    $0x0,%edx
jne    11d3 <main+0xb3>
mov    -0x18(%rbp),%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %eax,-0x14(%rbp)
jmp    11dc <main+0xbc>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1199 <main+0x79>
mov    0x2df8(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedb(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0x1,%esi
jg     119c <main+0x6c>
lea    0xed2(%rip),%r14
lea    0xeba(%rip),%r15
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0x2,%esi
jl     1180 <main+0x50>
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%ecx
cmp    $0x1,%ecx
je     11ff <main+0xcf>
mov    $0x2,%ebx
lea    0xe75(%rip),%r14
jmp    11d8 <main+0xa8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    $0x1,%ecx
je     11ff <main+0xcf>
mov    %ecx,%eax
cltd
idiv   %ebx
test   %edx,%edx
jne    11d0 <main+0xa0>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%eax
cltd
idiv   %ebx
mov    %eax,%ecx
mov    %eax,0xc(%rsp)
cmp    $0x1,%ecx
jne    11d8 <main+0xa8>
mov    0x2dda(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Introduce un numero entero mayor que 1: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [59 x i8] c"Vuelve a introducir un numero, tiene que ser mayor que 1:\0A\00"
@.str.3 = [8 x i8] c"%d = 1 \00"
@.str.4 = [6 x i8] c"* %d \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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
br label %10
10: ; preds = %13, %2
%11 = load i32, i32* %6
%12 = icmp sle i32 %11, 1
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
br label %10
16: ; preds = %10
store i32 2, i32* %7
%17 = load i32, i32* %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %36, %16
%20 = load i32, i32* %6
%21 = icmp ne i32 %20, 1
br i1 %21, label %22, label %37
22: ; preds = %19
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = srem i32 %23, %24
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %22
%28 = load i32, i32* %7
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = sdiv i32 %30, %31
store i32 %32, i32* %6
br label %36
33: ; preds = %22
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %36
36: ; preds = %33, %27
br label %19
37: ; preds = %19
%38 = load i32, i32* @EXIT_SUCCESS
ret i32 %38
}

LLVM IR (-O2):
@.str = [41 x i8] c"Introduce un numero entero mayor que 1: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [8 x i8] c"%d = 1 \00"
@.str.4 = [6 x i8] c"* %d \00"
@EXIT_SUCCESS = global i32 0
@str = [58 x i8] c"Vuelve a introducir un numero, tiene que ser mayor que 1:\00"
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 ([41 x i8], [41 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* %3
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2, %9
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 2
br i1 %13, label %9, label %14
14: ; preds = %9, %2
%15 = phi i32 [ %7, %2 ], [ %12, %9 ]
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, 1
br i1 %18, label %34, label %19
19: ; preds = %14, %30
%20 = phi i32 [ %31, %30 ], [ %17, %14 ]
%21 = phi i32 [ %32, %30 ], [ 2, %14 ]
%22 = srem i32 %20, %21
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %19
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %21)
%26 = load i32, i32* %3
%27 = sdiv i32 %26, %21
store i32 %27, i32* %3
br label %30
28: ; preds = %19
%29 = add nsw i32 %21, 1
br label %30
30: ; preds = %28, %24
%31 = phi i32 [ %27, %24 ], [ %20, %28 ]
%32 = phi i32 [ %21, %24 ], [ %29, %28 ]
%33 = icmp eq i32 %31, 1
br i1 %33, label %34, label %19
34: ; preds = %30, %14
%35 = load i32, i32* @EXIT_SUCCESS
ret i32 %35
}