#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 *, ...);
void putout(int S, int *n) {
  int row, blank, rank, num;
  row = blank = rank = num = 0;
  for (row = 1; row <= S; row++) {
    if (row == 1) {
      for (blank = 1; blank <= 4 * (S - row); blank++) {
        printf(" ");
      }
    } else {
      for (blank = 1; blank <= (S - row); blank++) {
        printf("    ");
      }
    }
    for (rank = 1; rank <= row; rank++) {
      printf("%d     ", n[num]);
      num++;
      if (rank == row) {
        printf("\n");
      }
      printf(" ");
    }
  }
}


x86 assembly (clang, -O0):
<putout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     124b <putout+0x13b>
cmpl   $0x1,-0x14(%rbp)
jne    1194 <putout+0x84>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    -0x14(%rbp),%ecx
shl    $0x2,%ecx
cmp    %ecx,%eax
jg     118f <putout+0x7f>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115f <putout+0x4f>
jmp    11cd <putout+0xbd>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jg     11c8 <putout+0xb8>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    119b <putout+0x8b>
jmp    11cd <putout+0xbd>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1238 <putout+0x128>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    121c <putout+0x10c>
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11d4 <putout+0xc4>
jmp    123d <putout+0x12d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1142 <putout+0x32>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putout>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,0x20(%rsp)
mov    %rdi,%rax
mov    %rdi,0x10(%rsp)
test   %edi,%edi
jle    1256 <putout+0x136>
mov    0x10(%rsp),%rax
lea    -0x4(,%rax,4),%eax
mov    %eax,0xc(%rsp)
mov    $0x1,%ebx
lea    0xea4(%rip),%r14
xor    %r15d,%r15d
xor    %r12d,%r12d
jmp    1191 <putout+0x71>
nopw   0x0(%rax,%rax,1)
mov    0x1c(%rsp),%r12d
add    %ebx,%r12d
lea    0x1(%rbx),%eax
mov    %r14,%r15
cmp    0x10(%rsp),%ebx
mov    %eax,%ebx
lea    0xe78(%rip),%r14
je     1256 <putout+0x136>
cmp    $0x1,%ebx
jne    11d0 <putout+0xb0>
cmpl   $0x0,0xc(%rsp)
jle    11f1 <putout+0xd1>
mov    0xc(%rsp),%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11b0 <putout+0x90>
jmp    11f1 <putout+0xd1>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rax
mov    %eax,%ebp
cmp    %eax,%ebx
jge    11f1 <putout+0xd1>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
cmp    %ebp,%ebx
jne    11e0 <putout+0xc0>
mov    %r12d,0x1c(%rsp)
movslq %r12d,%rax
mov    0x20(%rsp),%rcx
lea    (%rcx,%rax,4),%r12
lea    0x1(%r15),%r14
xor    %r13d,%r13d
lea    0xdf0(%rip),%rbp
jmp    1237 <putout+0x117>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
cmp    %r13d,%r14d
je     1170 <putout+0x50>
mov    (%r12,%r13,4),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r13d,%r15d
jne    1220 <putout+0x100>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1220 <putout+0x100>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [5 x i8] c" \00"
@.str.2 = [8 x i8] c"%d \00"
define void @putout(i32 %0, i32* nocapture %1) {
%3 = icmp slt i32 %0, 1
br i1 %3, label %49, label %4
4: ; preds = %2
%5 = shl i32 %0, 2
%6 = add i32 %5, -4
%7 = icmp slt i32 %6, 1
%8 = add i32 %5, -3
br label %9
9: ; preds = %4, %45
%10 = phi i32 [ %0, %4 ], [ %47, %45 ]
%11 = phi i32 [ 0, %4 ], [ %29, %45 ]
%12 = phi i32 [ 1, %4 ], [ %46, %45 ]
%13 = icmp eq i32 %12, 1
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = icmp slt i32 %12, %0
br i1 %15, label %22, label %27
16: ; preds = %9
br i1 %7, label %27, label %17
17: ; preds = %16, %17
%18 = phi i32 [ %20, %17 ], [ 1, %16 ]
%19 = tail call i32 @putchar(i32 32)
%20 = add nuw nsw i32 %18, 1
%21 = icmp eq i32 %20, %8
br i1 %21, label %27, label %17
22: ; preds = %14, %22
%23 = phi i32 [ %25, %22 ], [ 1, %14 ]
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%25 = add nuw i32 %23, 1
%26 = icmp eq i32 %25, %10
br i1 %26, label %27, label %22
27: ; preds = %22, %17, %14, %16
%28 = sext i32 %11 to i64
%29 = add i32 %11, %12
br label %30
30: ; preds = %27, %40
%31 = phi i64 [ %28, %27 ], [ %36, %40 ]
%32 = phi i32 [ 1, %27 ], [ %42, %40 ]
%33 = getelementptr inbounds i32, i32* %1, i64 %31
%34 = load i32, i32* %33
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %34)
%36 = add nsw i64 %31, 1
%37 = icmp eq i32 %32, %12
br i1 %37, label %38, label %40
38: ; preds = %30
%39 = tail call i32 @putchar(i32 10)
br label %40
40: ; preds = %38, %30
%41 = tail call i32 @putchar(i32 32)
%42 = add nuw nsw i32 %32, 1
%43 = trunc i64 %36 to i32
%44 = icmp eq i32 %29, %43
br i1 %44, label %45, label %30
45: ; preds = %40
%46 = add nuw i32 %12, 1
%47 = add i32 %10, -1
%48 = icmp eq i32 %12, %0
br i1 %48, label %49, label %9
49: ; preds = %45, %2
ret void
}