#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*/ drawSquare(int, int, int);
void drawGeneration(int g[][30], int size) {
  int i, j;
  for (i = 0; i < size; i++)
    for (j = 0; j < size; j++)
      if (g[i][j] == 1)
        drawSquare(10 + (i * 20), 10 + (j * 20), 20);
}


x86 assembly (clang, -O0):
<drawGeneration>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a0 <drawGeneration+0x90>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118d <drawGeneration+0x7d>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0x78,%rcx,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    117a <drawGeneration+0x6a>
imul   $0x14,-0x10(%rbp),%edi
add    $0xa,%edi
imul   $0x14,-0x14(%rbp),%esi
add    $0xa,%esi
mov    $0x14,%edx
call   1030 <drawSquare@plt>
jmp    117f <drawGeneration+0x6f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <drawGeneration+0x29>
jmp    1192 <drawGeneration+0x82>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <drawGeneration+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawGeneration>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1185 <drawGeneration+0x75>
mov    %rdi,%r13
mov    %esi,%r15d
xor    %r12d,%r12d
jmp    113d <drawGeneration+0x2d>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r12
add    $0x78,%r13
cmp    %r15,%r12
je     1185 <drawGeneration+0x75>
lea    (%r12,%r12,4),%eax
lea    0xa(,%rax,4),%r14d
mov    $0xa,%ebp
xor    %ebx,%ebx
jmp    116c <drawGeneration+0x5c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
add    $0x14,%ebp
cmp    %rbx,%r15
je     1130 <drawGeneration+0x20>
cmpl   $0x1,0x0(%r13,%rbx,4)
jne    1160 <drawGeneration+0x50>
mov    %r14d,%edi
mov    %ebp,%esi
mov    $0x14,%edx
call   1030 <drawSquare@plt>
jmp    1160 <drawGeneration+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @drawGeneration([30 x i32]* %0, i32 %1) {
%3 = alloca [30 x i32]*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store [30 x i32]* %0, [30 x i32]** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %39, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %42
11: ; preds = %7
store i32 0, i32* %6
br label %12
12: ; preds = %35, %11
%13 = load i32, i32* %6
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %38
16: ; preds = %12
%17 = load [30 x i32]*, [30 x i32]** %3
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [30 x i32], [30 x i32]* %17, i64 %19
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [30 x i32], [30 x i32]* %20, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %34
26: ; preds = %16
%27 = load i32, i32* %5
%28 = mul nsw i32 %27, 20
%29 = add nsw i32 10, %28
%30 = load i32, i32* %6
%31 = mul nsw i32 %30, 20
%32 = add nsw i32 10, %31
%33 = call i32 @drawSquare(i32 %29, i32 %32, i32 20)
br label %34
34: ; preds = %26, %16
br label %35
35: ; preds = %34
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %12
38: ; preds = %12
br label %39
39: ; preds = %38
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
br label %7
42: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @drawGeneration([30 x i32]* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %27
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %24, %4
%7 = phi i64 [ 0, %4 ], [ %25, %24 ]
%8 = trunc i64 %7 to i32
%9 = mul nsw i32 %8, 20
%10 = add nuw nsw i32 %9, 10
br label %11
11: ; preds = %6, %21
%12 = phi i64 [ 0, %6 ], [ %22, %21 ]
%13 = getelementptr inbounds [30 x i32], [30 x i32]* %0, i64 %7, i64 %12
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %21
16: ; preds = %11
%17 = trunc i64 %12 to i32
%18 = mul nsw i32 %17, 20
%19 = add nuw nsw i32 %18, 10
%20 = tail call i32 @drawSquare(i32 %10, i32 %19, i32 20)
br label %21
21: ; preds = %11, %16
%22 = add nuw nsw i64 %12, 1
%23 = icmp eq i64 %22, %5
br i1 %23, label %24, label %11
24: ; preds = %21
%25 = add nuw nsw i64 %7, 1
%26 = icmp eq i64 %25, %5
br i1 %26, label %27, label %6
27: ; preds = %24, %2
ret void
}