#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*/ _putchar(char);
void print_square(int size) {
  int a, b;
  if (size > 0) {
    for (a = 0; a < size; a++) {
      for (b = 0; b < size; b++)
        _putchar('#');
      _putchar('\n');
    }
  } else
    _putchar('\n');
}


x86 assembly (clang, -O0):
<print_square>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1180 <print_square+0x70>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    117b <print_square+0x6b>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1163 <print_square+0x53>
mov    $0x23,%edi
call   1030 <_putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113f <print_square+0x2f>
mov    $0xa,%edi
call   1030 <_putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112c <print_square+0x1c>
jmp    118a <print_square+0x7a>
mov    $0xa,%edi
call   1030 <_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_square>:
test   %edi,%edi
jle    1156 <print_square+0x46>
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
xor    %ebp,%ebp
nopl   (%rax)
mov    %r14d,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x23,%edi
call   1030 <_putchar@plt>
add    $0xffffffff,%ebx
jne    1130 <print_square+0x20>
mov    $0xa,%edi
call   1030 <_putchar@plt>
add    $0x1,%ebp
cmp    %r14d,%ebp
jne    1120 <print_square+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    $0xa,%edi
jmp    1030 <_putchar@plt>

LLVM IR (-O0):
define void @print_square(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %28
7: ; preds = %1
store i32 0, i32* %3
br label %8
8: ; preds = %24, %7
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %27
12: ; preds = %8
store i32 0, i32* %4
br label %13
13: ; preds = %19, %12
%14 = load i32, i32* %4
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = call i32 @_putchar(i8 signext 35)
br label %19
19: ; preds = %17
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %13
22: ; preds = %13
%23 = call i32 @_putchar(i8 signext 10)
br label %24
24: ; preds = %22
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %8
27: ; preds = %8
br label %30
28: ; preds = %1
%29 = call i32 @_putchar(i8 signext 10)
br label %30
30: ; preds = %28, %27
ret void
}

LLVM IR (-O2):
define void @print_square(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %14
3: ; preds = %1, %10
%4 = phi i32 [ %12, %10 ], [ 0, %1 ]
br label %5
5: ; preds = %3, %5
%6 = phi i32 [ %8, %5 ], [ 0, %3 ]
%7 = tail call i32 @_putchar(i8 signext 35)
%8 = add nuw nsw i32 %6, 1
%9 = icmp eq i32 %8, %0
br i1 %9, label %10, label %5
10: ; preds = %5
%11 = tail call i32 @_putchar(i8 signext 10)
%12 = add nuw nsw i32 %4, 1
%13 = icmp eq i32 %12, %0
br i1 %13, label %16, label %3
14: ; preds = %1
%15 = tail call i32 @_putchar(i8 signext 10)
br label %16
16: ; preds = %10, %14
ret void
}