#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*/ colInHigh();
int /*<<< orphan*/ colInLow();
int /*<<< orphan*/ colclk();
int /*<<< orphan*/ latch();
int /*<<< orphan*/ resetRows();
int /*<<< orphan*/ rowclk();
int /*<<< orphan*/ usleep(int);
void refresh(bool **screen) {
  int col, row;
  resetRows();
  for (row = 8 - 1; row >= 0; row--) {
    for (col = 76 - 1; col >= 0; col--) {
      if (screen[row][col] == true) {
        colInHigh();
      } else {
        colInLow();
      }
      colclk();
    }
    latch();
    rowclk();
    usleep(1800);
  }
  return;
}


x86 assembly (clang, -O0):
<refresh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1080 <resetRows@plt>
movl   $0x7,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     120d <refresh+0x9d>
movl   $0x4b,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     11e7 <refresh+0x77>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    11cb <refresh+0x5b>
mov    $0x0,%al
call   1030 <colInHigh@plt>
jmp    11d2 <refresh+0x62>
mov    $0x0,%al
call   1060 <colInLow@plt>
mov    $0x0,%al
call   1070 <colclk@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    119b <refresh+0x2b>
mov    $0x0,%al
call   1040 <latch@plt>
mov    $0x0,%al
call   1050 <rowclk@plt>
mov    $0x708,%edi
call   1090 <usleep@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    118a <refresh+0x1a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<refresh>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1080 <resetRows@plt>
mov    $0x4b,%ebx
jmp    11a4 <refresh+0x34>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1060 <colInLow@plt>
xor    %eax,%eax
call   1070 <colclk@plt>
add    $0xffffffffffffffff,%rbx
jae    11b7 <refresh+0x47>
mov    0x38(%r14),%rax
cmpl   $0x1,(%rax,%rbx,4)
jne    1190 <refresh+0x20>
xor    %eax,%eax
call   1030 <colInHigh@plt>
jmp    1197 <refresh+0x27>
xor    %eax,%eax
call   1040 <latch@plt>
xor    %eax,%eax
call   1050 <rowclk@plt>
mov    $0x708,%edi
call   1090 <usleep@plt>
mov    $0x4b,%ebx
jmp    11f4 <refresh+0x84>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <colInHigh@plt>
xor    %eax,%eax
call   1070 <colclk@plt>
add    $0xffffffffffffffff,%rbx
jae    1207 <refresh+0x97>
mov    0x30(%r14),%rax
cmpl   $0x1,(%rax,%rbx,4)
je     11e0 <refresh+0x70>
xor    %eax,%eax
call   1060 <colInLow@plt>
jmp    11e7 <refresh+0x77>
xor    %eax,%eax
call   1040 <latch@plt>
xor    %eax,%eax
call   1050 <rowclk@plt>
mov    $0x708,%edi
call   1090 <usleep@plt>
mov    $0x4b,%ebx
jmp    1244 <refresh+0xd4>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <colInHigh@plt>
xor    %eax,%eax
call   1070 <colclk@plt>
add    $0xffffffffffffffff,%rbx
jae    1257 <refresh+0xe7>
mov    0x28(%r14),%rax
cmpl   $0x1,(%rax,%rbx,4)
je     1230 <refresh+0xc0>
xor    %eax,%eax
call   1060 <colInLow@plt>
jmp    1237 <refresh+0xc7>
xor    %eax,%eax
call   1040 <latch@plt>
xor    %eax,%eax
call   1050 <rowclk@plt>
mov    $0x708,%edi
call   1090 <usleep@plt>
mov    $0x4b,%ebx
jmp    1294 <refresh+0x124>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <colInHigh@plt>
xor    %eax,%eax
call   1070 <colclk@plt>
add    $0xffffffffffffffff,%rbx
jae    12a7 <refresh+0x137>
mov    0x20(%r14),%rax
cmpl   $0x1,(%rax,%rbx,4)
je     1280 <refresh+0x110>
xor    %eax,%eax
call   1060 <colInLow@plt>
jmp    1287 <refresh+0x117>
xor    %eax,%eax
call   1040 <latch@plt>
xor    %eax,%eax
call   1050 <rowclk@plt>
mov    $0x708,%edi
call   1090 <usleep@plt>
mov    $0x4b,%ebx
jmp    12e4 <refresh+0x174>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <colInHigh@plt>
xor    %eax,%eax
call   1070 <colclk@plt>
add    $0xffffffffffffffff,%rbx
jae    12f7 <refresh+0x187>
mov    0x18(%r14),%rax
cmpl   $0x1,(%rax,%rbx,4)
je     12d0 <refresh+0x160>
xor    %eax,%eax
call   1060 <colInLow@plt>
jmp    12d7 <refresh+0x167>
xor    %eax,%eax
call   1040 <latch@plt>
xor    %eax,%eax
call   1050 <rowclk@plt>
mov    $0x708,%edi
call   1090 <usleep@plt>
mov    $0x4b,%ebx
jmp    1334 <refresh+0x1c4>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <colInHigh@plt>
xor    %eax,%eax
call   1070 <colclk@plt>
add    $0xffffffffffffffff,%rbx
jae    1347 <refresh+0x1d7>
mov    0x10(%r14),%rax
cmpl   $0x1,(%rax,%rbx,4)
je     1320 <refresh+0x1b0>
xor    %eax,%eax
call   1060 <colInLow@plt>
jmp    1327 <refresh+0x1b7>
xor    %eax,%eax
call   1040 <latch@plt>
xor    %eax,%eax
call   1050 <rowclk@plt>
mov    $0x708,%edi
call   1090 <usleep@plt>
mov    $0x4b,%ebx
jmp    1384 <refresh+0x214>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <colInHigh@plt>
xor    %eax,%eax
call   1070 <colclk@plt>
add    $0xffffffffffffffff,%rbx
jae    1397 <refresh+0x227>
mov    0x8(%r14),%rax
cmpl   $0x1,(%rax,%rbx,4)
je     1370 <refresh+0x200>
xor    %eax,%eax
call   1060 <colInLow@plt>
jmp    1377 <refresh+0x207>
xor    %eax,%eax
call   1040 <latch@plt>
xor    %eax,%eax
call   1050 <rowclk@plt>
mov    $0x708,%edi
call   1090 <usleep@plt>
mov    $0x4b,%ebx
jmp    13d4 <refresh+0x264>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <colInHigh@plt>
xor    %eax,%eax
call   1070 <colclk@plt>
add    $0xffffffffffffffff,%rbx
jae    13e6 <refresh+0x276>
mov    (%r14),%rax
cmpl   $0x1,(%rax,%rbx,4)
je     13c0 <refresh+0x250>
xor    %eax,%eax
call   1060 <colInLow@plt>
jmp    13c7 <refresh+0x257>
xor    %eax,%eax
call   1040 <latch@plt>
xor    %eax,%eax
call   1050 <rowclk@plt>
mov    $0x708,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1090 <usleep@plt>

