#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*/ get_varible_strlen_max(int *, char ***, int);
int /*<<< orphan*/ print_bot_line(int *);
int /*<<< orphan*/ print_box_letters(char **, int *, int);
int /*<<< orphan*/ print_mid_line(int *);
int /*<<< orphan*/ print_top_line(int *);
void print_box(char box_line_list[][7][512], int list_count) {
  int i;
  int var_strlen_max[7];
  get_varible_strlen_max(var_strlen_max, box_line_list, list_count);
  print_top_line(var_strlen_max);
  for (i = 0; i < list_count; i++) {
    if (i) {
      print_box_letters(box_line_list[i], var_strlen_max, 0);
    } else {
      print_box_letters(box_line_list[i], var_strlen_max, 1);
    }
    if (i < list_count - 1) {
      print_mid_line(var_strlen_max);
    }
  }
  print_bot_line(var_strlen_max);
}


x86 assembly (clang, -O0):
<print_box>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1070 <get_varible_strlen_max@plt>
lea    -0x30(%rbp),%rdi
call   1030 <print_top_line@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1204 <print_box+0xb4>
cmpl   $0x0,-0x10(%rbp)
je     11b7 <print_box+0x67>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
imul   $0xe00,%rax,%rax
add    %rax,%rdi
lea    -0x30(%rbp),%rsi
xor    %edx,%edx
call   1050 <print_box_letters@plt>
jmp    11d7 <print_box+0x87>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
imul   $0xe00,%rax,%rax
add    %rax,%rdi
lea    -0x30(%rbp),%rsi
mov    $0x1,%edx
call   1050 <print_box_letters@plt>
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11f1 <print_box+0xa1>
lea    -0x30(%rbp),%rdi
call   1040 <print_mid_line@plt>
jmp    11f6 <print_box+0xa6>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117f <print_box+0x2f>
lea    -0x30(%rbp),%rdi
call   1060 <print_bot_line@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_box>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %esi,%r14d
mov    %rdi,%r13
mov    %rsp,%r15
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r14d,%edx
call   1070 <get_varible_strlen_max@plt>
mov    %r15,%rdi
call   1030 <print_top_line@plt>
test   %r14d,%r14d
jle    1197 <print_box+0x47>
mov    %rsp,%rsi
mov    %r13,%rdi
mov    $0x1,%edx
call   1050 <print_box_letters@plt>
cmp    $0x1,%r14d
jne    11ad <print_box+0x5d>
mov    %rsp,%rdi
call   1060 <print_bot_line@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    -0x1(%r14),%r15d
mov    %r14d,%r12d
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <print_mid_line@plt>
add    $0xe00,%r13
mov    $0x1,%ebx
jmp    11e0 <print_box+0x90>
nopl   (%rax)
add    $0x1,%rbx
add    $0xe00,%r13
cmp    %rbx,%r12
je     1197 <print_box+0x47>
mov    %r13,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1050 <print_box_letters@plt>
cmp    %r15,%rbx
jae    11d0 <print_box+0x80>
mov    %r14,%rdi
call   1040 <print_mid_line@plt>
jmp    11d0 <print_box+0x80>

