#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 main() {
  int a, b, d = 1;
  for (a = 2; a < 5000; a++) {
    int c = a;
    printf("%4d:", a);
    for (b = 2; b <= c; b++) {
      if (c % b == 0) {
        printf("%4d ", b);
        c = c / b;
        b = b - 1;
      }
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x2,-0x8(%rbp)
cmpl   $0x1388,-0x8(%rbp)
jge    11c7 <main+0xb7>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11ab <main+0x9b>
mov    -0x14(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1198 <main+0x88>
mov    -0xc(%rbp),%esi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    119d <main+0x8d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1158 <main+0x48>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0x2,%r12d
lea    0xecb(%rip),%r14
lea    0xec9(%rip),%r15
jmp    1157 <main+0x37>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
cmp    $0x1388,%r12d
je     1197 <main+0x77>
mov    %r14,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12d,%ecx
mov    $0x2,%ebx
jmp    1179 <main+0x59>
xchg   %ax,%ax
lea    0x1(%rbx),%eax
cmp    %ecx,%ebx
mov    %eax,%ebx
jge    1140 <main+0x20>
mov    %ecx,%eax
cltd
idiv   %ebx
test   %edx,%edx
jne    1170 <main+0x50>
mov    %eax,%ebp
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebx
mov    %ebp,%ecx
jmp    1170 <main+0x50>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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