#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*/ clearscreen();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ usleep(int);
void do_display(int rmin, int rmax, int cmin, int cmax, double **grid) {
  int i, j;
  int delay = 200000;
  clearscreen();
  for (i = cmin; i <= cmax; i++)
    printf("-");
  printf("\n");
  for (i = rmin; i <= rmax; i++) {
    for (j = cmin; j <= cmax; j++)
      if (grid[i][j] == 0)
        printf(" ");
      else
        printf("x");
    printf("\n");
  }
  usleep(delay);
}


x86 assembly (clang, -O0):
<do_display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
movl   $0x30d40,-0x24(%rbp)
mov    $0x0,%al
call   1030 <clearscreen@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1182 <do_display+0x52>
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115c <do_display+0x2c>
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1224 <do_display+0xf4>
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     120a <do_display+0xda>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11eb <do_display+0xbb>
jp     11eb <do_display+0xbb>
lea    0xe23(%rip),%rdi
call   1040 <printf@plt>
jmp    11f7 <do_display+0xc7>
lea    0xe14(%rip),%rdi
call   1040 <printf@plt>
jmp    11fc <do_display+0xcc>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11a6 <do_display+0x76>
lea    0xdf1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1194 <do_display+0x64>
mov    -0x24(%rbp),%edi
call   1050 <usleep@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_display>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,%rbx
mov    %ecx,%ebp
mov    %edx,%r12d
mov    %esi,0x8(%rsp)
mov    %edi,%r14d
xor    %eax,%eax
call   1040 <clearscreen@plt>
mov    %ebp,%r15d
cmp    %ebp,%r12d
jg     117f <do_display+0x4f>
mov    %r15d,%ebp
sub    %r12d,%ebp
add    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x2d,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1170 <do_display+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    0x8(%rsp),%r14d
jle    11a8 <do_display+0x78>
mov    $0x30d40,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <usleep@plt>
movslq %r12d,%rax
mov    %rax,0x10(%rsp)
movslq %r14d,%rbp
addl   $0x1,0x8(%rsp)
mov    %r15d,%eax
sub    %r12d,%eax
add    $0x1,%eax
mov    %eax,0xc(%rsp)
jmp    11e4 <do_display+0xb4>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %ebp,0x8(%rsp)
je     1190 <do_display+0x60>
cmp    %r15d,%r12d
jg     11d0 <do_display+0xa0>
mov    0xc(%rsp),%r13d
mov    0x10(%rsp),%r14
jmp    120f <do_display+0xdf>
cs nopw 0x0(%rax,%rax,1)
nop
call   1030 <putchar@plt>
add    $0x1,%r14
add    $0xffffffff,%r13d
je     11d0 <do_display+0xa0>
mov    (%rbx,%rbp,8),%rax
xorpd  %xmm0,%xmm0
ucomisd (%rax,%r14,8),%xmm0
setnp  %al
sete   %cl
mov    $0x20,%edi
test   %al,%cl
jne    1200 <do_display+0xd0>
mov    $0x78,%edi
jmp    1200 <do_display+0xd0>

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [2 x i8] c"x\00"
define void @do_display(i32 %0, i32 %1, i32 %2, i32 %3, double** %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double**
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store double** %4, double*** %10
store i32 200000, i32* %13
%14 = call i32 (...) @clearscreen()
%15 = load i32, i32* %8
store i32 %15, i32* %11
br label %16
16: ; preds = %22, %5
%17 = load i32, i32* %11
%18 = load i32, i32* %9
%19 = icmp sle i32 %17, %18
br i1 %19, label %20, label %25
20: ; preds = %16
%21 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %20
%23 = load i32, i32* %11
%24 = add nsw i32 %23, 1
store i32 %24, i32* %11
br label %16
25: ; preds = %16
%26 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%27 = load i32, i32* %6
store i32 %27, i32* %11
br label %28
28: ; preds = %59, %25
%29 = load i32, i32* %11
%30 = load i32, i32* %7
%31 = icmp sle i32 %29, %30
br i1 %31, label %32, label %62
32: ; preds = %28
%33 = load i32, i32* %8
store i32 %33, i32* %12
br label %34
34: ; preds = %54, %32
%35 = load i32, i32* %12
%36 = load i32, i32* %9
%37 = icmp sle i32 %35, %36
br i1 %37, label %38, label %57
38: ; preds = %34
%39 = load double**, double*** %10
%40 = load i32, i32* %11
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double*, double** %39, i64 %41
%43 = load double*, double** %42
%44 = load i32, i32* %12
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
%47 = load double, double* %46
%48 = fcmp oeq double %47, 0.000000e+00
br i1 %48, label %49, label %51
49: ; preds = %38
%50 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %53
51: ; preds = %38
%52 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %53
53: ; preds = %51, %49
br label %54
54: ; preds = %53
%55 = load i32, i32* %12
%56 = add nsw i32 %55, 1
store i32 %56, i32* %12
br label %34
57: ; preds = %34
%58 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %59
59: ; preds = %57
%60 = load i32, i32* %11
%61 = add nsw i32 %60, 1
store i32 %61, i32* %11
br label %28
62: ; preds = %28
%63 = load i32, i32* %13
%64 = call i32 @usleep(i32 %63)
ret void
}

LLVM IR (-O2):
define void @do_display(i32 %0, i32 %1, i32 %2, i32 %3, double** nocapture %4) {
%6 = tail call i32 (...) @clearscreen()
%7 = icmp sgt i32 %2, %3
br i1 %7, label %13, label %8
8: ; preds = %5, %8
%9 = phi i32 [ %11, %8 ], [ %2, %5 ]
%10 = tail call i32 @putchar(i32 45)
%11 = add i32 %9, 1
%12 = icmp eq i32 %9, %3
br i1 %12, label %13, label %8
13: ; preds = %8, %5
%14 = tail call i32 @putchar(i32 10)
%15 = icmp sgt i32 %0, %1
br i1 %15, label %41, label %16
16: ; preds = %13
%17 = sext i32 %2 to i64
%18 = add i32 %3, 1
%19 = sext i32 %0 to i64
%20 = add i32 %1, 1
br label %21
21: ; preds = %16, %36
%22 = phi i64 [ %19, %16 ], [ %38, %36 ]
br i1 %7, label %36, label %23
23: ; preds = %21
%24 = getelementptr inbounds double*, double** %4, i64 %22
br label %25
25: ; preds = %23, %25
%26 = phi i64 [ %17, %23 ], [ %33, %25 ]
%27 = load double*, double** %24
%28 = getelementptr inbounds double, double* %27, i64 %26
%29 = load double, double* %28
%30 = fcmp oeq double %29, 0.000000e+00
%31 = select i1 %30, i32 32, i32 120
%32 = tail call i32 @putchar(i32 %31)
%33 = add nsw i64 %26, 1
%34 = trunc i64 %33 to i32
%35 = icmp eq i32 %18, %34
br i1 %35, label %36, label %25
36: ; preds = %25, %21
%37 = tail call i32 @putchar(i32 10)
%38 = add nsw i64 %22, 1
%39 = trunc i64 %38 to i32
%40 = icmp eq i32 %20, %39
br i1 %40, label %41, label %21
41: ; preds = %36, %13
%42 = tail call i32 @usleep(i32 200000)
ret void
}