#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 arr[7][7] = {0};
  int k, i = 0, j = 0;
  int count = 1;
  arr[0][0] = count;
  for (k = 1; k < 7; k++) {
    j = 0;
    for (i = k; i >= 0; i--) {
      arr[i][j] = ++count;
      j++;
    }
  }
  for (i = 0; i < 7; i++) {
    for (j = 0; j < 7; j++) {
      if (arr[i][j] > 0) {
        printf("%3d", arr[i][j]);
      } else
        printf("  ");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xd0(%rbp),%rdi
xor    %esi,%esi
mov    $0xc4,%edx
call   1040 <memset@plt>
movl   $0x0,-0xd8(%rbp)
movl   $0x0,-0xdc(%rbp)
movl   $0x1,-0xe0(%rbp)
mov    -0xe0(%rbp),%eax
mov    %eax,-0xd0(%rbp)
movl   $0x1,-0xd4(%rbp)
cmpl   $0x7,-0xd4(%rbp)
jge    1213 <main+0xf3>
movl   $0x0,-0xdc(%rbp)
mov    -0xd4(%rbp),%eax
mov    %eax,-0xd8(%rbp)
cmpl   $0x0,-0xd8(%rbp)
jl     11fa <main+0xda>
mov    -0xe0(%rbp),%edx
add    $0x1,%edx
mov    %edx,-0xe0(%rbp)
movslq -0xd8(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0x1c,%rcx,%rcx
add    %rcx,%rax
movslq -0xdc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xdc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xdc(%rbp)
mov    -0xd8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xd8(%rbp)
jmp    119c <main+0x7c>
jmp    11ff <main+0xdf>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    1179 <main+0x59>
movl   $0x0,-0xd8(%rbp)
cmpl   $0x7,-0xd8(%rbp)
jge    12e2 <main+0x1c2>
movl   $0x0,-0xdc(%rbp)
cmpl   $0x7,-0xdc(%rbp)
jge    12c0 <main+0x1a0>
movslq -0xd8(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0x1c,%rcx,%rcx
add    %rcx,%rax
movslq -0xdc(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jle    1299 <main+0x179>
movslq -0xd8(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0x1c,%rcx,%rcx
add    %rcx,%rax
movslq -0xdc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a7 <main+0x187>
lea    0xd64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ac <main+0x18c>
mov    -0xdc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xdc(%rbp)
jmp    1234 <main+0x114>
lea    0xd40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    121d <main+0xfd>
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xd0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0xb0(%rsp)
movl   $0x0,0xc0(%rsp)
movaps 0xe86(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0xb,0x70(%rsp)
movl   $0x10,0x8c(%rsp)
movabs $0x1800000011,%rax
mov    %rax,0x74(%rsp)
movaps 0xe69(%rip),%xmm0
movups %xmm0,0x38(%rsp)
movaps 0xe6d(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movl   $0x16,0xa8(%rsp)
movl   $0x17,0x90(%rsp)
movaps 0xe5b(%rip),%xmm0
movups %xmm0,0x54(%rsp)
movl   $0x1a,0x48(%rsp)
movl   $0x1b,0x30(%rsp)
movaps 0xe4f(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    $0x1,%esi
mov    $0x1c,%ebx
lea    0xe49(%rip),%r15
lea    0xe46(%rip),%r14
test   %esi,%esi
jle    1230 <main+0x110>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    123a <main+0x11a>
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x18(%rsp,%rbx,1),%esi
test   %esi,%esi
jle    1250 <main+0x130>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    125a <main+0x13a>
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x14(%rsp,%rbx,1),%esi
test   %esi,%esi
jle    1270 <main+0x150>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    127a <main+0x15a>
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x10(%rsp,%rbx,1),%esi
test   %esi,%esi
jle    1290 <main+0x170>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    129a <main+0x17a>
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0xc(%rsp,%rbx,1),%esi
test   %esi,%esi
jle    12b0 <main+0x190>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    12ba <main+0x19a>
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x8(%rsp,%rbx,1),%esi
test   %esi,%esi
jle    12d0 <main+0x1b0>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    12da <main+0x1ba>
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x4(%rsp,%rbx,1),%esi
test   %esi,%esi
jle    12f0 <main+0x1d0>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    12fa <main+0x1da>
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0xc4,%rbx
je     1321 <main+0x201>
mov    (%rsp,%rbx,1),%esi
add    $0x1c,%rbx
test   %esi,%esi
jg     1220 <main+0x100>
jmp    1230 <main+0x110>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%3d\00"
@.str.1 = [3 x i8] c" \00"
define i32 @main() {
%1 = alloca [7 x [7 x i32]]
%2 = bitcast [7 x [7 x i32]]* %1 to i8*
%3 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 1, i64 5
%4 = bitcast i32* %3 to i8*
%5 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 2, i64 0
%6 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 1, i64 1
%7 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 3, i64 0
%8 = bitcast [7 x [7 x i32]]* %1 to <4 x i32>*
store <4 x i32> <i32 1, i32 3, i32 6, i32 10>, <4 x i32>* %8
%9 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 4, i64 0
store i32 11, i32* %9
%10 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 0, i64 4
%11 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 5, i64 0
store i32 16, i32* %11
%12 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 4, i64 1
store i32 17, i32* %12
%13 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 4, i32 8, i32 13, i32 19>, <4 x i32>* %13
%14 = bitcast i32* %6 to <4 x i32>*
store <4 x i32> <i32 5, i32 9, i32 14, i32 20>, <4 x i32>* %14
%15 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 6, i64 0
store i32 22, i32* %15
%16 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 5, i64 1
store i32 23, i32* %16
%17 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 4, i64 2
store i32 24, i32* %17
%18 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 7, i32 12, i32 18, i32 25>, <4 x i32>* %18
%19 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 2, i64 4
store i32 26, i32* %19
%20 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 1, i64 5
store i32 27, i32* %20
%21 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> <i32 15, i32 21, i32 28, i32 2>, <4 x i32>* %21
br label %22
22: ; preds = %82, %0
%23 = phi i32 [ 1, %0 ], [ %84, %82 ]
%24 = phi i64 [ 0, %0 ], [ %80, %82 ]
%25 = icmp sgt i32 %23, 0
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %23)
br label %30
28: ; preds = %22
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %30
30: ; preds = %26, %28
%31 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 %24, i64 1
%32 = load i32, i32* %31
%33 = icmp sgt i32 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %30
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %38
36: ; preds = %30
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %32)
br label %38
38: ; preds = %36, %34
%39 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 %24, i64 2
%40 = load i32, i32* %39
%41 = icmp sgt i32 %40, 0
br i1 %41, label %44, label %42
42: ; preds = %38
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %46
44: ; preds = %38
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %40)
br label %46
46: ; preds = %44, %42
%47 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 %24, i64 3
%48 = load i32, i32* %47
%49 = icmp sgt i32 %48, 0
br i1 %49, label %52, label %50
50: ; preds = %46
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %54
52: ; preds = %46
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %48)
br label %54
54: ; preds = %52, %50
%55 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 %24, i64 4
%56 = load i32, i32* %55
%57 = icmp sgt i32 %56, 0
br i1 %57, label %60, label %58
58: ; preds = %54
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %62
60: ; preds = %54
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %56)
br label %62
62: ; preds = %60, %58
%63 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 %24, i64 5
%64 = load i32, i32* %63
%65 = icmp sgt i32 %64, 0
br i1 %65, label %68, label %66
66: ; preds = %62
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %70
68: ; preds = %62
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %64)
br label %70
70: ; preds = %68, %66
%71 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 %24, i64 6
%72 = load i32, i32* %71
%73 = icmp sgt i32 %72, 0
br i1 %73, label %76, label %74
74: ; preds = %70
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %78
76: ; preds = %70
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %72)
br label %78
78: ; preds = %76, %74
%79 = tail call i32 @putchar(i32 10)
%80 = add nuw nsw i64 %24, 1
%81 = icmp eq i64 %80, 7
br i1 %81, label %85, label %82
82: ; preds = %78
%83 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %1, i64 0, i64 %80, i64 0
%84 = load i32, i32* %83
br label %22
85: ; preds = %78
ret i32 0
}