#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 imprime(int h, int l, char c) {
  int i, j;
  for (i = 1; i <= h; i++) {
    if (i == 1 || i == h) {
      for (j = 1; j <= l; j++)
        printf("%c", c);
      printf("\n");
    } else {
      for (j = 1; j <= l; j++) {
        if (j == 1 || j == l) {
          printf("%c", c);
        } else {
          printf(" ");
        }
      }
      printf("\n");
    }
  }
}


x86 assembly (clang, -O0):
<imprime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1214 <imprime+0x104>
cmpl   $0x1,-0x14(%rbp)
je     114c <imprime+0x3c>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1192 <imprime+0x82>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     117f <imprime+0x6f>
movsbl -0xd(%rbp),%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1153 <imprime+0x43>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1201 <imprime+0xf1>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11f3 <imprime+0xe3>
cmpl   $0x1,-0x18(%rbp)
je     11bb <imprime+0xab>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11d2 <imprime+0xc2>
movsbl -0xd(%rbp),%esi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e0 <imprime+0xd0>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e5 <imprime+0xd5>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1199 <imprime+0x89>
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1206 <imprime+0xf6>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112a <imprime+0x1a>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imprime>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
jle    11be <imprime+0xae>
mov    %esi,%r12d
mov    %edi,%r14d
movsbl %dl,%ebp
mov    $0x1,%r15d
jmp    1156 <imprime+0x46>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r15),%eax
cmp    %r14d,%r15d
mov    %eax,%r15d
je     11be <imprime+0xae>
cmp    $0x1,%r15d
je     11a0 <imprime+0x90>
cmp    %r14d,%r15d
je     11a0 <imprime+0x90>
test   %r12d,%r12d
jle    1140 <imprime+0x30>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
lea    (%r12,%rbx,1),%eax
cmp    $0x1,%eax
mov    $0x20,%edi
cmove  %ebp,%edi
sub    $0x1,%ebx
cmovb  %ebp,%edi
call   1030 <putchar@plt>
mov    %r12d,%eax
add    %ebx,%eax
jne    1170 <imprime+0x60>
jmp    1140 <imprime+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
test   %r12d,%r12d
jle    1140 <imprime+0x30>
mov    %r12d,%ebx
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11b0 <imprime+0xa0>
jmp    1140 <imprime+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @imprime(i32 %0, i32 %1, i8 signext %2) {
%4 = icmp slt i32 %0, 1
br i1 %4, label %33, label %5
5: ; preds = %3
%6 = icmp slt i32 %1, 1
%7 = sext i8 %2 to i32
br label %8
8: ; preds = %5, %29
%9 = phi i32 [ 1, %5 ], [ %31, %29 ]
%10 = icmp eq i32 %9, 1
%11 = icmp eq i32 %9, %0
%12 = or i1 %10, %11
br i1 %12, label %14, label %13
13: ; preds = %8
br i1 %6, label %29, label %20
14: ; preds = %8
br i1 %6, label %29, label %15
15: ; preds = %14, %15
%16 = phi i32 [ %18, %15 ], [ 1, %14 ]
%17 = tail call i32 @putchar(i32 %7)
%18 = add nuw i32 %16, 1
%19 = icmp eq i32 %16, %1
br i1 %19, label %29, label %15
20: ; preds = %13, %20
%21 = phi i32 [ %27, %20 ], [ 1, %13 ]
%22 = icmp eq i32 %21, 1
%23 = icmp eq i32 %21, %1
%24 = or i1 %22, %23
%25 = select i1 %24, i32 %7, i32 32
%26 = tail call i32 @putchar(i32 %25)
%27 = add nuw i32 %21, 1
%28 = icmp eq i32 %21, %1
br i1 %28, label %29, label %20
29: ; preds = %20, %15, %13, %14
%30 = tail call i32 @putchar(i32 10)
%31 = add nuw i32 %9, 1
%32 = icmp eq i32 %9, %0
br i1 %32, label %33, label %8
33: ; preds = %29, %3
ret i32 undef
}