#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*/ draw_horizontal(int, int, int);
int /*<<< orphan*/ draw_vertical(int, char);
int /*<<< orphan*/ printf(char *);
void draw(int l, int c, int h, int w) {
  for (int m = 0; m < l; ++m) {
    draw_horizontal(h, c, w);
    for (int n = 0; n < c; ++n) {
      draw_vertical(w, '-');
      printf("+");
    }
    draw_vertical(w, '-');
    printf("\n");
  }
  draw_horizontal(h, c, w);
}


x86 assembly (clang, -O0):
<draw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11c6 <draw+0x96>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <draw_horizontal@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    119f <draw+0x6f>
mov    -0x10(%rbp),%edi
mov    $0x2d,%esi
call   1050 <draw_vertical@plt>
lea    0xe74(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116c <draw+0x3c>
mov    -0x10(%rbp),%edi
mov    $0x2d,%esi
call   1050 <draw_vertical@plt>
lea    0xe4f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114b <draw+0x1b>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <draw_horizontal@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%r14d
mov    %esi,%r12d
test   %edi,%edi
jle    11ad <draw+0x7d>
mov    %edi,%r15d
xor    %r13d,%r13d
jmp    116f <draw+0x3f>
nop
mov    %ebx,%edi
mov    $0x2d,%esi
call   1050 <draw_vertical@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13d
cmp    %r15d,%r13d
je     11ad <draw+0x7d>
mov    %r14d,%edi
mov    %r12d,%esi
mov    %ebx,%edx
call   1040 <draw_horizontal@plt>
mov    %r12d,%ebp
test   %r12d,%r12d
jle    1150 <draw+0x20>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%edi
mov    $0x2d,%esi
call   1050 <draw_vertical@plt>
mov    $0x2b,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1190 <draw+0x60>
jmp    1150 <draw+0x20>
mov    %r14d,%edi
mov    %r12d,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <draw_horizontal@plt>

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

LLVM IR (-O2):
define void @draw(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = icmp sgt i32 %1, 0
br label %10
8: ; preds = %13, %4
%9 = tail call i32 @draw_horizontal(i32 %2, i32 %1, i32 %3)
ret void
10: ; preds = %6, %13
%11 = phi i32 [ 0, %6 ], [ %16, %13 ]
%12 = tail call i32 @draw_horizontal(i32 %2, i32 %1, i32 %3)
br i1 %7, label %18, label %13
13: ; preds = %18, %10
%14 = tail call i32 @draw_vertical(i32 %3, i8 signext 45)
%15 = tail call i32 @putchar(i32 10)
%16 = add nuw nsw i32 %11, 1
%17 = icmp eq i32 %16, %0
br i1 %17, label %8, label %10
18: ; preds = %10, %18
%19 = phi i32 [ %22, %18 ], [ 0, %10 ]
%20 = tail call i32 @draw_vertical(i32 %3, i8 signext 45)
%21 = tail call i32 @putchar(i32 43)
%22 = add nuw nsw i32 %19, 1
%23 = icmp eq i32 %22, %1
br i1 %23, label %13, label %18
}