#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 /*<<< orphan*/ putchar(char);
void vertical(int len, char word[]) {
  int i;
  for (i = 0; i < len; ++i)
    printf("-\n");
  for (i = 0; i < len; ++i)
    putchar(word[i]);
  putchar('\n');
}


x86 assembly (clang, -O0):
<vertical>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115c <vertical+0x3c>
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1136 <vertical+0x16>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    118e <vertical+0x6e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1163 <vertical+0x43>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vertical>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    1173 <vertical+0x53>
mov    %rsi,%r15
mov    %edi,%r14d
lea    0xec8(%rip),%rbp
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1040 <puts@plt>
add    $0xffffffff,%ebx
jne    1140 <vertical+0x20>
test   %r14d,%r14d
jle    1173 <vertical+0x53>
mov    %r14d,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1160 <vertical+0x40>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@str = [2 x i8] c"-\00"
define void @vertical(i32 %0, i8* nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %7, label %19
4: ; preds = %7
br i1 %3, label %5, label %19
5: ; preds = %4
%6 = zext i32 %0 to i64
br label %12
7: ; preds = %2, %7
%8 = phi i32 [ %10, %7 ], [ 0, %2 ]
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%10 = add nuw nsw i32 %8, 1
%11 = icmp eq i32 %10, %0
br i1 %11, label %4, label %7
12: ; preds = %5, %12
%13 = phi i64 [ 0, %5 ], [ %17, %12 ]
%14 = getelementptr inbounds i8, i8* %1, i64 %13
%15 = load i8, i8* %14
%16 = tail call i32 @putchar(i8 signext %15)
%17 = add nuw nsw i64 %13, 1
%18 = icmp eq i64 %17, %6
br i1 %18, label %19, label %12
19: ; preds = %12, %2, %4
%20 = tail call i32 @putchar(i8 signext 10)
ret void
}