#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 *, ...);
void print_display(char *disp) {
  char out;
  for (int i = 0; i < 50 * 6; i++) {
    if (i % 50 == 0 && i)
      printf("\n");
    out = disp[i] ? '#' : ' ';
    printf("%c", out);
  }
  printf("\n\n");
}


x86 assembly (clang, -O0):
<print_display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x12c,-0x10(%rbp)
jge    119b <print_display+0x8b>
mov    -0x10(%rbp),%eax
mov    $0x32,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    115c <print_display+0x4c>
cmpl   $0x0,-0x10(%rbp)
je     115c <print_display+0x4c>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
mov    $0x20,%eax
mov    $0x23,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%esi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1123 <print_display+0x13>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_display>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %r15d,%r15d
xor    %ebx,%ebx
jmp    1156 <print_display+0x36>
nop
xor    %eax,%eax
cmpb   $0x0,(%r14,%rbx,1)
setne  %al
lea    (%rax,%rax,2),%edi
or     $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
add    $0xffffffff,%r15d
cmp    $0x12c,%rbx
je     1180 <print_display+0x60>
test   %rbx,%rbx
je     1130 <print_display+0x10>
movzwl %bx,%eax
shr    %eax
imul   $0x147b,%eax,%eax
shr    $0x11,%eax
imul   $0x32,%eax,%eax
add    %r15d,%eax
test   %ax,%ax
jne    1130 <print_display+0x10>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1130 <print_display+0x10>
lea    0xe79(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <puts@plt>

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

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