#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  int n;
  printf("Enter a number: ");
  scanf("%d", &n);
  int row = 0;
  while (row < n) {
    int col = 0;
    while (col < n) {
      if (row == col || col == n - row - 1) {
        printf("#");
      } else {
        printf(" ");
      }
      col++;
    }
    printf("\n");
    row++;
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11dd <main+0xbd>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c3 <main+0xa3>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     1198 <main+0x78>
mov    -0x1c(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    11a9 <main+0x89>
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
jmp    11b5 <main+0x95>
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    116c <main+0x4c>
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1159 <main+0x39>
mov    0x2dfc(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
lea    0xec6(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11ca <main+0x9a>
xor    %r14d,%r14d
jmp    1187 <main+0x57>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
mov    0xc(%rsp),%eax
cmp    %eax,%r14d
jge    11ca <main+0x9a>
test   %eax,%eax
jle    1170 <main+0x40>
mov    %r14d,%ebp
not    %ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    %ebx,%r14d
sete   %cl
add    %ebp,%eax
cmp    %eax,%ebx
sete   %al
or     %cl,%al
movzbl %al,%eax
lea    (%rax,%rax,2),%edi
or     $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    0xc(%rsp),%eax
cmp    %eax,%ebx
jl     11a0 <main+0x70>
jmp    1170 <main+0x40>
mov    0x2e0f(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"#\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [2 x i8] c"\0A\00"
@EXIT_SUCCESS = global i32 0
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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
store i32 0, i32* %7
br label %11
11: ; preds = %38, %2
%12 = load i32, i32* %7
%13 = load i32, i32* %6
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %42
15: ; preds = %11
store i32 0, i32* %8
br label %16
16: ; preds = %35, %15
%17 = load i32, i32* %8
%18 = load i32, i32* %6
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %38
20: ; preds = %16
%21 = load i32, i32* %7
%22 = load i32, i32* %8
%23 = icmp eq i32 %21, %22
br i1 %23, label %31, label %24
24: ; preds = %20
%25 = load i32, i32* %8
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = sub nsw i32 %26, %27
%29 = sub nsw i32 %28, 1
%30 = icmp eq i32 %25, %29
br i1 %30, label %31, label %33
31: ; preds = %24, %20
%32 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %35
33: ; preds = %24
%34 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %35
35: ; preds = %33, %31
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
store i32 %37, i32* %8
br label %16
38: ; preds = %16
%39 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%40 = load i32, i32* %7
%41 = add nsw i32 %40, 1
store i32 %41, i32* %7
br label %11
42: ; preds = %11
%43 = load i32, i32* @EXIT_SUCCESS
ret i32 %43
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 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 = load i32, i32* %3
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %32
9: ; preds = %2, %27
%10 = phi i32 [ %30, %27 ], [ %7, %2 ]
%11 = phi i32 [ %29, %27 ], [ 0, %2 ]
%12 = icmp sgt i32 %10, 0
br i1 %12, label %13, label %27
13: ; preds = %9
%14 = xor i32 %11, -1
br label %15
15: ; preds = %13, %15
%16 = phi i32 [ %10, %13 ], [ %25, %15 ]
%17 = phi i32 [ 0, %13 ], [ %24, %15 ]
%18 = icmp eq i32 %11, %17
%19 = add i32 %16, %14
%20 = icmp eq i32 %17, %19
%21 = select i1 %18, i1 true, i1 %20
%22 = select i1 %21, i32 35, i32 32
%23 = call i32 @putchar(i32 %22)
%24 = add nuw nsw i32 %17, 1
%25 = load i32, i32* %3
%26 = icmp slt i32 %24, %25
br i1 %26, label %15, label %27
27: ; preds = %15, %9
%28 = call i32 @putchar(i32 10)
%29 = add nuw nsw i32 %11, 1
%30 = load i32, i32* %3
%31 = icmp slt i32 %29, %30
br i1 %31, label %9, label %32
32: ; preds = %27, %2
%33 = load i32, i32* @EXIT_SUCCESS
ret i32 %33
}