LLVM IR (-O0):
define void @refresh(i32** %0) {
%2 = alloca i32**
%3 = alloca i32
%4 = alloca i32
store i32** %0, i32*** %2
%5 = call i32 (...) @resetRows()
store i32 7, i32* %4
br label %6
6: ; preds = %37, %1
%7 = load i32, i32* %4
%8 = icmp sge i32 %7, 0
br i1 %8, label %9, label %40
9: ; preds = %6
store i32 75, i32* %3
br label %10
10: ; preds = %30, %9
%11 = load i32, i32* %3
%12 = icmp sge i32 %11, 0
br i1 %12, label %13, label %33
13: ; preds = %10
%14 = load i32**, i32*** %2
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32*, i32** %14, i64 %16
%18 = load i32*, i32** %17
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %26
24: ; preds = %13
%25 = call i32 (...) @colInHigh()
br label %28
26: ; preds = %13
%27 = call i32 (...) @colInLow()
br label %28
28: ; preds = %26, %24
%29 = call i32 (...) @colclk()
br label %30
30: ; preds = %28
%31 = load i32, i32* %3
%32 = add nsw i32 %31, -1
store i32 %32, i32* %3
br label %10
33: ; preds = %10
%34 = call i32 (...) @latch()
%35 = call i32 (...) @rowclk()
%36 = call i32 @usleep(i32 1800)
br label %37
37: ; preds = %33
%38 = load i32, i32* %4
%39 = add nsw i32 %38, -1
store i32 %39, i32* %4
br label %6
40: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @refresh(i32** nocapture %0) {
%2 = tail call i32 (...) @resetRows()
%3 = getelementptr inbounds i32*, i32** %0, i64 7
br label %4
4: ; preds = %1, %14
%5 = phi i64 [ 75, %1 ], [ %16, %14 ]
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 %5
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = tail call i32 (...) @colInHigh()
br label %14
12: ; preds = %4
%13 = tail call i32 (...) @colInLow()
br label %14
14: ; preds = %12, %10
%15 = tail call i32 (...) @colclk()
%16 = add nsw i64 %5, -1
%17 = icmp eq i64 %5, 0
br i1 %17, label %18, label %4
18: ; preds = %14
%19 = tail call i32 (...) @latch()
%20 = tail call i32 (...) @rowclk()
%21 = tail call i32 @usleep(i32 1800)
%22 = getelementptr inbounds i32*, i32** %0, i64 6
br label %23
23: ; preds = %33, %18
%24 = phi i64 [ 75, %18 ], [ %35, %33 ]
%25 = load i32*, i32** %22
%26 = getelementptr inbounds i32, i32* %25, i64 %24
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, 1
br i1 %28, label %31, label %29
29: ; preds = %23
%30 = tail call i32 (...) @colInLow()
br label %33
31: ; preds = %23
%32 = tail call i32 (...) @colInHigh()
br label %33
33: ; preds = %31, %29
%34 = tail call i32 (...) @colclk()
%35 = add nsw i64 %24, -1
%36 = icmp eq i64 %24, 0
br i1 %36, label %37, label %23
37: ; preds = %33
%38 = tail call i32 (...) @latch()
%39 = tail call i32 (...) @rowclk()
%40 = tail call i32 @usleep(i32 1800)
%41 = getelementptr inbounds i32*, i32** %0, i64 5
br label %42
42: ; preds = %52, %37
%43 = phi i64 [ 75, %37 ], [ %54, %52 ]
%44 = load i32*, i32** %41
%45 = getelementptr inbounds i32, i32* %44, i64 %43
%46 = load i32, i32* %45
%47 = icmp eq i32 %46, 1
br i1 %47, label %50, label %48
48: ; preds = %42
%49 = tail call i32 (...) @colInLow()
br label %52
50: ; preds = %42
%51 = tail call i32 (...) @colInHigh()
br label %52
52: ; preds = %50, %48
%53 = tail call i32 (...) @colclk()
%54 = add nsw i64 %43, -1
%55 = icmp eq i64 %43, 0
br i1 %55, label %56, label %42
56: ; preds = %52
%57 = tail call i32 (...) @latch()
%58 = tail call i32 (...) @rowclk()
%59 = tail call i32 @usleep(i32 1800)
%60 = getelementptr inbounds i32*, i32** %0, i64 4
br label %61
61: ; preds = %71, %56
%62 = phi i64 [ 75, %56 ], [ %73, %71 ]
%63 = load i32*, i32** %60
%64 = getelementptr inbounds i32, i32* %63, i64 %62
%65 = load i32, i32* %64
%66 = icmp eq i32 %65, 1
br i1 %66, label %69, label %67
67: ; preds = %61
%68 = tail call i32 (...) @colInLow()
br label %71
69: ; preds = %61
%70 = tail call i32 (...) @colInHigh()
br label %71
71: ; preds = %69, %67
%72 = tail call i32 (...) @colclk()
%73 = add nsw i64 %62, -1
%74 = icmp eq i64 %62, 0
br i1 %74, label %75, label %61
75: ; preds = %71
%76 = tail call i32 (...) @latch()
%77 = tail call i32 (...) @rowclk()
%78 = tail call i32 @usleep(i32 1800)
%79 = getelementptr inbounds i32*, i32** %0, i64 3
br label %80
80: ; preds = %90, %75
%81 = phi i64 [ 75, %75 ], [ %92, %90 ]
%82 = load i32*, i32** %79
%83 = getelementptr inbounds i32, i32* %82, i64 %81
%84 = load i32, i32* %83
%85 = icmp eq i32 %84, 1
br i1 %85, label %88, label %86
86: ; preds = %80
%87 = tail call i32 (...) @colInLow()
br label %90
88: ; preds = %80
%89 = tail call i32 (...) @colInHigh()
br label %90
90: ; preds = %88, %86
%91 = tail call i32 (...) @colclk()
%92 = add nsw i64 %81, -1
%93 = icmp eq i64 %81, 0
br i1 %93, label %94, label %80
94: ; preds = %90
%95 = tail call i32 (...) @latch()
%96 = tail call i32 (...) @rowclk()
%97 = tail call i32 @usleep(i32 1800)
%98 = getelementptr inbounds i32*, i32** %0, i64 2
br label %99
99: ; preds = %109, %94
%100 = phi i64 [ 75, %94 ], [ %111, %109 ]
%101 = load i32*, i32** %98
%102 = getelementptr inbounds i32, i32* %101, i64 %100
%103 = load i32, i32* %102
%104 = icmp eq i32 %103, 1
br i1 %104, label %107, label %105
105: ; preds = %99
%106 = tail call i32 (...) @colInLow()
br label %109
107: ; preds = %99
%108 = tail call i32 (...) @colInHigh()
br label %109
109: ; preds = %107, %105
%110 = tail call i32 (...) @colclk()
%111 = add nsw i64 %100, -1
%112 = icmp eq i64 %100, 0
br i1 %112, label %113, label %99
113: ; preds = %109
%114 = tail call i32 (...) @latch()
%115 = tail call i32 (...) @rowclk()
%116 = tail call i32 @usleep(i32 1800)
%117 = getelementptr inbounds i32*, i32** %0, i64 1
br label %118
118: ; preds = %128, %113
%119 = phi i64 [ 75, %113 ], [ %130, %128 ]
%120 = load i32*, i32** %117
%121 = getelementptr inbounds i32, i32* %120, i64 %119
%122 = load i32, i32* %121
%123 = icmp eq i32 %122, 1
br i1 %123, label %126, label %124
124: ; preds = %118
%125 = tail call i32 (...) @colInLow()
br label %128
126: ; preds = %118
%127 = tail call i32 (...) @colInHigh()
br label %128
128: ; preds = %126, %124
%129 = tail call i32 (...) @colclk()
%130 = add nsw i64 %119, -1
%131 = icmp eq i64 %119, 0
br i1 %131, label %132, label %118
132: ; preds = %128
%133 = tail call i32 (...) @latch()
%134 = tail call i32 (...) @rowclk()
%135 = tail call i32 @usleep(i32 1800)
br label %136
136: ; preds = %146, %132
%137 = phi i64 [ 75, %132 ], [ %148, %146 ]
%138 = load i32*, i32** %0
%139 = getelementptr inbounds i32, i32* %138, i64 %137
%140 = load i32, i32* %139
%141 = icmp eq i32 %140, 1
br i1 %141, label %144, label %142
142: ; preds = %136
%143 = tail call i32 (...) @colInLow()
br label %146
144: ; preds = %136
%145 = tail call i32 (...) @colInHigh()
br label %146
146: ; preds = %144, %142
%147 = tail call i32 (...) @colclk()
%148 = add nsw i64 %137, -1
%149 = icmp eq i64 %137, 0
br i1 %149, label %150, label %136
150: ; preds = %146
%151 = tail call i32 (...) @latch()
%152 = tail call i32 (...) @rowclk()
%153 = tail call i32 @usleep(i32 1800)
ret void
}