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


x86 assembly (clang, -O0):
<draw_horizontal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a5 <draw_horizontal+0x85>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    117e <draw_horizontal+0x5e>
mov    -0xc(%rbp),%edi
mov    $0x2e,%esi
call   1040 <draw_vertical@plt>
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114b <draw_horizontal+0x2b>
mov    -0xc(%rbp),%edi
mov    $0x2e,%esi
call   1040 <draw_vertical@plt>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1138 <draw_horizontal+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_horizontal>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
jle    118d <draw_horizontal+0x6d>
mov    %edx,%ebx
mov    %esi,%r15d
mov    %edi,%r14d
xor    %r12d,%r12d
jmp    115f <draw_horizontal+0x3f>
nopl   0x0(%rax)
mov    %ebx,%edi
mov    $0x2e,%esi
call   1040 <draw_vertical@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
cmp    %r14d,%r12d
je     118d <draw_horizontal+0x6d>
mov    %r15d,%ebp
test   %r15d,%r15d
jle    1140 <draw_horizontal+0x20>
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    $0x2e,%esi
call   1040 <draw_vertical@plt>
mov    $0x7c,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1170 <draw_horizontal+0x50>
jmp    1140 <draw_horizontal+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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