#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);
int display_solid_square(int sym, int sid) {
  int x;
  for (x = 0; x < sid * sid; x++)
    (x % sid != 0) ? printf("%c", sym) : printf("\n%c", sym);
}


x86 assembly (clang, -O0):
<display_solid_square>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    1178 <display_solid_square+0x68>
mov    -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
je     115b <display_solid_square+0x4b>
mov    -0x8(%rbp),%esi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
jmp    116a <display_solid_square+0x5a>
mov    -0x8(%rbp),%esi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1125 <display_solid_square+0x15>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_solid_square>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebx
imul   %esi,%ebx
test   %ebx,%ebx
je     1161 <display_solid_square+0x51>
mov    %esi,%r15d
mov    %edi,%r14d
xor    %ebp,%ebp
lea    0xecd(%rip),%r12
lea    0xec7(%rip),%r13
jmp    114f <display_solid_square+0x3f>
nopl   0x0(%rax)
mov    %r14d,%esi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
je     1161 <display_solid_square+0x51>
mov    %ebp,%eax
cltd
idiv   %r15d
mov    %r12,%rdi
test   %edx,%edx
je     1140 <display_solid_square+0x30>
mov    %r13,%rdi
jmp    1140 <display_solid_square+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"\0A%c\00"
define i32 @display_solid_square(i32 %0, i32 %1) {
%3 = mul i32 %1, %1
%4 = icmp eq i32 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i32 [ %11, %5 ], [ 0, %2 ]
%7 = srem i32 %6, %1
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
%10 = tail call i32 @printf(i8* %9, i32 %0)
%11 = add nuw i32 %6, 1
%12 = icmp eq i32 %11, %3
br i1 %12, label %13, label %5
13: ; preds = %5, %2
ret i32 undef
}