#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(void) {
  int side, i, k, z, t;
  char c;
  printf("enter the side of square: ");
  scanf("%d", &side);
  printf("\nenter the character of square: ");
  scanf(" %c", &c);
  for (k = 1; k <= side; k++) {
    if (k == 1 || k == (side)) {
      for (t = 1; t <= side; t++) {
        printf("%c", c);
      }
    } else {
      int hallow = side - 2;
      printf("%c", c);
      for (z = 1; z <= hallow; z++) {
        printf(" ");
      }
      printf("%c", c);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    -0x19(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1248 <main+0x128>
cmpl   $0x1,-0x10(%rbp)
je     1198 <main+0x78>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11d0 <main+0xb0>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11cb <main+0xab>
movsbl -0x19(%rbp),%esi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    119f <main+0x7f>
jmp    122c <main+0x10c>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x20(%rbp)
movsbl -0x19(%rbp),%esi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     121a <main+0xfa>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11f2 <main+0xd2>
movsbl -0x19(%rbp),%esi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1176 <main+0x56>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed6(%rip),%rdi
lea    0x3(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%ebp
test   %ebp,%ebp
jle    1215 <main+0xe5>
mov    $0x1,%ebx
jmp    11b1 <main+0x81>
nopl   0x0(%rax,%rax,1)
movsbl 0x3(%rsp),%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%eax
mov    0x4(%rsp),%ebp
cmp    %ebp,%ebx
mov    %eax,%ebx
jge    1215 <main+0xe5>
cmp    $0x1,%ebx
je     11f0 <main+0xc0>
cmp    %ebp,%ebx
je     11f0 <main+0xc0>
movsbl 0x3(%rsp),%edi
call   1030 <putchar@plt>
cmp    $0x3,%ebp
jl     1190 <main+0x60>
add    $0xfffffffe,%ebp
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11d0 <main+0xa0>
jmp    1190 <main+0x60>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
test   %ebp,%ebp
jle    119a <main+0x6a>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
movsbl 0x3(%rsp),%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     1200 <main+0xd0>
jmp    119a <main+0x6a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [27 x i8] c"enter the side of square: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"\0Aenter the character of square: \00"
@.str.3 = [4 x i8] c" %c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 1
br i1 %9, label %47, label %10
10: ; preds = %0, %42
%11 = phi i32 [ %45, %42 ], [ %8, %0 ]
%12 = phi i32 [ %44, %42 ], [ 1, %0 ]
%13 = icmp eq i32 %12, 1
%14 = icmp eq i32 %12, %11
%15 = select i1 %13, i1 true, i1 %14
br i1 %15, label %16, label %26
16: ; preds = %10
%17 = icmp slt i32 %11, 1
br i1 %17, label %42, label %18
18: ; preds = %16, %18
%19 = phi i32 [ %23, %18 ], [ 1, %16 ]
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
%22 = call i32 @putchar(i32 %21)
%23 = add nuw nsw i32 %19, 1
%24 = load i32, i32* %1
%25 = icmp slt i32 %19, %24
br i1 %25, label %18, label %42
26: ; preds = %10
%27 = load i8, i8* %2
%28 = sext i8 %27 to i32
%29 = call i32 @putchar(i32 %28)
%30 = icmp slt i32 %11, 3
br i1 %30, label %38, label %31
31: ; preds = %26
%32 = add nsw i32 %11, -1
br label %33
33: ; preds = %31, %33
%34 = phi i32 [ %36, %33 ], [ 1, %31 ]
%35 = call i32 @putchar(i32 32)
%36 = add nuw i32 %34, 1
%37 = icmp eq i32 %36, %32
br i1 %37, label %38, label %33
38: ; preds = %33, %26
%39 = load i8, i8* %2
%40 = sext i8 %39 to i32
%41 = call i32 @putchar(i32 %40)
br label %42
42: ; preds = %18, %16, %38
%43 = call i32 @putchar(i32 10)
%44 = add nuw nsw i32 %12, 1
%45 = load i32, i32* %1
%46 = icmp slt i32 %12, %45
br i1 %46, label %10, label %47
47: ; preds = %42, %0
ret i32 0
}