#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, int);
int divisores(int saida) {
  int i;
  for (i = 2; i <= saida; i++) {
    if (saida % i == 0)
      printf("%d é divisivel por %d\n", saida, i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<divisores>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1163 <divisores+0x53>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
jne    1150 <divisores+0x40>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
jmp    1155 <divisores+0x45>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <divisores+0x12>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<divisores>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jge    1129 <divisores+0x19>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %edi,%ebp
mov    %edi,%r15d
neg    %r15d
mov    $0x2,%ebx
lea    0xec3(%rip),%r14
jmp    1153 <divisores+0x43>
nop
lea    (%r15,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
je     111c <divisores+0xc>
mov    %ebp,%eax
cltd
idiv   %ebx
test   %edx,%edx
jne    1140 <divisores+0x30>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
jmp    1140 <divisores+0x30>

LLVM IR (-O0):
@.str = [24 x i8] c"%d \C3\A9 divisivel por %d\0A\00"
define i32 @divisores(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 2, i32* %3
br label %4
4: ; preds = %18, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp sle i32 %5, %6
br i1 %7, label %8, label %21
8: ; preds = %4
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = srem i32 %9, %10
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %8
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %15)
br label %17
17: ; preds = %13, %8
br label %18
18: ; preds = %17
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %4
21: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"%d \C3\A9 divisivel por %d\0A\00"
define i32 @divisores(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %12, label %3
3: ; preds = %1, %9
%4 = phi i32 [ %10, %9 ], [ 2, %1 ]
%5 = srem i32 %0, %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %4)
br label %9
9: ; preds = %3, %7
%10 = add nuw i32 %4, 1
%11 = icmp eq i32 %4, %0
br i1 %11, label %12, label %3
12: ; preds = %9, %1
ret i32 0
}