#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 divisor_product(unsigned int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  const unsigned int limit = 50;
  unsigned int n;
  printf("Product of divisors for the first %d positive integers:\n", limit);
  for (n = 1; n <= limit; ++n) {
    printf("%11d", divisor_product(n));
    if (n % 5 == 0) {
      printf("\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x32,-0x8(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x32,%esi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0xc(%rbp)
cmpl   $0x32,-0xc(%rbp)
ja     11a8 <main+0x88>
mov    -0xc(%rbp),%edi
call   1030 <divisor_product@plt>
mov    %eax,%esi
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x0,%edx
jne    1195 <main+0x75>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    119a <main+0x7a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1150 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
mov    $0x32,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%ebx
lea    0xee3(%rip),%r14
jmp    1168 <main+0x38>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    $0x33,%ebx
je     119f <main+0x6f>
movzbl %bl,%r15d
imul   $0xcd,%r15d,%eax
shr    $0xa,%eax
lea    (%rax,%rax,4),%ebp
neg    %ebp
mov    %ebx,%edi
call   1040 <divisor_product@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    %bpl,%r15b
jne    1160 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [57 x i8] c"Product of divisors for the first %d positive integers:\0A\00"
@.str.1 = [5 x i8] c"%11d\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 50, i32* %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 50)
store i32 1, i32* %3
br label %5
5: ; preds = %18, %0
%6 = load i32, i32* %3
%7 = icmp ule i32 %6, 50
br i1 %7, label %8, label %21
8: ; preds = %5
%9 = load i32, i32* %3
%10 = call i32 @divisor_product(i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %3
%13 = urem i32 %12, 5
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %8
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %8
br label %18
18: ; preds = %17
%19 = load i32, i32* %3
%20 = add i32 %19, 1
store i32 %20, i32* %3
br label %5
21: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [57 x i8] c"Product of divisors for the first %d positive integers:\0A\00"
@.str.1 = [5 x i8] c"%11d\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 50)
br label %2
2: ; preds = %0, %11
%3 = phi i32 [ 1, %0 ], [ %12, %11 ]
%4 = tail call i32 @divisor_product(i32 %3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = trunc i32 %3 to i8
%7 = urem i8 %6, 5
%8 = icmp eq i8 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 @putchar(i32 10)
br label %11
11: ; preds = %2, %9
%12 = add nuw nsw i32 %3, 1
%13 = icmp eq i32 %12, 51
br i1 %13, label %14, label %2
14: ; preds = %11
ret i32 0
}