#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 *);
void printRectangle(int n, int l) {
  int i, j;
  for (i = 0; i < n; i++) {
    for (j = 0; j < l; j--) {
      if (i == 0 || i == n - 1) {
        printf("*");
      } else {
        if (j == 0 || j == l - 1) {
          printf("*");
        } else {
          printf(" ");
        }
      }
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printRectangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11da <printRectangle+0xca>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c0 <printRectangle+0xb0>
cmpl   $0x0,-0xc(%rbp)
je     115f <printRectangle+0x4f>
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1170 <printRectangle+0x60>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
jmp    11ad <printRectangle+0x9d>
cmpl   $0x0,-0x10(%rbp)
je     118b <printRectangle+0x7b>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    119c <printRectangle+0x8c>
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
jmp    11a8 <printRectangle+0x98>
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
jmp    11ad <printRectangle+0x9d>
jmp    11b2 <printRectangle+0xa2>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1138 <printRectangle+0x28>
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <printRectangle+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printRectangle>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
jle    1149 <printRectangle+0x39>
mov    %esi,%r14d
mov    %edi,%r15d
lea    -0x1(%r14),%r12d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
test   %r14d,%r14d
jg     1152 <printRectangle+0x42>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
mov    %r15d,%eax
add    %ebx,%eax
jne    1130 <printRectangle+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
test   %ebx,%ebx
sete   %al
add    %ebx,%r15d
cmp    $0x1,%r15d
sete   %r14b
or     %al,%r14b
xor    %ebp,%ebp
mov    $0x2a,%ebx
nopl   0x0(%rax)
cmp    %ebp,%r12d
mov    $0x20,%edi
cmove  %ebx,%edi
sub    $0x1,%ebp
cmovb  %ebx,%edi
test   %r14b,%r14b
cmovne %ebx,%edi
call   1030 <putchar@plt>
jmp    1170 <printRectangle+0x60>

LLVM IR (-O0):
@.str = [2 x i8] c"*\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @printRectangle(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %45, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %48
11: ; preds = %7
store i32 0, i32* %6
br label %12
12: ; preds = %40, %11
%13 = load i32, i32* %6
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %43
16: ; preds = %12
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 0
br i1 %18, label %24, label %19
19: ; preds = %16
%20 = load i32, i32* %5
%21 = load i32, i32* %3
%22 = sub nsw i32 %21, 1
%23 = icmp eq i32 %20, %22
br i1 %23, label %24, label %26
24: ; preds = %19, %16
%25 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %39
26: ; preds = %19
%27 = load i32, i32* %6
%28 = icmp eq i32 %27, 0
br i1 %28, label %34, label %29
29: ; preds = %26
%30 = load i32, i32* %6
%31 = load i32, i32* %4
%32 = sub nsw i32 %31, 1
%33 = icmp eq i32 %30, %32
br i1 %33, label %34, label %36
34: ; preds = %29, %26
%35 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %38
36: ; preds = %29
%37 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %38
38: ; preds = %36, %34
br label %39
39: ; preds = %38, %24
br label %40
40: ; preds = %39
%41 = load i32, i32* %6
%42 = add nsw i32 %41, -1
store i32 %42, i32* %6
br label %12
43: ; preds = %12
%44 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %45
45: ; preds = %43
%46 = load i32, i32* %5
%47 = add nsw i32 %46, 1
store i32 %47, i32* %5
br label %7
48: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @printRectangle(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %27
4: ; preds = %2
%5 = icmp sgt i32 %1, 0
%6 = add nsw i32 %0, -1
%7 = add nsw i32 %1, -1
br label %8
8: ; preds = %4, %23
%9 = phi i32 [ 0, %4 ], [ %25, %23 ]
br i1 %5, label %10, label %23
10: ; preds = %8
%11 = icmp eq i32 %9, 0
%12 = icmp eq i32 %9, %6
%13 = select i1 %11, i1 true, i1 %12
br label %14
14: ; preds = %14, %10
%15 = phi i32 [ 0, %10 ], [ %22, %14 ]
%16 = icmp eq i32 %15, 0
%17 = icmp eq i32 %15, %7
%18 = select i1 %13, i1 true, i1 %16
%19 = select i1 %18, i1 true, i1 %17
%20 = select i1 %19, i32 42, i32 32
%21 = tail call i32 @putchar(i32 %20)
%22 = add nsw i32 %15, -1
br label %14
23: ; preds = %8
%24 = tail call i32 @putchar(i32 10)
%25 = add nuw nsw i32 %9, 1
%26 = icmp eq i32 %25, %0
br i1 %26, label %27, label %8
27: ; preds = %23, %2
ret void
}