#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(void *u, int w, int h) {
  int(*univ)[w] = u;
  printf("\033[H");
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++)
      printf(univ[y][x] ? "\033[07m  \033[m" : "  ");
    printf("\033[E");
  }
  fflush(stdout);
}


x86 assembly (clang, -O0):
<show>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11d3 <show+0xb3>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b9 <show+0x99>
mov    -0x28(%rbp),%rdx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xe77(%rip),%rdi
lea    0xe65(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1167 <show+0x47>
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1154 <show+0x34>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x30,%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    %edx,%r14d
mov    %esi,0x4(%rsp)
mov    %rdi,%rbx
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
test   %r14d,%r14d
jle    11cd <show+0xad>
mov    0x4(%rsp),%ebp
mov    %r14d,%eax
mov    %rax,0x10(%rsp)
lea    0x0(,%rbp,4),%rax
mov    %rax,0x8(%rsp)
xor    %r14d,%r14d
lea    0xe9f(%rip),%r15
lea    0xe8d(%rip),%r12
jmp    119c <show+0x7c>
nopl   0x0(%rax)
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
add    $0x1,%r14
add    0x8(%rsp),%rbx
cmp    0x10(%rsp),%r14
je     11cd <show+0xad>
cmpl   $0x0,0x4(%rsp)
jle    1180 <show+0x60>
xor    %r13d,%r13d
jmp    11be <show+0x9e>
nopl   0x0(%rax,%rax,1)
call   1030 <printf@plt>
add    $0x1,%r13
cmp    %r13,%rbp
je     1180 <show+0x60>
cmpl   $0x0,(%rbx,%r13,4)
mov    %r15,%rdi
je     11b0 <show+0x90>
mov    %r12,%rdi
jmp    11b0 <show+0x90>
mov    0x2e0c(%rip),%rax
mov    (%rax),%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <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 = [4 x i8] c"\1B[E\00"
@stdout = global i32 0
define void @show(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %5
%11 = zext i32 %10 to i64
%12 = load i8*, i8** %4
%13 = bitcast i8* %12 to i32*
store i32* %13, i32** %7
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %8
br label %15
15: ; preds = %43, %3
%16 = load i32, i32* %8
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %46
19: ; preds = %15
store i32 0, i32* %9
br label %20
20: ; preds = %38, %19
%21 = load i32, i32* %9
%22 = load i32, i32* %5
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %41
24: ; preds = %20
%25 = load i32*, i32** %7
%26 = load i32, i32* %8
%27 = sext i32 %26 to i64
%28 = mul nsw i64 %27, %11
%29 = getelementptr inbounds i32, i32* %25, i64 %28
%30 = load i32, i32* %9
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %29, i64 %31
%33 = load i32, i32* %32
%34 = icmp ne i32 %33, 0
%35 = zext i1 %34 to i64
%36 = select i1 %34, 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)
%37 = call i32 @printf(i8* %36)
br label %38
38: ; preds = %24
%39 = load i32, i32* %9
%40 = add nsw i32 %39, 1
store i32 %40, i32* %9
br label %20
41: ; preds = %20
%42 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %43
43: ; preds = %41
%44 = load i32, i32* %8
%45 = add nsw i32 %44, 1
store i32 %45, i32* %8
br label %15
46: ; preds = %15
%47 = load i32, i32* @stdout
%48 = call i32 @fflush(i32 %47)
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"
@.str.3 = [4 x i8] c"\1B[E\00"
@stdout = global i32 0
define void @show(i8* nocapture %0, i32 %1, i32 %2) {
%4 = zext i32 %1 to i64
%5 = bitcast i8* %0 to i32*
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = icmp sgt i32 %2, 0
br i1 %7, label %8, label %16
8: ; preds = %3
%9 = icmp sgt i32 %1, 0
%10 = zext i32 %2 to i64
br label %11
11: ; preds = %8, %19
%12 = phi i64 [ 0, %8 ], [ %21, %19 ]
br i1 %9, label %13, label %19
13: ; preds = %11
%14 = mul nuw nsw i64 %12, %4
%15 = getelementptr inbounds i32, i32* %5, i64 %14
br label %23
16: ; preds = %19, %3
%17 = load i32, i32* @stdout
%18 = tail call i32 @fflush(i32 %17)
ret void
19: ; preds = %23, %11
%20 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%21 = add nuw nsw i64 %12, 1
%22 = icmp eq i64 %21, %10
br i1 %22, label %16, label %11
23: ; preds = %13, %23
%24 = phi i64 [ 0, %13 ], [ %30, %23 ]
%25 = getelementptr inbounds i32, i32* %15, i64 %24
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, 0
%28 = select i1 %27, 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)
%29 = tail call i32 @printf(i8* dereferenceable(1) %28)
%30 = add nuw nsw i64 %24, 1
%31 = icmp eq i64 %30, %4
br i1 %31, label %19, label %23
}