// File: /workspace/github_c_makefile_star2_O0/skeeto[P]goblin-com/src/map.c
// Function: summarize
static void
summarize(map_t *map, uint64_t *seed)
{
    for (size_t y = 0; y < MAP_HEIGHT; y++) {
        for (size_t x = 0; x < MAP_WIDTH; x++) {
            float mean = 0;
            for (size_t sy = 0; sy < MAP_HEIGHT; sy++) {
                for (size_t sx = 0; sx < MAP_WIDTH; sx++) {
                    size_t ix = x * MAP_WIDTH + sx;
                    size_t iy = y * MAP_HEIGHT + sy;
                    mean += map->low[ix][iy].height;
                }
            }
            mean /= (MAP_WIDTH * MAP_HEIGHT);
            float std = 0;
            for (size_t sy = 0; sy < MAP_HEIGHT; sy++) {
                for (size_t sx = 0; sx < MAP_WIDTH; sx++) {
                    size_t ix = x * MAP_WIDTH + sx;
                    size_t iy = y * MAP_HEIGHT + sy;
                    float diff = mean - map->low[ix][iy].height;
                    std += diff * diff;
                }
            }
            std = sqrt(std / (MAP_HEIGHT * MAP_WIDTH));
            enum map_base base;
            if (mean < -0.8)
                base = BASE_OCEAN;
            else if (mean < -0.6)
                base = BASE_COAST;
            else if (mean < -0.5)
                base = BASE_SAND;
            else if (std > 0.05)
                base = BASE_MOUNTAIN;
            else if (std > 0.04)
                base = BASE_HILL;
            else if (rand_uniform_s(seed, -1, 1) > -0.2)
                base = BASE_GRASSLAND;
            else
                base = BASE_FOREST;
            map->high[x][y].base = base;
            map->high[x][y].building = 0;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
cmpq $0x18, -0x18(%rbp)
jae 0x5e46
movq $0x0, -0x20(%rbp)
cmpq $0x3c, -0x20(%rbp)
jae 0x5e33
xorps %xmm0, %xmm0
movss %xmm0, -0x24(%rbp)
movq $0x0, -0x30(%rbp)
cmpq $0x18, -0x30(%rbp)
jae 0x5c0f
movq $0x0, -0x38(%rbp)
cmpq $0x3c, -0x38(%rbp)
jae 0x5bff
imulq $0x3c, -0x20(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
imulq $0x18, -0x18(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
addq $0x5a00, %rax           # imm = 0x5A00
imulq $0x900, -0x40(%rbp), %rcx # imm = 0x900
addq %rcx, %rax
movq -0x48(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
addss -0x24(%rbp), %xmm0
movss %xmm0, -0x24(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x5ba8
jmp 0x5c01
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x5b99
movss -0x24(%rbp), %xmm0
movss 0x3d40(%rip), %xmm1     # 0x995c
divss %xmm1, %xmm0
movss %xmm0, -0x24(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x4c(%rbp)
movq $0x0, -0x58(%rbp)
cmpq $0x18, -0x58(%rbp)
jae 0x5cce
movq $0x0, -0x60(%rbp)
cmpq $0x3c, -0x60(%rbp)
jae 0x5cbb
imulq $0x3c, -0x20(%rbp), %rax
addq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
imulq $0x18, -0x18(%rbp), %rax
addq -0x58(%rbp), %rax
movq %rax, -0x70(%rbp)
movss -0x24(%rbp), %xmm0
movq -0x8(%rbp), %rax
addq $0x5a00, %rax           # imm = 0x5A00
imulq $0x900, -0x68(%rbp), %rcx # imm = 0x900
addq %rcx, %rax
movq -0x70(%rbp), %rcx
subss (%rax,%rcx,4), %xmm0
movss %xmm0, -0x74(%rbp)
movss -0x74(%rbp), %xmm0
movss -0x74(%rbp), %xmm2
movss -0x4c(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x4c(%rbp)
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x5c48
jmp 0x5cbd
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x5c35
movss -0x4c(%rbp), %xmm0
movss 0x3c81(%rip), %xmm1     # 0x995c
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x1270
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x4c(%rbp)
movss -0x24(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x3bfe(%rip), %xmm0     # 0x9900
ucomisd %xmm1, %xmm0
jbe 0x5d14
movl $0x20, -0x78(%rbp)
jmp 0x5ddf
movss -0x24(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x3be3(%rip), %xmm0     # 0x9908
ucomisd %xmm1, %xmm0
jbe 0x5d37
movl $0x2248, -0x78(%rbp)    # imm = 0x2248
jmp 0x5ddd
movss -0x24(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x3bb0(%rip), %xmm0     # 0x98f8
ucomisd %xmm1, %xmm0
jbe 0x5d5a
movl $0x3a, -0x78(%rbp)
jmp 0x5ddb
movss -0x4c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x3ba5(%rip), %xmm1     # 0x9910
ucomisd %xmm1, %xmm0
jbe 0x5d7a
movl $0x25b2, -0x78(%rbp)    # imm = 0x25B2
jmp 0x5dd9
movss -0x4c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x3b8d(%rip), %xmm1     # 0x9918
ucomisd %xmm1, %xmm0
jbe 0x5d9a
movl $0x2229, -0x78(%rbp)    # imm = 0x2229
jmp 0x5dd7
movq -0x10(%rbp), %rdi
movss 0x3baa(%rip), %xmm0     # 0x9950
movss 0x3ba6(%rip), %xmm1     # 0x9954
callq 0x8490
cvtss2sd %xmm0, %xmm0
movsd 0x3b61(%rip), %xmm1     # 0x9920
ucomisd %xmm1, %xmm0
jbe 0x5dce
movl $0x2e, -0x78(%rbp)
jmp 0x5dd5
movl $0x2663, -0x78(%rbp)    # imm = 0x2663
jmp 0x5dd7
jmp 0x5dd9
jmp 0x5ddb
jmp 0x5ddd
jmp 0x5ddf
movl -0x78(%rbp), %eax
movw %ax, %cx
movq -0x8(%rbp), %rax
imulq $0x180, -0x20(%rbp), %rdx # imm = 0x180
addq %rdx, %rax
movq -0x18(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movw %cx, (%rax)
movq -0x8(%rbp), %rax
imulq $0x180, -0x20(%rbp), %rcx # imm = 0x180
addq %rcx, %rax
movq -0x18(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movw $0x0, 0x2(%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x5b7e
jmp 0x5e35
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x5b6b
addq $0x80, %rsp
popq %rbp
retq
nop