#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 c(int, int);
int /*<<< orphan*/ getch();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int i, j, n = 13;
  printf("N=");
  while (n > 12)
    scanf("%d", &n);
  for (i = 0; i <= n; i++) {
    for (j = 0; j < 24 - 2 * i; j++)
      printf(" ");
    for (j = 1; j < i + 2; j++)
      printf("%4d", c(i, j));
    printf("\n");
    getch();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xd,-0xc(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xc,-0xc(%rbp)
jle    117c <main+0x3c>
lea    0xe95(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
jmp    115d <main+0x1d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     122e <main+0xee>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%edx
shl    $0x1,%edx
mov    $0x18,%ecx
sub    %edx,%ecx
cmp    %ecx,%eax
jge    11ca <main+0x8a>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1196 <main+0x56>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
jge    120b <main+0xcb>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <c@plt>
mov    %eax,%esi
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d1 <main+0x91>
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <getch@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1183 <main+0x43>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movl   $0xd,0xc(%rsp)
lea    0xe95(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8a(%rip),%r14
lea    0xc(%rsp),%rbx
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0xc,%eax
jg     1180 <main+0x30>
test   %eax,%eax
js     1242 <main+0xf2>
mov    $0x18,%r12d
lea    0xe5d(%rip),%r14
xor    %ebp,%ebp
xor    %r15d,%r15d
xchg   %ax,%ax
mov    $0x18,%ecx
sub    %r15d,%ecx
sub    %r15d,%ecx
test   %ecx,%ecx
jle    11df <main+0x8f>
mov    %r12d,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11d0 <main+0x80>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15d,%edi
mov    %ebx,%esi
call   1050 <c@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x2,%eax
jne    11f0 <main+0xa0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1070 <getch@plt>
lea    0x1(%r15),%eax
add    $0xfffffffe,%r12d
add    $0xffffffff,%ebp
cmp    0xc(%rsp),%r15d
mov    %eax,%r15d
jl     11b0 <main+0x60>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"N=\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%4d\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 13, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %6
4: ; preds = %6
%5 = icmp slt i32 %8, 0
br i1 %5, label %37, label %10
6: ; preds = %0, %6
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 12
br i1 %9, label %6, label %4
10: ; preds = %4, %29
%11 = phi i32 [ %36, %29 ], [ 2, %4 ]
%12 = phi i32 [ %35, %29 ], [ 24, %4 ]
%13 = phi i32 [ %32, %29 ], [ 0, %4 ]
%14 = mul i32 %13, -2
%15 = add i32 %14, 24
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %10, %17
%18 = phi i32 [ %20, %17 ], [ 0, %10 ]
%19 = call i32 @putchar(i32 32)
%20 = add nuw nsw i32 %18, 1
%21 = icmp eq i32 %20, %12
br i1 %21, label %22, label %17
22: ; preds = %17, %10
br label %23
23: ; preds = %22, %23
%24 = phi i32 [ %27, %23 ], [ 1, %22 ]
%25 = call i32 @c(i32 %13, i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %25)
%27 = add nuw i32 %24, 1
%28 = icmp eq i32 %27, %11
br i1 %28, label %29, label %23
29: ; preds = %23
%30 = call i32 @putchar(i32 10)
%31 = call i32 (...) @getch()
%32 = add nuw nsw i32 %13, 1
%33 = load i32, i32* %1
%34 = icmp slt i32 %13, %33
%35 = add i32 %12, -2
%36 = add nuw i32 %11, 1
br i1 %34, label %10, label %37
37: ; preds = %29, %4
ret void
}