#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_init(int, int, char **, int *, int *);
int /*<<< orphan*/ draw_trailing_space(int, int, char **);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ merge_roof(int, int, char **, int);
void draw_roof(int floor, int column, char **output, int shift) {
  int row, small_column;
  draw_init(floor, column, output, &row, &small_column);
  small_column += shift;
  draw_trailing_space(row, small_column + 2, output);
  memcpy(output[row] + small_column + 2, "A", sizeof(char));
  draw_trailing_space(row - 1, small_column + 1, output);
  memcpy(output[row - 1] + small_column + 1, "/ \\", sizeof(char) * 3);
  if (small_column > 0 && output[row - 1][small_column - 1] == '\\') {
    merge_roof(floor, column, output, shift);
  }
}


x86 assembly (clang, -O0):
<draw_roof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
call   1050 <draw_init@plt>
mov    -0x14(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
add    $0x2,%esi
mov    -0x10(%rbp),%rdx
call   1060 <draw_trailing_space@plt>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
add    $0x2,%rdi
lea    0xe5b(%rip),%rsi
mov    $0x1,%edx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%edi
sub    $0x1,%edi
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%rdx
call   1060 <draw_trailing_space@plt>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
add    $0x1,%rdi
lea    0xe1b(%rip),%rsi
mov    $0x3,%edx
call   1030 <memcpy@plt>
cmpl   $0x0,-0x1c(%rbp)
jle    1234 <draw_roof+0xf4>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5c,%eax
jne    1234 <draw_roof+0xf4>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1040 <merge_roof@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_roof>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %esi,%r15d
mov    %edi,%ebp
lea    0x4(%rsp),%rcx
mov    %rsp,%r8
call   1050 <draw_init@plt>
mov    (%rsp),%eax
lea    (%rax,%r14,1),%ecx
mov    %ecx,(%rsp)
mov    0x4(%rsp),%edi
lea    (%rax,%r14,1),%esi
add    $0x2,%esi
mov    %rbx,%rdx
call   1060 <draw_trailing_space@plt>
movslq 0x4(%rsp),%rax
mov    (%rbx,%rax,8),%rax
movslq (%rsp),%rcx
lea    (%rax,%rcx,1),%rdi
add    $0x2,%rdi
lea    0xe68(%rip),%rsi
mov    $0x1,%edx
call   1030 <memcpy@plt>
mov    0x4(%rsp),%edi
add    $0xffffffff,%edi
mov    (%rsp),%esi
add    $0x1,%esi
mov    %rbx,%rdx
call   1060 <draw_trailing_space@plt>
movslq 0x4(%rsp),%rax
mov    -0x8(%rbx,%rax,8),%rax
movslq (%rsp),%rcx
lea    (%rax,%rcx,1),%rdi
add    $0x1,%rdi
lea    0xe2e(%rip),%rsi
mov    $0x3,%edx
call   1030 <memcpy@plt>
mov    (%rsp),%eax
test   %eax,%eax
jle    1208 <draw_roof+0xc8>
movslq 0x4(%rsp),%rcx
mov    -0x8(%rbx,%rcx,8),%rcx
add    $0xffffffff,%eax
cmpb   $0x5c,(%rcx,%rax,1)
jne    1208 <draw_roof+0xc8>
mov    %ebp,%edi
mov    %r15d,%esi
mov    %rbx,%rdx
mov    %r14d,%ecx
call   1040 <merge_roof@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"A\00"
@.str.1 = [4 x i8] c"/ \\\00"
define void @draw_roof(i32 %0, i32 %1, i8** %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %5 to i8*
%8 = bitcast i32* %6 to i8*
%9 = call i32 @draw_init(i32 %0, i32 %1, i8** %2, i32* %5, i32* %6)
%10 = load i32, i32* %6
%11 = add nsw i32 %10, %3
store i32 %11, i32* %6
%12 = load i32, i32* %5
%13 = add nsw i32 %11, 2
%14 = call i32 @draw_trailing_space(i32 %12, i32 %13, i8** %2)
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %2, i64 %16
%18 = load i8*, i8** %17
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = getelementptr inbounds i8, i8* %21, i64 2
%23 = call i32 @memcpy(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%24 = load i32, i32* %5
%25 = add nsw i32 %24, -1
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
%28 = call i32 @draw_trailing_space(i32 %25, i32 %27, i8** %2)
%29 = load i32, i32* %5
%30 = add nsw i32 %29, -1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %2, i64 %31
%33 = load i8*, i8** %32
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
%37 = getelementptr inbounds i8, i8* %36, i64 1
%38 = call i32 @memcpy(i8* %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%39 = load i32, i32* %6
%40 = icmp sgt i32 %39, 0
br i1 %40, label %41, label %54
41: ; preds = %4
%42 = load i32, i32* %5
%43 = add nsw i32 %42, -1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %2, i64 %44
%46 = load i8*, i8** %45
%47 = add nsw i32 %39, -1
%48 = zext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
%50 = load i8, i8* %49
%51 = icmp eq i8 %50, 92
br i1 %51, label %52, label %54
52: ; preds = %41
%53 = call i32 @merge_roof(i32 %0, i32 %1, i8** %2, i32 %3)
br label %54
54: ; preds = %52, %41, %4
ret void
}