#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*/ getmaxyx(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ ledOff(int, int);
int /*<<< orphan*/ ledOn(int, int);
int /*<<< orphan*/ printw(char *, char *);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ stdscr;
int /*<<< orphan*/ usleep(int);
void amostra(char string[]) {
  int i, j, row, col;
  getmaxyx(stdscr, row, col);
  printw("\n\nTexto do arquivo:\n\t%s\n", string);
  for (i = 0; i < 5; i++)
    for (j = 0; j < 30; j++) {
      ledOn(i, j);
      usleep(10000);
    }
  for (i = 0; i < 5; i++)
    for (j = 0; j < 30; j++) {
      ledOff(i, j);
      usleep(10000);
    }
  refresh();
  ledOn(0, 3);
  ledOn(1, 1);
  ledOn(1, 5);
  ledOn(2, 1);
  ledOn(2, 5);
  ledOn(3, 1);
  ledOn(3, 5);
  ledOn(4, 3);
  refresh();
}


x86 assembly (clang, -O0):
<amostra>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <getmaxyx@plt>
mov    -0x8(%rbp),%rsi
lea    0xe75(%rip),%rdi
call   1050 <printw@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    11e8 <amostra+0x88>
movl   $0x0,-0x10(%rbp)
cmpl   $0x1e,-0x10(%rbp)
jge    11d5 <amostra+0x75>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1060 <ledOn@plt>
mov    $0x2710,%edi
call   1080 <usleep@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11a8 <amostra+0x48>
jmp    11da <amostra+0x7a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1197 <amostra+0x37>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1240 <amostra+0xe0>
movl   $0x0,-0x10(%rbp)
cmpl   $0x1e,-0x10(%rbp)
jge    122d <amostra+0xcd>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <ledOff@plt>
mov    $0x2710,%edi
call   1080 <usleep@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1200 <amostra+0xa0>
jmp    1232 <amostra+0xd2>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ef <amostra+0x8f>
mov    $0x0,%al
call   1070 <refresh@plt>
xor    %edi,%edi
mov    $0x3,%esi
call   1060 <ledOn@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1060 <ledOn@plt>
mov    $0x1,%edi
mov    $0x5,%esi
call   1060 <ledOn@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1060 <ledOn@plt>
mov    $0x2,%edi
mov    $0x5,%esi
call   1060 <ledOn@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1060 <ledOn@plt>
mov    $0x3,%edi
mov    $0x5,%esi
call   1060 <ledOn@plt>
mov    $0x4,%edi
mov    $0x3,%esi
call   1060 <ledOn@plt>
mov    $0x0,%al
call   1070 <refresh@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<amostra>:
push   %rbx
mov    %rdi,%rbx
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
call   1030 <getmaxyx@plt>
lea    0xe87(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printw@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %edi,%edi
mov    %ebx,%esi
call   1060 <ledOn@plt>
mov    $0x2710,%edi
call   1080 <usleep@plt>
add    $0x1,%ebx
cmp    $0x1e,%ebx
jne    1190 <amostra+0x30>
xor    %ebx,%ebx
nopl   (%rax)
mov    $0x1,%edi
mov    %ebx,%esi
call   1060 <ledOn@plt>
mov    $0x2710,%edi
call   1080 <usleep@plt>
add    $0x1,%ebx
cmp    $0x1e,%ebx
jne    11b0 <amostra+0x50>
xor    %ebx,%ebx
mov    $0x2,%edi
mov    %ebx,%esi
call   1060 <ledOn@plt>
mov    $0x2710,%edi
call   1080 <usleep@plt>
add    $0x1,%ebx
cmp    $0x1e,%ebx
jne    11d0 <amostra+0x70>
xor    %ebx,%ebx
mov    $0x3,%edi
mov    %ebx,%esi
call   1060 <ledOn@plt>
mov    $0x2710,%edi
call   1080 <usleep@plt>
add    $0x1,%ebx
cmp    $0x1e,%ebx
jne    11f0 <amostra+0x90>
xor    %ebx,%ebx
mov    $0x4,%edi
mov    %ebx,%esi
call   1060 <ledOn@plt>
mov    $0x2710,%edi
call   1080 <usleep@plt>
add    $0x1,%ebx
cmp    $0x1e,%ebx
jne    1210 <amostra+0xb0>
xor    %ebx,%ebx
xor    %edi,%edi
mov    %ebx,%esi
call   1040 <ledOff@plt>
mov    $0x2710,%edi
call   1080 <usleep@plt>
add    $0x1,%ebx
cmp    $0x1e,%ebx
jne    1230 <amostra+0xd0>
xor    %ebx,%ebx
nopl   (%rax)
mov    $0x1,%edi
mov    %ebx,%esi
call   1040 <ledOff@plt>
mov    $0x2710,%edi
call   1080 <usleep@plt>
add    $0x1,%ebx
cmp    $0x1e,%ebx
jne    1250 <amostra+0xf0>
xor    %ebx,%ebx
mov    $0x2,%edi
mov    %ebx,%esi
call   1040 <ledOff@plt>
mov    $0x2710,%edi
call   1080 <usleep@plt>
add    $0x1,%ebx
cmp    $0x1e,%ebx
jne    1270 <amostra+0x110>
xor    %ebx,%ebx
mov    $0x3,%edi
mov    %ebx,%esi
call   1040 <ledOff@plt>
mov    $0x2710,%edi
call   1080 <usleep@plt>
add    $0x1,%ebx
cmp    $0x1e,%ebx
jne    1290 <amostra+0x130>
xor    %ebx,%ebx
mov    $0x4,%edi
mov    %ebx,%esi
call   1040 <ledOff@plt>
mov    $0x2710,%edi
call   1080 <usleep@plt>
add    $0x1,%ebx
cmp    $0x1e,%ebx
jne    12b0 <amostra+0x150>
xor    %eax,%eax
call   1070 <refresh@plt>
xor    %edi,%edi
mov    $0x3,%esi
call   1060 <ledOn@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1060 <ledOn@plt>
mov    $0x1,%edi
mov    $0x5,%esi
call   1060 <ledOn@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1060 <ledOn@plt>
mov    $0x2,%edi
mov    $0x5,%esi
call   1060 <ledOn@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1060 <ledOn@plt>
mov    $0x3,%edi
mov    $0x5,%esi
call   1060 <ledOn@plt>
mov    $0x4,%edi
mov    $0x3,%esi
call   1060 <ledOn@plt>
xor    %eax,%eax
pop    %rbx
jmp    1070 <refresh@plt>

LLVM IR (-O0):
@stdscr = global i32 0
@.str = [25 x i8] c"\0A\0ATexto do arquivo:\0A\09%s\0A\00"
define void @amostra(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %2
%7 = load i32, i32* @stdscr
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @getmaxyx(i32 %7, i32 %8, i32 %9)
%11 = load i8*, i8** %2
%12 = call i32 @printw(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %11)
store i32 0, i32* %3
br label %13
13: ; preds = %29, %1
%14 = load i32, i32* %3
%15 = icmp slt i32 %14, 5
br i1 %15, label %16, label %32
16: ; preds = %13
store i32 0, i32* %4
br label %17
17: ; preds = %25, %16
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 30
br i1 %19, label %20, label %28
20: ; preds = %17
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = call i32 @ledOn(i32 %21, i32 %22)
%24 = call i32 @usleep(i32 10000)
br label %25
25: ; preds = %20
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %17
28: ; preds = %17
br label %29
29: ; preds = %28
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %13
32: ; preds = %13
store i32 0, i32* %3
br label %33
33: ; preds = %49, %32
%34 = load i32, i32* %3
%35 = icmp slt i32 %34, 5
br i1 %35, label %36, label %52
36: ; preds = %33
store i32 0, i32* %4
br label %37
37: ; preds = %45, %36
%38 = load i32, i32* %4
%39 = icmp slt i32 %38, 30
br i1 %39, label %40, label %48
40: ; preds = %37
%41 = load i32, i32* %3
%42 = load i32, i32* %4
%43 = call i32 @ledOff(i32 %41, i32 %42)
%44 = call i32 @usleep(i32 10000)
br label %45
45: ; preds = %40
%46 = load i32, i32* %4
%47 = add nsw i32 %46, 1
store i32 %47, i32* %4
br label %37
48: ; preds = %37
br label %49
49: ; preds = %48
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 1
store i32 %51, i32* %3
br label %33
52: ; preds = %33
%53 = call i32 (...) @refresh()
%54 = call i32 @ledOn(i32 0, i32 3)
%55 = call i32 @ledOn(i32 1, i32 1)
%56 = call i32 @ledOn(i32 1, i32 5)
%57 = call i32 @ledOn(i32 2, i32 1)
%58 = call i32 @ledOn(i32 2, i32 5)
%59 = call i32 @ledOn(i32 3, i32 1)
%60 = call i32 @ledOn(i32 3, i32 5)
%61 = call i32 @ledOn(i32 4, i32 3)
%62 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
@.str = [25 x i8] c"\0A\0ATexto do arquivo:\0A\09%s\0A\00"
define void @amostra(i8* %0) {
%2 = load i32, i32* @stdscr
%3 = tail call i32 @getmaxyx(i32 %2, i32 undef, i32 undef)
%4 = tail call i32 @printw(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %5
5: ; preds = %1, %5
%6 = phi i32 [ 0, %1 ], [ %9, %5 ]
%7 = tail call i32 @ledOn(i32 0, i32 %6)
%8 = tail call i32 @usleep(i32 10000)
%9 = add nuw nsw i32 %6, 1
%10 = icmp eq i32 %9, 30
br i1 %10, label %11, label %5
11: ; preds = %5, %11
%12 = phi i32 [ %15, %11 ], [ 0, %5 ]
%13 = tail call i32 @ledOn(i32 1, i32 %12)
%14 = tail call i32 @usleep(i32 10000)
%15 = add nuw nsw i32 %12, 1
%16 = icmp eq i32 %15, 30
br i1 %16, label %17, label %11
17: ; preds = %11, %17
%18 = phi i32 [ %21, %17 ], [ 0, %11 ]
%19 = tail call i32 @ledOn(i32 2, i32 %18)
%20 = tail call i32 @usleep(i32 10000)
%21 = add nuw nsw i32 %18, 1
%22 = icmp eq i32 %21, 30
br i1 %22, label %23, label %17
23: ; preds = %17, %23
%24 = phi i32 [ %27, %23 ], [ 0, %17 ]
%25 = tail call i32 @ledOn(i32 3, i32 %24)
%26 = tail call i32 @usleep(i32 10000)
%27 = add nuw nsw i32 %24, 1
%28 = icmp eq i32 %27, 30
br i1 %28, label %29, label %23
29: ; preds = %23, %29
%30 = phi i32 [ %33, %29 ], [ 0, %23 ]
%31 = tail call i32 @ledOn(i32 4, i32 %30)
%32 = tail call i32 @usleep(i32 10000)
%33 = add nuw nsw i32 %30, 1
%34 = icmp eq i32 %33, 30
br i1 %34, label %35, label %29
35: ; preds = %29, %35
%36 = phi i32 [ %39, %35 ], [ 0, %29 ]
%37 = tail call i32 @ledOff(i32 0, i32 %36)
%38 = tail call i32 @usleep(i32 10000)
%39 = add nuw nsw i32 %36, 1
%40 = icmp eq i32 %39, 30
br i1 %40, label %41, label %35
41: ; preds = %35, %41
%42 = phi i32 [ %45, %41 ], [ 0, %35 ]
%43 = tail call i32 @ledOff(i32 1, i32 %42)
%44 = tail call i32 @usleep(i32 10000)
%45 = add nuw nsw i32 %42, 1
%46 = icmp eq i32 %45, 30
br i1 %46, label %47, label %41
47: ; preds = %41, %47
%48 = phi i32 [ %51, %47 ], [ 0, %41 ]
%49 = tail call i32 @ledOff(i32 2, i32 %48)
%50 = tail call i32 @usleep(i32 10000)
%51 = add nuw nsw i32 %48, 1
%52 = icmp eq i32 %51, 30
br i1 %52, label %53, label %47
53: ; preds = %47, %53
%54 = phi i32 [ %57, %53 ], [ 0, %47 ]
%55 = tail call i32 @ledOff(i32 3, i32 %54)
%56 = tail call i32 @usleep(i32 10000)
%57 = add nuw nsw i32 %54, 1
%58 = icmp eq i32 %57, 30
br i1 %58, label %59, label %53
59: ; preds = %53, %59
%60 = phi i32 [ %63, %59 ], [ 0, %53 ]
%61 = tail call i32 @ledOff(i32 4, i32 %60)
%62 = tail call i32 @usleep(i32 10000)
%63 = add nuw nsw i32 %60, 1
%64 = icmp eq i32 %63, 30
br i1 %64, label %65, label %59
65: ; preds = %59
%66 = tail call i32 (...) @refresh()
%67 = tail call i32 @ledOn(i32 0, i32 3)
%68 = tail call i32 @ledOn(i32 1, i32 1)
%69 = tail call i32 @ledOn(i32 1, i32 5)
%70 = tail call i32 @ledOn(i32 2, i32 1)
%71 = tail call i32 @ledOn(i32 2, i32 5)
%72 = tail call i32 @ledOn(i32 3, i32 1)
%73 = tail call i32 @ledOn(i32 3, i32 5)
%74 = tail call i32 @ledOn(i32 4, i32 3)
%75 = tail call i32 (...) @refresh()
ret void
}