// File: /workspace/github_cpp_makefile_star2_O3/matthewarcus[P]mmps/addgrid.cpp
// Function: main
int main(int argc, char* argv[])
{
  Image inImage;
  char* infilename = NULL;

  double gridx = 10.0;
  double gridy = 10.0;
  Rgb gridcolor(0,0,0);

  char *progname = argv[0];
  argc--;argv++;
  while (argc > 0 && argv[0][0] == '-') {
    if (strcmp(argv[0], "-grid") == 0) {
      argc--; argv++;
      if (argc == 0) { error(usage, progname); };
      gridx = strtod(argv[0],NULL);
      gridy = gridx;
    } else if (strcmp(argv[0], "-gridx") == 0) {
      argc--; argv++;
      if (argc == 0) { error(usage, progname); };
      gridx = strtod(argv[0],NULL);
    } else if (strcmp(argv[0], "-gridy") == 0) {
      argc--; argv++;
      if (argc == 0) { error(usage, progname); };
      gridy = strtod(argv[0],NULL);
    } else {
      error(usage, progname);
    }
    argc--; argv++;
  }
  if (argc != 1) {
    error(usage, progname);
  }

  infilename = argv[0];

  inImage.Read(infilename, true);
  inImage.AddGrid(gridx, gridy, gridcolor);
  inImage.Close();
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x458, %rsp            # imm = 0x458
movq %rsi, %r13
movl %edi, %ebp
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xadd0
movw $0x0, 0xd(%rsp)
movb $0x0, 0xf(%rsp)
movq (%r13), %rbx
leaq 0x8(%r13), %r15
movsd 0x79bc(%rip), %xmm0     # 0xc008
cmpl $0x2, %ebp
jl 0x47bc
movsd %xmm0, 0x10(%rsp)
movsd %xmm0, 0x18(%rsp)
leal -0x1(%rbp), %r14d
movq 0x8(%r13), %r12
cmpb $0x2d, (%r12)
jne 0x47ca
movq %r12, %rdi
leaq 0x79c0(%rip), %rsi      # 0xc03e
callq 0x4240
testl %eax, %eax
je 0x46e3
movq %r12, %rdi
leaq 0x79b3(%rip), %rsi      # 0xc044
callq 0x4240
testl %eax, %eax
je 0x4725
movq %r12, %rdi
leaq 0x79a3(%rip), %rsi      # 0xc04b
callq 0x4240
testl %eax, %eax
je 0x4767
movq 0xdb0c(%rip), %rdx      # 0x121c8
movl $0x400, %esi            # imm = 0x400
leaq 0x50(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4290
movq %r12, %rdi
callq 0x9f34
movl %r14d, %ebp
jmp 0x47aa
addl $-0x2, %ebp
jne 0x470e
movq 0xdad9(%rip), %rdx      # 0x121c8
movl $0x400, %esi            # imm = 0x400
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4290
movq %r14, %rdi
callq 0x9f34
addq $0x10, %r13
movq (%r13), %rdi
xorl %esi, %esi
callq 0x4160
movsd %xmm0, 0x18(%rsp)
jmp 0x47a1
addl $-0x2, %ebp
jne 0x4750
movq 0xda97(%rip), %rdx      # 0x121c8
movl $0x400, %esi            # imm = 0x400
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4290
movq %r14, %rdi
callq 0x9f34
addq $0x10, %r13
movq (%r13), %rdi
xorl %esi, %esi
callq 0x4160
movsd %xmm0, 0x18(%rsp)
jmp 0x47a7
addl $-0x2, %ebp
jne 0x4792
movq 0xda55(%rip), %rdx      # 0x121c8
movl $0x400, %esi            # imm = 0x400
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4290
movq %r14, %rdi
callq 0x9f34
addq $0x10, %r13
movq (%r13), %rdi
xorl %esi, %esi
callq 0x4160
movsd %xmm0, 0x10(%rsp)
movq %r13, %r15
movq %r15, %r13
addq $0x8, %r15
cmpl $0x1, %ebp
jg 0x4661
jmp 0x47d0
movsd %xmm0, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
jmp 0x47d0
cmpl $0x1, %r14d
je 0x47f9
movq 0xd9f1(%rip), %rdx      # 0x121c8
leaq 0x50(%rsp), %r14
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4290
movq %r14, %rdi
callq 0x9f34
movq (%r15), %r12
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0xafbe
leaq 0x20(%rsp), %rdi
leaq 0xd(%rsp), %rsi
movsd 0x18(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
callq 0xb2aa
leaq 0x20(%rsp), %rdi
callq 0xae34
leaq 0x20(%rsp), %rdi
callq 0xae24
xorl %eax, %eax
addq $0x458, %rsp            # imm = 0x458
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4850
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xae24
movq %rbx, %rdi
callq 0x4300
nopl (%rax)