#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
void show(int width, int height, unsigned universe[height][width]) {
  printf("\033[H");
  for (int y = 0; y < height; y++) {
    for (int x = 0; x < width; x++) {
      printf(universe[y][x] ? "\033[07m  \033[m" : "  ");
    }
    printf("\n");
  }
  fflush(stdout);
}


x86 assembly (clang, -O0):
<show>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x20(%rbp)
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11cb <show+0xab>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b1 <show+0x91>
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xe7f(%rip),%rdi
lea    0xe6d(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115f <show+0x3f>
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114c <show+0x2c>
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %edi,0x4(%rsp)
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
test   %r14d,%r14d
jle    11dd <show+0xad>
mov    0x4(%rsp),%ebp
mov    %r14d,%eax
mov    %rax,0x10(%rsp)
lea    0x0(,%rbp,4),%rax
mov    %rax,0x8(%rsp)
xor    %r13d,%r13d
lea    0xe8f(%rip),%r15
lea    0xe7d(%rip),%r14
jmp    11aa <show+0x7a>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
add    0x8(%rsp),%rbx
cmp    0x10(%rsp),%r13
je     11dd <show+0xad>
cmpl   $0x0,0x4(%rsp)
jle    1190 <show+0x60>
xor    %r12d,%r12d
jmp    11ce <show+0x9e>
cs nopw 0x0(%rax,%rax,1)
call   1040 <printf@plt>
add    $0x1,%r12
cmp    %r12,%rbp
je     1190 <show+0x60>
cmpl   $0x0,(%rbx,%r12,4)
mov    %r15,%rdi
je     11c0 <show+0x90>
mov    %r14,%rdi
jmp    11c0 <show+0x90>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fflush@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"\1B[H\00"
@.str.1 = [11 x i8] c"\1B[07m \1B[m\00"
@.str.2 = [3 x i8] c" \00"
@.str.3 = [2 x i8] c"\0A\00"
@stdout = global i32 0
define void @show(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
%9 = load i32, i32* %5
%10 = zext i32 %9 to i64
%11 = load i32, i32* %4
%12 = zext i32 %11 to i64
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %14
14: ; preds = %42, %3
%15 = load i32, i32* %7
%16 = load i32, i32* %5
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %45
18: ; preds = %14
store i32 0, i32* %8
br label %19
19: ; preds = %37, %18
%20 = load i32, i32* %8
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %40
23: ; preds = %19
%24 = load i32*, i32** %6
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = mul nsw i64 %26, %12
%28 = getelementptr inbounds i32, i32* %24, i64 %27
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
%32 = load i32, i32* %31
%33 = icmp ne i32 %32, 0
%34 = zext i1 %33 to i64
%35 = select i1 %33, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%36 = call i32 @printf(i8* %35)
br label %37
37: ; preds = %23
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
store i32 %39, i32* %8
br label %19
40: ; preds = %19
%41 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %42
42: ; preds = %40
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
store i32 %44, i32* %7
br label %14
45: ; preds = %14
%46 = load i32, i32* @stdout
%47 = call i32 @fflush(i32 %46)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"\1B[H\00"
@.str.1 = [11 x i8] c"\1B[07m \1B[m\00"
@.str.2 = [3 x i8] c" \00"
@stdout = global i32 0
define void @show(i32 %0, i32 %1, i32* nocapture %2) {
%4 = zext i32 %0 to i64
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %15
7: ; preds = %3
%8 = icmp sgt i32 %0, 0
%9 = zext i32 %1 to i64
br label %10
10: ; preds = %7, %18
%11 = phi i64 [ 0, %7 ], [ %20, %18 ]
br i1 %8, label %12, label %18
12: ; preds = %10
%13 = mul nuw nsw i64 %11, %4
%14 = getelementptr inbounds i32, i32* %2, i64 %13
br label %22
15: ; preds = %18, %3
%16 = load i32, i32* @stdout
%17 = tail call i32 @fflush(i32 %16)
ret void
18: ; preds = %22, %10
%19 = tail call i32 @putchar(i32 10)
%20 = add nuw nsw i64 %11, 1
%21 = icmp eq i64 %20, %9
br i1 %21, label %15, label %10
22: ; preds = %12, %22
%23 = phi i64 [ 0, %12 ], [ %29, %22 ]
%24 = getelementptr inbounds i32, i32* %14, i64 %23
%25 = load i32, i32* %24
%26 = icmp eq i32 %25, 0
%27 = select i1 %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0)
%28 = tail call i32 @printf(i8* dereferenceable(1) %27)
%29 = add nuw nsw i64 %23, 1
%30 = icmp eq i64 %29, %4
br i1 %30, label %18, label %22
}