// File: /workspace/github_cpp_makefile_star2_O1/ThePhage[P]horse_tornado/fast.cpp
// Function: (anonymous namespace)::read_png(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
Image read_png(const string& path) {
  FILE* file = fopen(path.c_str(),"rb");
  if (!file)
    die("Failed to open "+path+" for reading");
  png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0);
  if (!png)
    die("Error reading png file "+path);
  png_infop info = png_create_info_struct(png);
  if (!info || setjmp(png_jmpbuf(png)))
    die("Error reading png file "+path);
  png_init_io(png,file);
  png_read_png(png,info,PNG_TRANSFORM_STRIP_16|PNG_TRANSFORM_STRIP_ALPHA
                       |PNG_TRANSFORM_PACKING|PNG_TRANSFORM_EXPAND,0);
  const int w = png_get_image_width(png,info),
            h = png_get_image_height(png,info);
  Image image(w,h);
  Pixel** rows = (Pixel**)png_get_rows(png,info);
  for (const int x : range(w))
    for (const int y : range(h))
      image(x,y) = rows[h-y-1][x];
  png_destroy_read_struct(&png,&info,0);
  fclose(file);
  return image;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rdi
leaq 0x72b6(%rip), %rsi      # 0x11ecf
callq 0x5510
testq %rax, %rax
je 0xade2
movq %rax, %r15
leaq 0x72be(%rip), %rdi      # 0x11eef
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rsi
movq %rcx, %rdx
callq 0x5080
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0xae28
movq %rax, %rdi
callq 0x5710
movq %rax, (%rsp)
testq %rax, %rax
je 0xadc3
movq 0x8(%rsp), %rdi
movq 0xc339(%rip), %rsi      # 0x16fa8
movl $0xc8, %edx
callq 0x54a0
movq %rax, %rdi
callq 0x5600
testl %eax, %eax
jne 0xadc3
movq 0x8(%rsp), %rdi
movq %r15, 0x30(%rsp)
movq %r15, %rsi
callq 0x57a0
movq 0x8(%rsp), %rdi
movq (%rsp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movl $0x17, %edx
callq 0x5770
movq 0x8(%rsp), %rdi
movq (%rsp), %rsi
callq 0x52a0
movl %eax, %r12d
movq 0x8(%rsp), %rdi
movq (%rsp), %rsi
callq 0x57e0
movl %eax, %ebp
movl %r12d, (%rbx)
movl %eax, 0x4(%rbx)
imull %r12d, %eax
cltq
movl $0x3, %ecx
mulq %rcx
movq $-0x1, %rdi
cmovnoq %rax, %rdi
callq 0x5030
movq %rax, 0x8(%rbx)
leaq 0x10(%rbx), %rdi
movq %rdi, 0x28(%rsp)
movq %rax, %rsi
callq 0x105e6
movq 0x8(%rsp), %rdi
movq (%rsp), %rsi
callq 0x5350
testl %r12d, %r12d
je 0xad93
movl %ebp, %ecx
movl %ecx, %esi
movl %r12d, %r12d
movl %r12d, %ecx
movl %ebp, %edx
decl %edx
leaq (%rsi,%rsi,2), %rsi
xorl %edi, %edi
movl %edi, %r8d
testl %ebp, %ebp
je 0xad85
movl %edi, %r12d
leaq (%r8,%r8,2), %r9
movslq %r8d, %r10
movl %edx, %r11d
movslq %r11d, %r11
movq (%rax,%r11,8), %r13
movslq 0x4(%rbx), %r15
imulq %r10, %r15
leaq (%r15,%r15,2), %r15
addq 0x8(%rbx), %r15
movb 0x2(%r13,%r9), %r14b
movb %r14b, 0x2(%r12,%r15)
movzwl (%r13,%r9), %r14d
movw %r14w, (%r12,%r15)
movq %r12, %r14
addq $0x3, %r14
decl %r11d
movq %r14, %r12
cmpq %r14, %rsi
jne 0xad47
movq %r8, %r9
incq %r9
movq %r9, %r8
cmpq %rcx, %r9
jne 0xad36
xorl %eax, %eax
movl %eax, %edx
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x5230
movq 0x30(%rsp), %rdi
callq 0x5450
movq %rbx, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x712c(%rip), %rsi      # 0x11ef6
leaq 0x58(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rdx
callq 0xb2e9
movq %rbx, %rdi
callq 0x7c5b
leaq 0x70e9(%rip), %rsi      # 0x11ed2
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rdx
callq 0xb2e9
leaq 0x70e2(%rip), %rsi      # 0x11ee2
movq %rbx, %rdi
callq 0x57c0
movq %rax, %rcx
leaq 0x48(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rax), %rdx
addq $0x10, %rax
cmpq %rax, %rdx
jne 0xae47
movups (%rax), %xmm0
movups %xmm0, (%rbx)
jmp 0xae54
leaq 0x70c7(%rip), %rsi      # 0x11ef6
leaq 0x78(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rdx
callq 0xb2e9
movq %rbx, %rdi
callq 0x7c5b
movq %rdx, 0x38(%rsp)
movq (%rax), %rdx
movq %rdx, 0x48(%rsp)
movq 0x8(%rcx), %rdx
leaq 0x38(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rax, (%rcx)
movq $0x0, 0x8(%rcx)
movb $0x0, 0x10(%rcx)
callq 0x7c5b
movq %rax, %r14
movq 0x38(%rsp), %rdi
cmpq %rbx, %rdi
je 0xae8f
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x5470
movq %r14, %rbx
jmp 0xae97
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xaeff
movq 0x18(%rsp), %rsi
jmp 0xaef7
movq %rax, %rbx
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xaeff
movq 0x88(%rsp), %rsi
jmp 0xaef7
movq %rax, %rbx
movq 0x28(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0xaeff
callq 0x106c4
jmp 0xaeff
movq %rax, %rbx
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xaeff
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x5470
movq %rbx, %rdi
callq 0x5720