// File: /workspace/github_c_makefile_star2_O0/radforddc[P]icpc_siggen/signal_tester.c
// Function: drift_paths
static int drift_paths(char *cmd, MJD_Siggen_Setup *setup){
  FILE *fp;
  point *dpe, *dph;
  int i, nt;
  char *cp, *cp2;

  int h_only=0;  // set to 1 for use with speed_path_iso figures


  if ((cp = strstr(cmd, "-h"))) {
    while (*(cp-1) == ' ') cp--;
    *cp = 0;
    h_only = 1;
  }

  for (cp = cmd; isspace(*cp); cp++);
  for (cp2 = cp + strlen(cp); isspace(*cp2); cp2--)//remove whitespace
    *cp2 = '\0';
  if (strlen(cp) == 0){
    fprintf(stderr, "must supply file name\n");
    return 1;
  }

  if ((fp = fopen(cp, "w")) == NULL){
    printf("failed to open output file: %s\n", cp);
    return 1;
  }

  if (h_only) {
    nt =  drift_path_h(&dph, setup);
    fprintf(fp,"#hx hy hz\n");
    for (i = 0; i < nt && dph[i].z > 0.0; i++){
      fprintf(fp,"%7.3f %7.3f %7.3f\n", dph[i].x, dph[i].z, -dph[i].x);
    }
  } else {
    nt = drift_path_e(&dpe, setup);
    drift_path_h(&dph, setup);
    fprintf(fp,"# n ex ey ez hx hy hz\n");
    for (i = 0; i < nt; i++) {
      if (dpe[i].x == 0 && dpe[i].y == 0 && dpe[i].y == 0 &&
          dph[i].x == 0 && dph[i].y == 0 && dph[i].y == 0) break;
      fprintf(fp,"%4d %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f\n",
              i, dpe[i].x, dpe[i].y, dpe[i].z, dph[i].x, dph[i].y, dph[i].z);
    }
  }

  fprintf(fp,"\n");
  fclose(fp);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x4c(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x347a(%rip), %rsi      # 0xe8cc
callq 0x2170
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0xb48c
jmp 0xb463
movq -0x40(%rbp), %rax
movsbl -0x1(%rax), %eax
cmpl $0x20, %eax
jne 0xb47e
movq -0x40(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0xb463
movq -0x40(%rbp), %rax
movb $0x0, (%rax)
movl $0x1, -0x4c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
callq 0x2140
movq (%rax), %rax
movq -0x40(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0xb4c4
jmp 0xb4b6
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0xb494
movq -0x40(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x40(%rbp), %rdi
callq 0x2130
movq %rax, %rcx
movq -0x58(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x48(%rbp)
callq 0x2140
movq (%rax), %rax
movq -0x48(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0xb518
movq -0x48(%rbp), %rax
movb $0x0, (%rax)
movq -0x48(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0xb4e3
movq -0x40(%rbp), %rdi
callq 0x2130
cmpq $0x0, %rax
jne 0xb54b
movq 0x5ac2(%rip), %rax      # 0x10ff0
movq (%rax), %rdi
leaq 0x324d(%rip), %rsi      # 0xe785
movb $0x0, %al
callq 0x2220
movl $0x1, -0x4(%rbp)
jmp 0xb83f
movq -0x40(%rbp), %rdi
leaq 0x332e(%rip), %rsi      # 0xe884
callq 0x20c0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0xb583
movq -0x40(%rbp), %rsi
leaq 0x335f(%rip), %rdi      # 0xe8cf
movb $0x0, %al
callq 0x2030
movl $0x1, -0x4(%rbp)
jmp 0xb83f
cmpl $0x0, -0x4c(%rbp)
je 0xb669
movq -0x18(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x4360
movl %eax, -0x38(%rbp)
movq -0x20(%rbp), %rdi
leaq 0x3347(%rip), %rsi      # 0xe8ef
movb $0x0, %al
callq 0x2220
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %ecx
xorl %eax, %eax
cmpl -0x38(%rbp), %ecx
movb %al, -0x59(%rbp)
jge 0xb5e8
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x8(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
seta %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
testb $0x1, %al
jne 0xb5f1
jmp 0xb664
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x8(%rax), %xmm1
cvtss2sd %xmm1, %xmm1
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm2
movd %xmm2, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm2
cvtss2sd %xmm2, %xmm2
leaq 0x32d8(%rip), %rsi      # 0xe927
movb $0x3, %al
callq 0x2220
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xb5b6
jmp 0xb81d
movq -0x18(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x4330
movl %eax, -0x38(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x4360
movq -0x20(%rbp), %rdi
leaq 0x3269(%rip), %rsi      # 0xe8fa
movb $0x0, %al
callq 0x2220
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0xb81b
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0xb76a
jp 0xb76a
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x4(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0xb76a
jp 0xb76a
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x4(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0xb76a
jp 0xb76a
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0xb76a
jp 0xb76a
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x4(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0xb76a
jp 0xb76a
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x4(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0xb76a
jp 0xb76a
jmp 0xb81b
movq -0x20(%rbp), %rdi
movl -0x34(%rbp), %edx
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x4(%rax), %xmm1
cvtss2sd %xmm1, %xmm1
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x8(%rax), %xmm2
cvtss2sd %xmm2, %xmm2
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm3
cvtss2sd %xmm3, %xmm3
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x4(%rax), %xmm4
cvtss2sd %xmm4, %xmm4
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x8(%rax), %xmm5
cvtss2sd %xmm5, %xmm5
leaq 0x310b(%rip), %rsi      # 0xe911
movb $0x6, %al
callq 0x2220
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xb69f
jmp 0xb81d
movq -0x20(%rbp), %rdi
leaq 0x2e73(%rip), %rsi      # 0xe69b
movb $0x0, %al
callq 0x2220
movq -0x20(%rbp), %rdi
callq 0x21e0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)