#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*/ fprintf(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ stdout;
int es_primo(int numero) {
  int resultado = 1;
  int i = 2;
  while (i < numero) {
    if (numero % i == 0) {
      fprintf(stdout, "%d es divisible entre %d\n", numero, i);
      resultado = 0;
    }
    i = i + 1;
  }
  return resultado;
}


x86 assembly (clang, -O0):
<es_primo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1175 <es_primo+0x65>
mov    -0x4(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1167 <es_primo+0x57>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xea5(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1129 <es_primo+0x19>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<es_primo>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ecx
cmp    $0x3,%edi
jl     1163 <es_primo+0x53>
mov    %edi,%ebx
mov    $0x1,%ecx
mov    $0x2,%ebp
mov    0x2eac(%rip),%r15
lea    0xec5(%rip),%r14
jmp    1147 <es_primo+0x37>
nopl   (%rax)
add    $0x1,%ebp
cmp    %ebp,%ebx
je     1163 <es_primo+0x53>
mov    %ebx,%eax
cltd
idiv   %ebp
test   %edx,%edx
jne    1140 <es_primo+0x30>
mov    (%r15),%edi
mov    %r14,%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
call   1030 <fprintf@plt>
xor    %ecx,%ecx
jmp    1140 <es_primo+0x30>
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [26 x i8] c"%d es divisible entre %d\0A\00"
define i32 @es_primo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
store i32 2, i32* %4
br label %5
5: ; preds = %19, %1
%6 = load i32, i32* %4
%7 = load i32, i32* %2
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %22
9: ; preds = %5
%10 = load i32, i32* %2
%11 = load i32, i32* %4
%12 = srem i32 %10, %11
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %9
%15 = load i32, i32* @stdout
%16 = load i32, i32* %2
%17 = load i32, i32* %4
%18 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %17)
store i32 0, i32* %3
br label %19
19: ; preds = %14, %9
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %5
22: ; preds = %5
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [26 x i8] c"%d es divisible entre %d\0A\00"
define i32 @es_primo(i32 %0) {
%2 = icmp sgt i32 %0, 2
br i1 %2, label %3, label %15
3: ; preds = %1, %11
%4 = phi i32 [ %13, %11 ], [ 2, %1 ]
%5 = phi i32 [ %12, %11 ], [ 1, %1 ]
%6 = srem i32 %0, %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = load i32, i32* @stdout
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %4)
br label %11
11: ; preds = %8, %3
%12 = phi i32 [ 0, %8 ], [ %5, %3 ]
%13 = add nuw nsw i32 %4, 1
%14 = icmp eq i32 %13, %0
br i1 %14, label %15, label %3
15: ; preds = %11, %1
%16 = phi i32 [ 1, %1 ], [ %12, %11 ]
ret i32 %16
}