#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 */
typedef scalar_t__ x;

/* Variables and functions */
int /*<<< orphan*/ putInMemory(int, scalar_t__, int);
void drawBar() {
  int x, y;
  for (y = 0; y < 25; y++) {
    for (x = 0; x < 160; x++) {
      if (y < 2) {
        putInMemory(0xB000, 0x8000 + (x) + (y * 160), 0x33);
      }
      if (x == 160 - 1 && y >= 2) {
        putInMemory(0xB000, 0x8000 + (x) + (y * 160), 0x77);
      }
      if (y > 23) {
        putInMemory(0xB000, 0x8000 + (x) + (y * 160), 0x77);
      }
    }
  }
}


x86 assembly (clang, -O0):
<drawBar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
cmpl   $0x19,-0x8(%rbp)
jge    11f7 <drawBar+0xe7>
movl   $0x0,-0x4(%rbp)
cmpl   $0xa0,-0x4(%rbp)
jge    11e4 <drawBar+0xd4>
cmpl   $0x2,-0x8(%rbp)
jge    116a <drawBar+0x5a>
mov    -0x4(%rbp),%eax
add    $0x8000,%eax
imul   $0xa0,-0x8(%rbp),%ecx
add    %ecx,%eax
movslq %eax,%rsi
mov    $0xb000,%edi
mov    $0x33,%edx
call   1030 <putInMemory@plt>
cmpl   $0x9f,-0x4(%rbp)
jne    11a4 <drawBar+0x94>
cmpl   $0x2,-0x8(%rbp)
jl     11a4 <drawBar+0x94>
mov    -0x4(%rbp),%eax
add    $0x8000,%eax
imul   $0xa0,-0x8(%rbp),%ecx
add    %ecx,%eax
movslq %eax,%rsi
mov    $0xb000,%edi
mov    $0x77,%edx
call   1030 <putInMemory@plt>
cmpl   $0x17,-0x8(%rbp)
jle    11d1 <drawBar+0xc1>
mov    -0x4(%rbp),%eax
add    $0x8000,%eax
imul   $0xa0,-0x8(%rbp),%ecx
add    %ecx,%eax
movslq %eax,%rsi
mov    $0xb000,%edi
mov    $0x77,%edx
call   1030 <putInMemory@plt>
jmp    11d6 <drawBar+0xc6>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1130 <drawBar+0x20>
jmp    11e9 <drawBar+0xd9>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111f <drawBar+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawBar>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x8000,%r15d
xor    %r12d,%r12d
jmp    1141 <drawBar+0x31>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r12
add    $0xa0,%r15
cmp    $0x19,%r12
je     11ba <drawBar+0xaa>
lea    (%r12,%r12,4),%r14
shl    $0x5,%r14
add    $0x809f,%r14
xor    %ebx,%ebx
jmp    1180 <drawBar+0x70>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%r15,%rbx,1),%rsi
mov    $0xb000,%edi
mov    $0x33,%edx
call   1030 <putInMemory@plt>
add    $0x1,%rbx
cmp    $0xa0,%rbx
je     1130 <drawBar+0x20>
cmp    $0x1,%r12
jbe    1160 <drawBar+0x50>
cmp    $0x9f,%rbx
jne    11a1 <drawBar+0x91>
mov    $0xb000,%edi
mov    %r14,%rsi
mov    $0x77,%edx
call   1030 <putInMemory@plt>
cmp    $0x18,%r12
jb     1173 <drawBar+0x63>
lea    0x8f00(%rbx),%rsi
mov    $0xb000,%edi
mov    $0x77,%edx
jmp    116e <drawBar+0x5e>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @drawBar() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %2
br label %3
3: ; preds = %51, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 25
br i1 %5, label %6, label %54
6: ; preds = %3
store i32 0, i32* %1
br label %7
7: ; preds = %47, %6
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 160
br i1 %9, label %10, label %50
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 2
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = load i32, i32* %1
%15 = add nsw i32 32768, %14
%16 = load i32, i32* %2
%17 = mul nsw i32 %16, 160
%18 = add nsw i32 %15, %17
%19 = sext i32 %18 to i64
%20 = call i32 @putInMemory(i32 45056, i64 %19, i32 51)
br label %21
21: ; preds = %13, %10
%22 = load i32, i32* %1
%23 = icmp eq i32 %22, 159
br i1 %23, label %24, label %35
24: ; preds = %21
%25 = load i32, i32* %2
%26 = icmp sge i32 %25, 2
br i1 %26, label %27, label %35
27: ; preds = %24
%28 = load i32, i32* %1
%29 = add nsw i32 32768, %28
%30 = load i32, i32* %2
%31 = mul nsw i32 %30, 160
%32 = add nsw i32 %29, %31
%33 = sext i32 %32 to i64
%34 = call i32 @putInMemory(i32 45056, i64 %33, i32 119)
br label %35
35: ; preds = %27, %24, %21
%36 = load i32, i32* %2
%37 = icmp sgt i32 %36, 23
br i1 %37, label %38, label %46
38: ; preds = %35
%39 = load i32, i32* %1
%40 = add nsw i32 32768, %39
%41 = load i32, i32* %2
%42 = mul nsw i32 %41, 160
%43 = add nsw i32 %40, %42
%44 = sext i32 %43 to i64
%45 = call i32 @putInMemory(i32 45056, i64 %44, i32 119)
br label %46
46: ; preds = %38, %35
br label %47
47: ; preds = %46
%48 = load i32, i32* %1
%49 = add nsw i32 %48, 1
store i32 %49, i32* %1
br label %7
50: ; preds = %7
br label %51
51: ; preds = %50
%52 = load i32, i32* %2
%53 = add nsw i32 %52, 1
store i32 %53, i32* %2
br label %3
54: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @drawBar() {
br label %1
1: ; preds = %0, %24
%2 = phi i64 [ 0, %0 ], [ %25, %24 ]
%3 = icmp ult i64 %2, 2
%4 = mul nuw nsw i64 %2, 160
%5 = add nuw nsw i64 %4, 32927
%6 = icmp ugt i64 %2, 23
%7 = add nuw nsw i64 %4, 32768
br label %8
8: ; preds = %1, %21
%9 = phi i64 [ 0, %1 ], [ %22, %21 ]
br i1 %3, label %10, label %13
10: ; preds = %8
%11 = add nuw nsw i64 %7, %9
%12 = tail call i32 @putInMemory(i32 45056, i64 %11, i32 51)
br label %21
13: ; preds = %8
%14 = icmp eq i64 %9, 159
br i1 %14, label %15, label %17
15: ; preds = %13
%16 = tail call i32 @putInMemory(i32 45056, i64 %5, i32 119)
br label %17
17: ; preds = %15, %13
br i1 %6, label %18, label %21
18: ; preds = %17
%19 = add nuw nsw i64 %9, 36608
%20 = tail call i32 @putInMemory(i32 45056, i64 %19, i32 119)
br label %21
21: ; preds = %10, %17, %18
%22 = add nuw nsw i64 %9, 1
%23 = icmp eq i64 %22, 160
br i1 %23, label %24, label %8
24: ; preds = %21
%25 = add nuw nsw i64 %2, 1
%26 = icmp eq i64 %25, 25
br i1 %26, label %27, label %1
27: ; preds = %24
ret void
}