#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 /*<<< orphan*/ scanf(char *, int *);
main() {
  int a, i;
  scanf("%d", &a);
  i = 1;
  while (i <= a * a) {
    printf("*");
    if (i % a == 0)
      printf("\n");
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   -0x8(%rbp),%ecx
cmp    %ecx,%eax
jg     118e <main+0x6e>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
jne    1180 <main+0x60>
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1146 <main+0x26>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
imul   %eax,%eax
test   %eax,%eax
je     1181 <main+0x61>
xor    %ebx,%ebx
jmp    1157 <main+0x37>
cs nopw 0x0(%rax,%rax,1)
nop
imul   %ecx,%ecx
cmp    %ecx,%ebx
jae    1181 <main+0x61>
add    $0x1,%ebx
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
test   %edx,%edx
jne    1150 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%ecx
jmp    1150 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"*\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %5
5: ; preds = %19, %0
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = load i32, i32* %2
%9 = mul nsw i32 %7, %8
%10 = icmp sle i32 %6, %9
br i1 %10, label %11, label %22
11: ; preds = %5
%12 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = srem i32 %13, %14
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17, %11
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %5
22: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = mul nsw i32 %4, %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %21, label %7
7: ; preds = %0, %16
%8 = phi i32 [ %18, %16 ], [ 1, %0 ]
%9 = call i32 @putchar(i32 42)
%10 = load i32, i32* %1
%11 = srem i32 %8, %10
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %7
%14 = call i32 @putchar(i32 10)
%15 = load i32, i32* %1
br label %16
16: ; preds = %13, %7
%17 = phi i32 [ %15, %13 ], [ %10, %7 ]
%18 = add nuw nsw i32 %8, 1
%19 = mul nsw i32 %17, %17
%20 = icmp ult i32 %8, %19
br i1 %20, label %7, label %21
21: ; preds = %16, %0
ret i32 0
}