#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 next_mult(int number) {
  for (int i = 2; i <= number; i++) {
    if (number % i == 0) {
      number = number / i;
      printf("%d ", i);
      return number;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<next_mult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1175 <next_mult+0x65>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1162 <next_mult+0x52>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117c <next_mult+0x6c>
jmp    1167 <next_mult+0x57>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1122 <next_mult+0x12>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_mult>:
mov    $0x1,%r8d
cmp    $0x2,%edi
jl     114b <next_mult+0x3b>
mov    %edi,%ecx
neg    %ecx
mov    $0x2,%esi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     114f <next_mult+0x3f>
lea    (%rcx,%rsi,1),%eax
add    $0x1,%eax
mov    %esi,%edx
add    $0x1,%edx
mov    %edx,%esi
cmp    $0x1,%eax
jne    1130 <next_mult+0x20>
mov    %r8d,%eax
ret
push   %rbx
mov    %eax,%ebx
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%r8d
pop    %rbx
mov    %r8d,%eax
ret

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

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