// File: /workspace/github_c_makefile_star2_O3/radforddc[P]icpc_siggen/signal_tester.c
// Function: get_cart
static int get_cart(char *cmd, struct point *cart, int coord_type) {
  float x, y, z;
  struct cyl_pt cyl;
  char  *cp, *cp2;

  if (sscanf(cmd, "%f %f %f", &x, &y, &z) != 3 &&
      sscanf(cmd, "%f, %f, %f", &x, &y, &z) != 3) {
    printf("error parsing coordinate: %s\n", cmd);
    return -1;
  }
  if (coord_type == CYL) {
    cyl.r = x; cyl.phi = y; cyl.z = z;
    *cart = cyl_to_cart(cyl);
  } else {
    cart->x = x; cart->y = y; cart->z = z;
  }
  
  for (cp = cmd; isspace(*cp); cp++);
  for (cp = cmd; isspace(*cp); cp++);
  for ( ; isdigit(*cp) || *cp == '.' || *cp == '-'; cp++); //skip r/x coord.
  for ( ; isspace(*cp) || *cp == ','; cp++);               //skip whitespace, commas
  for ( ; isdigit(*cp) || *cp == '.' || *cp == '-'; cp++); //skip phi/y coord.
  for ( ; isspace(*cp) || *cp == ','; cp++);               //skip whitespace, commas
  for ( ; isdigit(*cp) || *cp == '.' || *cp == '-'; cp++); //skip z coord
  for ( ; isspace(*cp) || *cp == ','; cp++);               //skip whitespace, commas
  for (cp2 = cp + strlen(cp); isspace(*cp2); cp2--)        //remove trailing whitespace
    *cp2 = '\0';

  return (int) (cp - cmd);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xd3d(%rip), %rsi       # 0x8823
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
xorl %eax, %eax
callq 0x20a0
cmpl $0x3, %eax
je 0x7b2a
leaq 0x1d66(%rip), %rsi      # 0x986e
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x20a0
cmpl $0x3, %eax
jne 0x7c6e
movss 0x14(%rsp), %xmm0
testl %ebp, %ebp
je 0x7b4d
movss %xmm0, (%r14)
movss 0x10(%rsp), %xmm0
movss %xmm0, 0x4(%r14)
movss 0xc(%rsp), %xmm1
jmp 0x7b65
movss 0xc(%rsp), %xmm1
movss 0x10(%rsp), %xmm2
unpcklps %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
callq 0x3878
movlps %xmm0, (%r14)
movss %xmm1, 0x8(%r14)
callq 0x2170
movq %rax, %r14
movq (%rax), %r15
addq $-0x7, %rbx
movl $0xfffffff9, %ebp       # imm = 0xFFFFFFF9
movsbq 0x7(%rbx), %rax
incl %ebp
incq %rbx
testb $0x20, 0x1(%r15,%rax,2)
jne 0x7b7f
movsbq 0x6(%rbx), %rax
leal -0x2d(%rax), %ecx
incq %rbx
incl %ebp
cmpb $0x2, %cl
jb 0x7b91
movzwl (%r15,%rax,2), %eax
andl $0x800, %eax            # imm = 0x800
jne 0x7b91
movsbq 0x5(%rbx), %rax
incl %ebp
incq %rbx
cmpq $0x2c, %rax
je 0x7baf
movzwl (%r15,%rax,2), %eax
andl $0x2000, %eax           # imm = 0x2000
jne 0x7baf
movsbq 0x4(%rbx), %rax
leal -0x2d(%rax), %ecx
incq %rbx
incl %ebp
cmpb $0x2, %cl
jb 0x7bcb
movzwl (%r15,%rax,2), %eax
andl $0x800, %eax            # imm = 0x800
jne 0x7bcb
movsbq 0x3(%rbx), %rax
incl %ebp
incq %rbx
cmpq $0x2c, %rax
je 0x7be9
movzwl (%r15,%rax,2), %eax
andl $0x2000, %eax           # imm = 0x2000
jne 0x7be9
movsbq 0x2(%rbx), %rax
leal -0x2d(%rax), %ecx
incq %rbx
incl %ebp
cmpb $0x2, %cl
jb 0x7c05
movzwl (%r15,%rax,2), %eax
andl $0x800, %eax            # imm = 0x800
jne 0x7c05
movsbq 0x1(%rbx), %rax
incq %rbx
incl %ebp
cmpq $0x2c, %rax
je 0x7c23
movzwl (%r15,%rax,2), %eax
andl $0x2000, %eax           # imm = 0x2000
jne 0x7c23
movq %rbx, %rdi
callq 0x2160
movsbq (%rbx,%rax), %rcx
testb $0x20, 0x1(%r15,%rcx,2)
je 0x7c84
addq %rax, %rbx
movb $0x0, (%rbx)
movq (%r14), %rax
movsbq -0x1(%rbx), %rcx
decq %rbx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x7c57
jmp 0x7c84
leaq 0x1c04(%rip), %rdi      # 0x9879
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2030
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq