// File: /workspace/github_cpp_makefile_star2_O1/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, %rbp
movl %edi, %r12d
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xabe0
movw $0x0, 0xd(%rsp)
movb $0x0, 0xf(%rsp)
movq (%rbp), %rbx
leaq 0x8(%rbp), %r15
leal -0x1(%r12), %r14d
movsd 0x79a6(%rip), %xmm0     # 0xc008
cmpl $0x2, %r12d
jl 0x47d8
movsd %xmm0, 0x10(%rsp)
movsd %xmm0, 0x18(%rsp)
movq 0x8(%rbp), %r13
cmpb $0x2d, (%r13)
jne 0x47e4
movq %r13, %rdi
leaq 0x79ad(%rip), %rsi      # 0xc03e
callq 0x4250
testl %eax, %eax
je 0x46f6
movq %r13, %rdi
leaq 0x79a0(%rip), %rsi      # 0xc044
callq 0x4250
testl %eax, %eax
je 0x4739
movq %r13, %rdi
leaq 0x7990(%rip), %rsi      # 0xc04b
callq 0x4250
testl %eax, %eax
je 0x477c
movq 0xdb01(%rip), %rdx      # 0x121d0
movl $0x400, %esi            # imm = 0x400
leaq 0x50(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x42a0
movq %r12, %rdi
callq 0x9d38
movl %r14d, %r12d
jmp 0x47c0
addl $-0x2, %r12d
jne 0x4722
movq 0xdacd(%rip), %rdx      # 0x121d0
movl $0x400, %esi            # imm = 0x400
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x42a0
movq %r14, %rdi
callq 0x9d38
addq $0x10, %rbp
movq (%rbp), %rdi
xorl %esi, %esi
callq 0x4170
movsd %xmm0, 0x18(%rsp)
jmp 0x47b7
addl $-0x2, %r12d
jne 0x4765
movq 0xda8a(%rip), %rdx      # 0x121d0
movl $0x400, %esi            # imm = 0x400
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x42a0
movq %r14, %rdi
callq 0x9d38
addq $0x10, %rbp
movq (%rbp), %rdi
xorl %esi, %esi
callq 0x4170
movsd %xmm0, 0x18(%rsp)
jmp 0x47bd
addl $-0x2, %r12d
jne 0x47a8
movq 0xda47(%rip), %rdx      # 0x121d0
movl $0x400, %esi            # imm = 0x400
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x42a0
movq %r14, %rdi
callq 0x9d38
addq $0x10, %rbp
movq (%rbp), %rdi
xorl %esi, %esi
callq 0x4170
movsd %xmm0, 0x10(%rsp)
movq %rbp, %r15
movq %r15, %rbp
addq $0x8, %r15
leal -0x1(%r12), %r14d
cmpl $0x1, %r12d
jg 0x4678
jmp 0x47e4
movsd %xmm0, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
cmpl $0x1, %r14d
je 0x4810
movq 0xd9df(%rip), %rdx      # 0x121d0
leaq 0x50(%rsp), %r14
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x42a0
movq %r14, %rdi
callq 0x9d38
movq (%r15), %rsi
leaq 0x20(%rsp), %rdi
movl $0x1, %edx
callq 0xadba
leaq 0x20(%rsp), %rdi
leaq 0xd(%rsp), %rsi
movsd 0x18(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
callq 0xb09a
leaq 0x20(%rsp), %rdi
callq 0xac44
leaq 0x20(%rsp), %rdi
callq 0xac34
xorl %eax, %eax
addq $0x458, %rsp            # imm = 0x458
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4867
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xac34
movq %rbx, %rdi
callq 0x4310