// File: /workspace/github_c_makefile_star2_O2/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 0x1157(%rip), %rsi      # 0x8823
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
xorl %eax, %eax
callq 0x20a0
cmpl $0x3, %eax
je 0x7710
leaq 0x2180(%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 0x7845
movss 0x14(%rsp), %xmm0
testl %ebp, %ebp
je 0x7733
movss %xmm0, (%r14)
movss 0x10(%rsp), %xmm0
movss %xmm0, 0x4(%r14)
movss 0xc(%rsp), %xmm1
jmp 0x774b
movss 0xc(%rsp), %xmm1
movss 0x10(%rsp), %xmm2
unpcklps %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
callq 0x374d
movlps %xmm0, (%r14)
movss %xmm1, 0x8(%r14)
callq 0x2170
movq %rax, %r14
movq (%rax), %r15
addq $-0x7, %rbx
pushq $-0x7
popq %rbp
movsbq 0x7(%rbx), %rax
incl %ebp
incq %rbx
testb $0x20, 0x1(%r15,%rax,2)
jne 0x7763
movsbq 0x6(%rbx), %rax
leal -0x2d(%rax), %ecx
incq %rbx
incl %ebp
cmpb $0x2, %cl
jb 0x7775
movzwl (%r15,%rax,2), %eax
andl $0x800, %eax            # imm = 0x800
jne 0x7775
movsbq 0x5(%rbx), %rax
incl %ebp
incq %rbx
cmpq $0x2c, %rax
je 0x7793
movzwl (%r15,%rax,2), %eax
andl $0x2000, %eax           # imm = 0x2000
jne 0x7793
movsbq 0x4(%rbx), %rax
leal -0x2d(%rax), %ecx
incq %rbx
incl %ebp
cmpb $0x2, %cl
jb 0x77af
movzwl (%r15,%rax,2), %eax
andl $0x800, %eax            # imm = 0x800
jne 0x77af
movsbq 0x3(%rbx), %rax
incl %ebp
incq %rbx
cmpq $0x2c, %rax
je 0x77cd
movzwl (%r15,%rax,2), %eax
andl $0x2000, %eax           # imm = 0x2000
jne 0x77cd
movsbq 0x2(%rbx), %rax
leal -0x2d(%rax), %ecx
incq %rbx
incl %ebp
cmpb $0x2, %cl
jb 0x77e9
movzwl (%r15,%rax,2), %eax
andl $0x800, %eax            # imm = 0x800
jne 0x77e9
movsbq 0x1(%rbx), %rax
incq %rbx
incl %ebp
cmpq $0x2c, %rax
je 0x7807
movzwl (%r15,%rax,2), %eax
andl $0x2000, %eax           # imm = 0x2000
jne 0x7807
movq %rbx, %rdi
callq 0x2160
addq %rbx, %rax
movsbq (%rax), %rcx
testb $0x20, 0x1(%r15,%rcx,2)
je 0x7859
movb $0x0, (%rax)
decq %rax
movq (%r14), %r15
jmp 0x782e
leaq 0x202d(%rip), %rdi      # 0x9879
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2030
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq