#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 /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int i, n, max;
  unsigned long num, den, Cn;
  printf("Enter maximum number: ");
  scanf("%d", &max);
  printf("\nC(1) = 1\n");
  printf("C(2) = 2\n");
  Cn = 2;
  for (n = 2; n < max; n++) {
    printf("n = %d", n);
    if (n % 2 == 0) {
      printf(", even");
      num = 2 * n + 1;
      den = (n + 2) / 2;
    } else {
      num = 2 * (2 * n + 1);
      den = n + 2;
    }
    if (num % 3 == 0 && den % 3 == 0) {
      printf(", divisible by 3");
      num /= 3;
      den /= 3;
    }
    Cn = (Cn * num) / den;
    printf("\nC(%d) = %d\n", n + 1, Cn);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x2,-0x38(%rbp)
movl   $0x2,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12a1 <main+0x181>
mov    -0x18(%rbp),%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11e6 <main+0xc6>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cltq
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,-0x30(%rbp)
jmp    1204 <main+0xe4>
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
shl    $0x1,%eax
cltq
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
add    $0x2,%eax
cltq
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
jne    1266 <main+0x146>
mov    -0x30(%rbp),%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
jne    1266 <main+0x146>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x30(%rbp)
mov    -0x38(%rbp),%rax
imul   -0x28(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x30(%rbp)
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%esi
add    $0x1,%esi
mov    -0x38(%rbp),%rdx
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    117f <main+0x5f>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x3,0x4(%rsp)
jl     127a <main+0x14a>
mov    $0x2,%ebx
mov    $0x2,%ebp
mov    $0xa,%r12d
movabs $0xaaaaaaaaaaaaaaab,%r14
aa aa aa
jmp    11cf <main+0x9f>
nopl   0x0(%rax)
mov    %rcx,%rax
xor    %edx,%edx
div    %rsi
mov    %rax,%rbp
add    $0x1,%ebx
lea    0xe81(%rip),%rdi
mov    %ebx,%esi
mov    %rbp,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x4,%r12d
cmp    0x4(%rsp),%ebx
jge    127a <main+0x14a>
lea    0xe41(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   $0x1,%bl
jne    1200 <main+0xd0>
lea    0xe33(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rbx,%rbx,1),%eax
add    $0x1,%eax
lea    0x2(%rbx),%esi
shr    %esi
jmp    1206 <main+0xd6>
nop
lea    0x2(%rbx),%esi
mov    %r12d,%eax
movslq %eax,%rcx
mov    %rcx,%rax
mul    %r14
mov    %rdx,%r15
mov    %rcx,%rax
imul   %r14,%rax
movabs $0x5555555555555555,%rdx
55 55 55
cmp    %rdx,%rax
ja     125a <main+0x12a>
mov    %esi,%r13d
mov    $0xaaaaaaab,%eax
imul   %rax,%r13
shr    $0x21,%r13
lea    0x0(%r13,%r13,2),%eax
mov    %esi,%edx
sub    %eax,%edx
jne    125a <main+0x12a>
shr    %r15
lea    0xdd8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rcx
mov    %r13d,%esi
imul   %rbp,%rcx
mov    %esi,%esi
mov    %rcx,%rax
shr    $0x20,%rax
jne    11a0 <main+0x70>
mov    %ecx,%eax
xor    %edx,%edx
div    %esi
mov    %eax,%ebp
jmp    11ab <main+0x7b>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter maximum number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"\0AC(1) = 1\0A\00"
@.str.3 = [10 x i8] c"C(2) = 2\0A\00"
@.str.4 = [7 x i8] c"n = %d\00"
@.str.5 = [7 x i8] c", even\00"
@.str.6 = [17 x i8] c", divisible by 3\00"
@.str.7 = [13 x i8] c"\0AC(%d) = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
store i64 2, i64* %11
store i32 2, i32* %7
br label %16
16: ; preds = %69, %2
%17 = load i32, i32* %7
%18 = load i32, i32* %8
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %72
20: ; preds = %16
%21 = load i32, i32* %7
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %7
%24 = srem i32 %23, 2
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %36
26: ; preds = %20
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%28 = load i32, i32* %7
%29 = mul nsw i32 2, %28
%30 = add nsw i32 %29, 1
%31 = sext i32 %30 to i64
store i64 %31, i64* %9
%32 = load i32, i32* %7
%33 = add nsw i32 %32, 2
%34 = sdiv i32 %33, 2
%35 = sext i32 %34 to i64
store i64 %35, i64* %10
br label %45
36: ; preds = %20
%37 = load i32, i32* %7
%38 = mul nsw i32 2, %37
%39 = add nsw i32 %38, 1
%40 = mul nsw i32 2, %39
%41 = sext i32 %40 to i64
store i64 %41, i64* %9
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 2
%44 = sext i32 %43 to i64
store i64 %44, i64* %10
br label %45
45: ; preds = %36, %26
%46 = load i64, i64* %9
%47 = urem i64 %46, 3
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %59
49: ; preds = %45
%50 = load i64, i64* %10
%51 = urem i64 %50, 3
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %59
53: ; preds = %49
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%55 = load i64, i64* %9
%56 = udiv i64 %55, 3
store i64 %56, i64* %9
%57 = load i64, i64* %10
%58 = udiv i64 %57, 3
store i64 %58, i64* %10
br label %59
59: ; preds = %53, %49, %45
%60 = load i64, i64* %11
%61 = load i64, i64* %9
%62 = mul i64 %60, %61
%63 = load i64, i64* %10
%64 = udiv i64 %62, %63
store i64 %64, i64* %11
%65 = load i32, i32* %7
%66 = add nsw i32 %65, 1
%67 = load i64, i64* %11
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %66, i64 %67)
br label %69
69: ; preds = %59
%70 = load i32, i32* %7
%71 = add nsw i32 %70, 1
store i32 %71, i32* %7
br label %16
72: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Enter maximum number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [7 x i8] c"n = %d\00"
@.str.5 = [7 x i8] c", even\00"
@.str.6 = [17 x i8] c", divisible by 3\00"
@.str.7 = [13 x i8] c"\0AC(%d) = %d\0A\00"
@str = [10 x i8] c"\0AC(1) = 1\00"
@str.8 = [9 x i8] c"C(2) = 2\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.8, i64 0, i64 0))
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 2
br i1 %10, label %11, label %50
11: ; preds = %2, %40
%12 = phi i64 [ %45, %40 ], [ 2, %2 ]
%13 = phi i32 [ %46, %40 ], [ 2, %2 ]
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%15 = and i32 %13, 1
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %11
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%19 = shl nuw nsw i32 %13, 1
%20 = or i32 %19, 1
%21 = add nuw nsw i32 %13, 2
%22 = lshr i32 %21, 1
br label %27
23: ; preds = %11
%24 = shl i32 %13, 2
%25 = or i32 %24, 2
%26 = add nuw nsw i32 %13, 2
br label %27
27: ; preds = %23, %17
%28 = phi i32 [ %20, %17 ], [ %25, %23 ]
%29 = phi i32 [ %22, %17 ], [ %26, %23 ]
%30 = sext i32 %28 to i64
%31 = urem i64 %30, 3
%32 = udiv i64 %30, 3
%33 = icmp eq i64 %31, 0
%34 = urem i32 %29, 3
%35 = udiv i32 %29, 3
%36 = icmp eq i32 %34, 0
%37 = select i1 %33, i1 %36, i1 false
br i1 %37, label %38, label %40
38: ; preds = %27
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
br label %40
40: ; preds = %38, %27
%41 = phi i64 [ %32, %38 ], [ %30, %27 ]
%42 = phi i32 [ %35, %38 ], [ %29, %27 ]
%43 = zext i32 %42 to i64
%44 = mul i64 %41, %12
%45 = udiv i64 %44, %43
%46 = add nuw nsw i32 %13, 1
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %46, i64 %45)
%48 = load i32, i32* %3
%49 = icmp slt i32 %46, %48
br i1 %49, label %11, label %50
50: ; preds = %40, %2
ret i32 0
}