LLVM IR (-O0):
define void @print_box([7 x [512 x i8]]* %0, i32 %1) {
%3 = alloca [7 x [512 x i8]]*
%4 = alloca i32
%5 = alloca i32
%6 = alloca [7 x i32]
store [7 x [512 x i8]]* %0, [7 x [512 x i8]]** %3
store i32 %1, i32* %4
%7 = getelementptr inbounds [7 x i32], [7 x i32]* %6, i64 0, i64 0
%8 = load [7 x [512 x i8]]*, [7 x [512 x i8]]** %3
%9 = bitcast [7 x [512 x i8]]* %8 to i8***
%10 = load i32, i32* %4
%11 = call i32 @get_varible_strlen_max(i32* %7, i8*** %9, i32 %10)
%12 = getelementptr inbounds [7 x i32], [7 x i32]* %6, i64 0, i64 0
%13 = call i32 @print_top_line(i32* %12)
store i32 0, i32* %5
br label %14
14: ; preds = %48, %2
%15 = load i32, i32* %5
%16 = load i32, i32* %4
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %51
18: ; preds = %14
%19 = load i32, i32* %5
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %30
21: ; preds = %18
%22 = load [7 x [512 x i8]]*, [7 x [512 x i8]]** %3
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [7 x [512 x i8]], [7 x [512 x i8]]* %22, i64 %24
%26 = getelementptr inbounds [7 x [512 x i8]], [7 x [512 x i8]]* %25, i64 0, i64 0
%27 = bitcast [512 x i8]* %26 to i8**
%28 = getelementptr inbounds [7 x i32], [7 x i32]* %6, i64 0, i64 0
%29 = call i32 @print_box_letters(i8** %27, i32* %28, i32 0)
br label %39
30: ; preds = %18
%31 = load [7 x [512 x i8]]*, [7 x [512 x i8]]** %3
%32 = load i32, i32* %5
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [7 x [512 x i8]], [7 x [512 x i8]]* %31, i64 %33
%35 = getelementptr inbounds [7 x [512 x i8]], [7 x [512 x i8]]* %34, i64 0, i64 0
%36 = bitcast [512 x i8]* %35 to i8**
%37 = getelementptr inbounds [7 x i32], [7 x i32]* %6, i64 0, i64 0
%38 = call i32 @print_box_letters(i8** %36, i32* %37, i32 1)
br label %39
39: ; preds = %30, %21
%40 = load i32, i32* %5
%41 = load i32, i32* %4
%42 = sub nsw i32 %41, 1
%43 = icmp slt i32 %40, %42
br i1 %43, label %44, label %47
44: ; preds = %39
%45 = getelementptr inbounds [7 x i32], [7 x i32]* %6, i64 0, i64 0
%46 = call i32 @print_mid_line(i32* %45)
br label %47
47: ; preds = %44, %39
br label %48
48: ; preds = %47
%49 = load i32, i32* %5
%50 = add nsw i32 %49, 1
store i32 %50, i32* %5
br label %14
51: ; preds = %14
%52 = getelementptr inbounds [7 x i32], [7 x i32]* %6, i64 0, i64 0
%53 = call i32 @print_bot_line(i32* %52)
ret void
}

LLVM IR (-O2):
define void @print_box([7 x [512 x i8]]* %0, i32 %1) {
%3 = alloca [7 x i32]
%4 = bitcast [7 x i32]* %3 to i8*
%5 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
%6 = bitcast [7 x [512 x i8]]* %0 to i8***
%7 = call i32 @get_varible_strlen_max(i32* %5, i8*** %6, i32 %1)
%8 = call i32 @print_top_line(i32* %5)
%9 = icmp sgt i32 %1, 0
br i1 %9, label %10, label %30
10: ; preds = %2
%11 = add nsw i32 %1, -1
%12 = zext i32 %11 to i64
%13 = zext i32 %1 to i64
%14 = bitcast [7 x [512 x i8]]* %0 to i8**
%15 = call i32 @print_box_letters(i8** %14, i32* %5, i32 1)
%16 = icmp eq i32 %1, 1
br i1 %16, label %30, label %17
17: ; preds = %10
%18 = call i32 @print_mid_line(i32* %5)
br label %19
19: ; preds = %17, %27
%20 = phi i64 [ 1, %17 ], [ %28, %27 ]
%21 = getelementptr inbounds [7 x [512 x i8]], [7 x [512 x i8]]* %0, i64 %20, i64 0
%22 = bitcast [512 x i8]* %21 to i8**
%23 = call i32 @print_box_letters(i8** %22, i32* %5, i32 0)
%24 = icmp ult i64 %20, %12
br i1 %24, label %25, label %27
25: ; preds = %19
%26 = call i32 @print_mid_line(i32* %5)
br label %27
27: ; preds = %19, %25
%28 = add nuw nsw i64 %20, 1
%29 = icmp eq i64 %28, %13
br i1 %29, label %30, label %19
30: ; preds = %27, %10, %2
%31 = call i32 @print_bot_line(i32* %5)
ret void
}