// File: /workspace/github_c_makefile_star2_O1/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 %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x9d8(%rip), %rsi       # 0x87db
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
leaq 0x4(%rsp), %r8
xorl %eax, %eax
callq 0x20a0
cmpl $0x3, %eax
je 0x7e47
leaq 0x19ed(%rip), %rsi      # 0x9812
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
leaq 0x4(%rsp), %r8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x20a0
cmpl $0x3, %eax
jne 0x7f8c
movss 0xc(%rsp), %xmm0
testl %ebp, %ebp
je 0x7e6a
movss %xmm0, (%r14)
movss 0x8(%rsp), %xmm0
movss %xmm0, 0x4(%r14)
movss 0x4(%rsp), %xmm1
jmp 0x7e82
movss 0x4(%rsp), %xmm1
movss 0x8(%rsp), %xmm2
unpcklps %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
callq 0x38f3
movlps %xmm0, (%r14)
movss %xmm1, 0x8(%r14)
callq 0x2170
movq %rax, %r14
movq (%rax), %rax
addq $-0x7, %rbx
movl $0xfffffff9, %ebp       # imm = 0xFFFFFFF9
movsbq 0x7(%rbx), %rcx
incl %ebp
incq %rbx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x7e9c
movsbq 0x6(%rbx), %rcx
leal -0x2d(%rcx), %edx
incq %rbx
incl %ebp
cmpb $0x2, %dl
jb 0x7ead
movzwl (%rax,%rcx,2), %ecx
andl $0x800, %ecx            # imm = 0x800
jne 0x7ead
movsbq 0x5(%rbx), %rcx
incl %ebp
incq %rbx
cmpq $0x2c, %rcx
je 0x7ecb
movzwl (%rax,%rcx,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
jne 0x7ecb
movsbq 0x4(%rbx), %rcx
leal -0x2d(%rcx), %edx
incq %rbx
incl %ebp
cmpb $0x2, %dl
jb 0x7ee7
movzwl (%rax,%rcx,2), %ecx
andl $0x800, %ecx            # imm = 0x800
jne 0x7ee7
movsbq 0x3(%rbx), %rcx
incl %ebp
incq %rbx
cmpq $0x2c, %rcx
je 0x7f05
movzwl (%rax,%rcx,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
jne 0x7f05
movsbq 0x2(%rbx), %rcx
leal -0x2d(%rcx), %edx
incq %rbx
incl %ebp
cmpb $0x2, %dl
jb 0x7f21
movzwl (%rax,%rcx,2), %ecx
andl $0x800, %ecx            # imm = 0x800
jne 0x7f21
movsbq 0x1(%rbx), %rcx
incq %rbx
incl %ebp
cmpq $0x2c, %rcx
je 0x7f3f
movzwl (%rax,%rcx,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
jne 0x7f3f
movq %rbx, %rdi
callq 0x2160
movq (%r14), %rcx
movsbq (%rbx,%rax), %rdx
testb $0x20, 0x1(%rcx,%rdx,2)
je 0x7fa2
addq %rax, %rbx
movb $0x0, (%rbx)
movq (%r14), %rax
movsbq -0x1(%rbx), %rcx
decq %rbx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x7f75
jmp 0x7fa2
leaq 0x188a(%rip), %rdi      # 0x981d
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2030
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq