#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 i, space, rows = 5, k = 0, count = 0, count1 = 0;
  for (i = 1; i <= rows; ++i) {
    for (space = 1; space <= rows - i; ++space) {
      printf("  ");
      ++count;
    }
    while (k != 2 * i - 1) {
      if (count <= rows - 1) {
        printf("%d ", i + k);
        ++count;
      } else {
        ++count1;
        printf("%d ", (i + k - 2 * count1));
      }
      ++k;
    }
    count1 = count = k = 0;
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     123b <main+0x12b>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jg     118b <main+0x7b>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1155 <main+0x45>
jmp    1190 <main+0x80>
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     120a <main+0xfa>
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11d7 <main+0xc7>
mov    -0x8(%rbp),%esi
add    -0x14(%rbp),%esi
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11fc <main+0xec>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%esi
add    -0x14(%rbp),%esi
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
sub    %eax,%esi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1190 <main+0x80>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <main+0x32>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0x4,%eax
mov    $0x1,%r13d
mov    $0xffffffff,%r15d
lea    0xeba(%rip),%rbx
mov    $0x1,%ecx
jmp    118a <main+0x6a>
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x8(%rsp),%ecx
add    $0x1,%ecx
mov    0x14(%rsp),%eax
add    $0xffffffff,%eax
mov    0x10(%rsp),%r13d
add    $0x2,%r13d
mov    0xc(%rsp),%r15d
add    $0x1,%r15d
cmp    $0x6,%ecx
lea    0xe7c(%rip),%rbx
je     122a <main+0x10a>
cmp    $0x2,%eax
mov    $0x1,%r14d
mov    %eax,0x14(%rsp)
cmovge %eax,%r14d
mov    $0x0,%r12d
mov    %r14d,%ebp
mov    %ecx,0x8(%rsp)
cmp    $0x4,%ecx
ja     11c2 <main+0xa2>
nopl   (%rax)
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    11b0 <main+0x90>
mov    %r14d,%r12d
xor    %r14d,%r14d
mov    %r15d,0xc(%rsp)
mov    %r15d,%ebx
mov    %r13d,0x10(%rsp)
lea    0xe2a(%rip),%rbx
jmp    1210 <main+0xf0>
nopl   0x0(%rax,%rax,1)
mov    %r14d,%ebp
add    $0x1,%ebp
lea    (%r14,%r14,1),%eax
add    $0x2,%eax
mov    %r15d,%esi
sub    %eax,%esi
add    $0x2,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%r14d
add    $0x1,%r15d
add    $0xffffffff,%r13d
je     1150 <main+0x30>
cmp    $0x4,%r12d
jg     11e0 <main+0xc0>
lea    0x2(%r15),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r12d
jmp    1202 <main+0xe2>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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