// File: eugene87222[P]Game-of-Life/gol.cpp
// Function: update(int, int)
void update(int height, int width) {
    new_board = board;
    for(int i = 1; i < height+1; i++) {
        for(int j = 1; j < width+1; j++) {
            int alive = board[i-1][j-1] + board[i-1][j] + board[i-1][j+1] + 
                        board[i][j-1] + board[i][j+1] + 
                        board[i+1][j-1] + board[i+1][j] + board[i+1][j+1];
            if(board[i][j] == 1) {
                if(alive != 2 && alive != 3) {
                    new_board[i][j] = 0;
                }
            }
            else {
                if(alive == 3){
                    new_board[i][j] = 1;
                }
            }
        }
    }
    board = new_board;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
leaq 0xae63(%rip), %rdi      # 0xe198
leaq 0xae44(%rip), %rsi      # 0xe180
callq 0x42b0
movl $0x1, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl -0x4(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x357a
movl $0x1, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl -0x8(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x356a
movl -0xc(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0xadff(%rip), %rdi      # 0xe180
callq 0x4270
movq %rax, %rdi
movl -0x10(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x4290
movl (%rax), %eax
movl %eax, -0x30(%rbp)
movl -0xc(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0xadd4(%rip), %rdi      # 0xe180
callq 0x4270
movq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0x4290
movq %rax, %rcx
movl -0x30(%rbp), %eax
addl (%rcx), %eax
movl %eax, -0x2c(%rbp)
movl -0xc(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0xada8(%rip), %rdi      # 0xe180
callq 0x4270
movq %rax, %rdi
movl -0x10(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x4290
movq %rax, %rcx
movl -0x2c(%rbp), %eax
addl (%rcx), %eax
movl %eax, -0x28(%rbp)
movslq -0xc(%rbp), %rsi
leaq 0xad7c(%rip), %rdi      # 0xe180
callq 0x4270
movq %rax, %rdi
movl -0x10(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x4290
movq %rax, %rcx
movl -0x28(%rbp), %eax
addl (%rcx), %eax
movl %eax, -0x24(%rbp)
movslq -0xc(%rbp), %rsi
leaq 0xad50(%rip), %rdi      # 0xe180
callq 0x4270
movq %rax, %rdi
movl -0x10(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x4290
movq %rax, %rcx
movl -0x24(%rbp), %eax
addl (%rcx), %eax
movl %eax, -0x20(%rbp)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq 0xad1f(%rip), %rdi      # 0xe180
callq 0x4270
movq %rax, %rdi
movl -0x10(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x4290
movq %rax, %rcx
movl -0x20(%rbp), %eax
addl (%rcx), %eax
movl %eax, -0x1c(%rbp)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq 0xacee(%rip), %rdi      # 0xe180
callq 0x4270
movq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0x4290
movq %rax, %rcx
movl -0x1c(%rbp), %eax
addl (%rcx), %eax
movl %eax, -0x18(%rbp)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq 0xacc2(%rip), %rdi      # 0xe180
callq 0x4270
movq %rax, %rdi
movl -0x10(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x4290
movq %rax, %rcx
movl -0x18(%rbp), %eax
addl (%rcx), %eax
movl %eax, -0x14(%rbp)
movslq -0xc(%rbp), %rsi
leaq 0xac96(%rip), %rdi      # 0xe180
callq 0x4270
movq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0x4290
cmpl $0x1, (%rax)
jne 0x3530
cmpl $0x2, -0x14(%rbp)
je 0x352e
cmpl $0x3, -0x14(%rbp)
je 0x352e
movslq -0xc(%rbp), %rsi
leaq 0xac81(%rip), %rdi      # 0xe198
callq 0x4270
movq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0x4290
movl $0x0, (%rax)
jmp 0x355a
cmpl $0x3, -0x14(%rbp)
jne 0x3558
movslq -0xc(%rbp), %rsi
leaq 0xac57(%rip), %rdi      # 0xe198
callq 0x4270
movq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0x4290
movl $0x1, (%rax)
jmp 0x355a
jmp 0x355c
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x3360
jmp 0x356c
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3348
leaq 0xabff(%rip), %rdi      # 0xe180
leaq 0xac10(%rip), %rsi      # 0xe198
callq 0x42b0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)