// File: /workspace/github_c_makefile_star2_O0/YunyiQian[P]multitel3/radiats.c
// Function: radpmt
float radpmt(float mom[3][3], float alpha, float az, int type) {
  float	dir[3], wave[3], sth, cth, cphi, sphi;
  int	m,n;
  
  sth=sin(alpha*DEG2RAD);
  cth=cos(alpha*DEG2RAD);
  cphi=cos(az*DEG2RAD);
  sphi=sin(az*DEG2RAD);
  dir[0]=sth*cphi;
  dir[1]=sth*sphi;
  dir[2]=cth;
  switch(type) {
  case 1:	/* P wave */
    wave[0]=dir[0];
    wave[1]=dir[1];
    wave[2]=dir[2];
    break;
  case 2:	/* SV wave */
    wave[0]=cth*cphi;
    wave[1]=cth*sphi;
    wave[2]=-sth;
    break;
  case 3:	/* SH wave */
    wave[0]=-sphi;
    wave[1]=cphi;
    wave[2]=0;
  break;
  default:
    fprintf(stderr,"wrong phase type %d\n",type);
    return 0.;
  }
  
  sth=0;
  for(m=0;m<3;m++){
    for(n=0;n<3;n++){
      sth+=mom[m][n]*dir[m]*wave[n];
    }
  }
  return sth;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movss %xmm0, -0x14(%rbp)
movss %xmm1, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
movss -0x14(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x23fe(%rip), %xmm1     # 0x8c38
movsd %xmm1, -0x58(%rbp)
mulsd %xmm1, %xmm0
callq 0x1190
movsd -0x58(%rbp), %xmm1
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x38(%rbp)
movss -0x14(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd %xmm1, %xmm0
callq 0x10d0
movsd -0x58(%rbp), %xmm1
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x3c(%rbp)
movss -0x18(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd %xmm1, %xmm0
callq 0x10d0
movsd -0x58(%rbp), %xmm1
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x40(%rbp)
movss -0x18(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd %xmm1, %xmm0
callq 0x1190
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x44(%rbp)
movss -0x38(%rbp), %xmm0
movss -0x40(%rbp), %xmm1
mulss %xmm1, %xmm0
movss %xmm0, -0x28(%rbp)
movss -0x38(%rbp), %xmm0
movss -0x44(%rbp), %xmm1
mulss %xmm1, %xmm0
movss %xmm0, -0x24(%rbp)
movss -0x3c(%rbp), %xmm0
movss %xmm0, -0x20(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x50(%rbp)
subl $0x1, %eax
je 0x6905
jmp 0x68ee
movl -0x50(%rbp), %eax
subl $0x2, %eax
je 0x6928
jmp 0x68f8
movl -0x50(%rbp), %eax
subl $0x3, %eax
je 0x695f
jmp 0x698a
movss -0x28(%rbp), %xmm0
movss %xmm0, -0x34(%rbp)
movss -0x24(%rbp), %xmm0
movss %xmm0, -0x30(%rbp)
movss -0x20(%rbp), %xmm0
movss %xmm0, -0x2c(%rbp)
jmp 0x69b2
movss -0x3c(%rbp), %xmm0
mulss -0x40(%rbp), %xmm0
movss %xmm0, -0x34(%rbp)
movss -0x3c(%rbp), %xmm0
mulss -0x44(%rbp), %xmm0
movss %xmm0, -0x30(%rbp)
movss -0x38(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss %xmm0, -0x2c(%rbp)
jmp 0x69b2
movss -0x44(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss %xmm0, -0x34(%rbp)
movss -0x40(%rbp), %xmm0
movss %xmm0, -0x30(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x2c(%rbp)
jmp 0x69b2
movq 0x4667(%rip), %rax      # 0xaff8
movq (%rax), %rdi
movl -0x1c(%rbp), %edx
leaq 0x22ca(%rip), %rsi      # 0x8c68
movb $0x0, %al
callq 0x1100
xorps %xmm0, %xmm0
movss %xmm0, -0x4(%rbp)
jmp 0x6a34
xorps %xmm0, %xmm0
movss %xmm0, -0x38(%rbp)
movl $0x0, -0x48(%rbp)
cmpl $0x3, -0x48(%rbp)
jge 0x6a2a
movl $0x0, -0x4c(%rbp)
cmpl $0x3, -0x4c(%rbp)
jge 0x6a1d
movq -0x10(%rbp), %rax
movslq -0x48(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq -0x4c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movslq -0x48(%rbp), %rax
mulss -0x28(%rbp,%rax,4), %xmm0
movslq -0x4c(%rbp), %rax
movss -0x34(%rbp,%rax,4), %xmm2
movss -0x38(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x38(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x69ce
jmp 0x6a1f
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x69c1
movss -0x38(%rbp), %xmm0
movss %xmm0, -0x4(%rbp)
movss -0x4(%rbp), %xmm0
addq $0x60, %rsp
popq %rbp
retq
nop