#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
float atof(char *);
double cos(float);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
double sin(float);
int main(int argc, char *argv[]) {
  float S, D, R, d2r;
  float Mxx, Myy, Mzz, Mxy, Mxz, Myz;
  float Mrr, Mtt, Mpp, Mrt, Mrp, Mtp;
  if (argc != 4) {
    printf("\nDouble Couple - Moment Tensor Converter (by Onur TAN)\n");
    printf("Usage : dc2mt Strike Dip Rake (in degrees)\n");
    printf("Output Aki&Richards1980:  Mxx  Myy  Mzz  Mxy  Mxz  Myz \n\n");
    exit(1);
  }
  d2r = 0.017453293;
  S = atof(argv[1]);
  D = atof(argv[2]);
  R = atof(argv[3]);
  printf("\nStrike = %9.5f degrees\n", S);
  printf("Dip = %9.5f degrees\n", D);
  printf("Rake/Slip = %9.5f degrees\n", R);
  S *= d2r;
  D *= d2r;
  R *= d2r;
  Mxx = -1.0 *
        (sin(D) * cos(R) * sin(2 * S) + sin(2 * D) * sin(R) * sin(S) * sin(S));
  Myy = (sin(D) * cos(R) * sin(2 * S) - sin(2 * D) * sin(R) * cos(S) * cos(S));
  Mzz = -1.0 * (Mxx + Myy);
  Mxy = (sin(D) * cos(R) * cos(2 * S) + 0.5 * sin(2 * D) * sin(R) * sin(2 * S));
  Mxz = -1.0 * (cos(D) * cos(R) * cos(S) + cos(2 * D) * sin(R) * sin(S));
  Myz = -1.0 * (cos(D) * cos(R) * sin(S) - cos(2 * D) * sin(R) * cos(S));
  printf("\nOutput Aki&Richards1980:  Mxx  Myy  Mzz  Mxy  Mxz  Myz \n");
  printf("%9.5f %9.5f %9.5f %9.5f %9.5f %9.5f\n", Mxx, Myy, Mzz, Mxy, Mxz, Myz);
  Mtt = Mxx;
  Mpp = Myy;
  Mrr = Mzz;
  Mtp = Mxy * -1.;
  Mrt = Mxz;
  Mrp = Myz * -1.;
  printf("\nOutput Harvard CMTSOLUTION:  Mrr Mtt Mpp Mrt Mrp Mtp\n");
  printf("Mrr: %9.5f\n", Mrr);
  printf("Mtt: %9.5f\n", Mtt);
  printf("Mpp: %9.5f\n", Mpp);
  printf("Mrt: %9.5f\n", Mrt);
  printf("Mrp: %9.5f\n", Mrp);
  printf("Mtp: %9.5f\n\n", Mtp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x4(%rbp)
je     11a0 <main+0x50>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeed(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
movss  0xe6c(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xec3(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xec5(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xec3(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x20(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x20(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x20(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0x128(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x128(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x110(%rbp)
ff
movss  0xd80(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0x108(%rbp)
ff
movss  0xd66(%rip),%xmm0
mulss  -0x18(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0x120(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x120(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
movss  -0x14(%rbp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x118(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
movss  -0x14(%rbp),%xmm0
call   1050 <sin@plt>
movsd  -0x110(%rbp),%xmm1
ff
movsd  -0x108(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0x100(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xcc9(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x18(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0xf8(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xf8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movss  0xc91(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0xd8(%rbp)
ff
movss  0xc77(%rip),%xmm0
mulss  -0x18(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0xf0(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xf0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movss  -0x14(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xe8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movss  -0x14(%rbp),%xmm0
call   1060 <cos@plt>
movsd  -0xe0(%rbp),%xmm1
ff
movsd  -0xd8(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x24(%rbp),%xmm0
addss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xbac(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x18(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0xc8(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xc8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movss  0xb74(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
movss  0xb5a(%rip),%xmm0
mulss  -0x18(%rbp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xb3d(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xc0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movss  0xb10(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
call   1050 <sin@plt>
movsd  -0xb8(%rbp),%xmm1
ff
movsd  -0xb0(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x18(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movss  -0x14(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movss  0xa89(%rip),%xmm0
mulss  -0x18(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movss  -0x14(%rbp),%xmm0
call   1050 <sin@plt>
movsd  -0x90(%rbp),%xmm1
ff
movsd  -0x88(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xa13(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x18(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x78(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movss  -0x14(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0x60(%rbp)
movss  0x9d5(%rip),%xmm0
mulss  -0x18(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x70(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movss  -0x14(%rbp),%xmm0
call   1060 <cos@plt>
movsd  -0x68(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm3,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0x954(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x38(%rbp)
lea    0xa3f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x28(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x2c(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x30(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
movss  -0x34(%rbp),%xmm4
cvtss2sd %xmm4,%xmm4
movss  -0x38(%rbp),%xmm5
cvtss2sd %xmm5,%xmm5
lea    0xa35(%rip),%rdi
mov    $0x6,%al
call   1040 <printf@plt>
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x30(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0x8c6(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x50(%rbp)
movss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x38(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0x89e(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4c(%rbp)
lea    0x9e8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movss  -0x3c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xa08(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0x9fd(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x44(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0x9f2(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x48(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0x9e7(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x4c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0x9dc(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x50(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0x9d1(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xe0,%rsp
cmp    $0x4,%edi
jne    16a9 <main+0x549>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1040 <atof@plt>
movss  %xmm0,0x8(%rsp)
mov    0x10(%rbx),%rdi
call   1040 <atof@plt>
movss  %xmm0,(%rsp)
mov    0x18(%rbx),%rdi
call   1040 <atof@plt>
movss  %xmm0,0x10(%rsp)
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe87(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe89(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe86(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0xe11(%rip),%xmm2
movss  0x8(%rsp),%xmm1
mulss  %xmm2,%xmm1
movss  %xmm1,0x8(%rsp)
movss  (%rsp),%xmm0
mulss  %xmm2,%xmm0
movss  %xmm0,(%rsp)
movss  0x10(%rsp),%xmm1
mulss  %xmm2,%xmm1
movss  %xmm1,0x10(%rsp)
call   1060 <sin@plt>
movaps %xmm0,0x90(%rsp)
movss  0x10(%rsp),%xmm0
call   1070 <cos@plt>
movaps %xmm0,0x80(%rsp)
movss  0x8(%rsp),%xmm0
addss  %xmm0,%xmm0
movss  %xmm0,0x60(%rsp)
call   1060 <sin@plt>
movaps %xmm0,0xb0(%rsp)
movss  (%rsp),%xmm0
addss  %xmm0,%xmm0
movss  %xmm0,0x28(%rsp)
call   1060 <sin@plt>
movaps %xmm0,0xa0(%rsp)
movss  0x10(%rsp),%xmm0
call   1060 <sin@plt>
movaps %xmm0,0x30(%rsp)
movss  0x8(%rsp),%xmm0
call   1060 <sin@plt>
movaps %xmm0,0x50(%rsp)
movss  0x8(%rsp),%xmm0
call   1060 <sin@plt>
movaps %xmm0,0x40(%rsp)
movss  (%rsp),%xmm0
call   1060 <sin@plt>
movaps %xmm0,0x70(%rsp)
movss  0x10(%rsp),%xmm0
call   1070 <cos@plt>
unpcklpd 0x90(%rsp),%xmm0
movapd 0x70(%rsp),%xmm1
unpcklpd 0x80(%rsp),%xmm1
mulpd  %xmm0,%xmm1
movapd %xmm1,0x70(%rsp)
movss  0x60(%rsp),%xmm0
call   1060 <sin@plt>
movaps %xmm0,0x90(%rsp)
movss  0x28(%rsp),%xmm0
call   1060 <sin@plt>
movaps %xmm0,0x80(%rsp)
movss  0x10(%rsp),%xmm0
call   1060 <sin@plt>
movaps %xmm0,0xc0(%rsp)
movss  0x8(%rsp),%xmm0
call   1070 <cos@plt>
movaps %xmm0,0xd0(%rsp)
movss  0x8(%rsp),%xmm0
call   1070 <cos@plt>
movapd 0x80(%rsp),%xmm1
xorpd  0xcc6(%rip),%xmm1
movapd 0xc0(%rsp),%xmm2
unpcklpd 0xa0(%rsp),%xmm2
unpcklpd 0x30(%rsp),%xmm1
mulpd  %xmm2,%xmm1
movapd 0xd0(%rsp),%xmm2
unpcklpd 0x50(%rsp),%xmm2
mulpd  %xmm1,%xmm2
unpcklpd 0x40(%rsp),%xmm0
mulpd  %xmm2,%xmm0
movapd 0x90(%rsp),%xmm1
unpcklpd 0xb0(%rsp),%xmm1
mulpd  0x70(%rsp),%xmm1
addpd  %xmm0,%xmm1
cvtpd2ps %xmm1,%xmm1
movapd %xmm1,0x70(%rsp)
movapd %xmm1,%xmm2
shufps $0x55,%xmm1,%xmm2
movaps 0xc68(%rip),%xmm0
subss  %xmm2,%xmm1
xorps  %xmm0,%xmm2
movaps %xmm2,0xa0(%rsp)
xorps  %xmm0,%xmm1
movaps %xmm1,0xb0(%rsp)
movss  (%rsp),%xmm0
call   1060 <sin@plt>
movsd  %xmm0,0x30(%rsp)
movss  0x10(%rsp),%xmm0
call   1070 <cos@plt>
mulsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
movss  0x60(%rsp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,0x50(%rsp)
movss  0x28(%rsp),%xmm0
call   1060 <sin@plt>
mulsd  0xc13(%rip),%xmm0
movsd  %xmm0,0x40(%rsp)
movss  0x10(%rsp),%xmm0
call   1060 <sin@plt>
mulsd  0x40(%rsp),%xmm0
movsd  %xmm0,0x40(%rsp)
movss  0x60(%rsp),%xmm0
call   1060 <sin@plt>
mulsd  0x40(%rsp),%xmm0
movsd  0x50(%rsp),%xmm1
mulsd  0x30(%rsp),%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movaps %xmm0,0x60(%rsp)
movss  (%rsp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,0x30(%rsp)
movss  0x10(%rsp),%xmm0
call   1070 <cos@plt>
mulsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
movss  0x8(%rsp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,0x50(%rsp)
movss  0x28(%rsp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,0x40(%rsp)
movss  0x10(%rsp),%xmm0
call   1060 <sin@plt>
mulsd  0x40(%rsp),%xmm0
movsd  %xmm0,0x40(%rsp)
movss  0x8(%rsp),%xmm0
call   1060 <sin@plt>
mulsd  0x40(%rsp),%xmm0
movsd  0x50(%rsp),%xmm1
mulsd  0x30(%rsp),%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
xorps  0xb2a(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movss  (%rsp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,(%rsp)
movss  0x10(%rsp),%xmm0
call   1070 <cos@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movss  0x8(%rsp),%xmm0
call   1060 <sin@plt>
movsd  %xmm0,0x50(%rsp)
movss  0x28(%rsp),%xmm0
call   1070 <cos@plt>
movsd  %xmm0,0x28(%rsp)
movss  0x10(%rsp),%xmm0
call   1060 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movss  0x8(%rsp),%xmm0
call   1070 <cos@plt>
movsd  0x10(%rsp),%xmm1
mulsd  0x28(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x50(%rsp),%xmm0
mulsd  (%rsp),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
xorps  0xa94(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
lea    0xb57(%rip),%rdi
call   1030 <puts@plt>
movaps 0xa0(%rsp),%xmm0
cvtss2sd %xmm0,%xmm6
movsd  %xmm6,0x28(%rsp)
movaps 0x70(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movaps 0xb0(%rsp),%xmm0
cvtss2sd %xmm0,%xmm2
movsd  %xmm2,0x70(%rsp)
movaps 0x60(%rsp),%xmm0
cvtss2sd %xmm0,%xmm3
movaps 0x30(%rsp),%xmm0
cvtss2sd %xmm0,%xmm4
movsd  %xmm4,0x8(%rsp)
movaps 0x50(%rsp),%xmm0
cvtss2sd %xmm0,%xmm5
lea    0xa87(%rip),%rdi
movaps %xmm6,%xmm0
mov    $0x6,%al
call   1050 <printf@plt>
movaps 0x60(%rsp),%xmm0
xorps  0xa10(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
lea    0xb0c(%rip),%rdi
call   1030 <puts@plt>
lea    0xa7e(%rip),%rdi
movsd  0x70(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xa76(%rip),%rdi
movsd  0x28(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xa6e(%rip),%rdi
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xa67(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
movaps 0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xa56(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movaps 0x60(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xa4b(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
ret
lea    0xaae(%rip),%rdi
call   1030 <puts@plt>
lea    0xad9(%rip),%rdi
call   1030 <puts@plt>
lea    0xaf8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [56 x i8] c"\0ADouble Couple - Moment Tensor Converter (by Onur TAN)\0A\00"
@.str.1 = [44 x i8] c"Usage : dc2mt Strike Dip Rake (in degrees)\0A\00"
@.str.2 = [58 x i8] c"Output Aki&Richards1980: Mxx Myy Mzz Mxy Mxz Myz \0A\0A\00"
@.str.3 = [25 x i8] c"\0AStrike = %9.5f degrees\0A\00"
@.str.4 = [21 x i8] c"Dip = %9.5f degrees\0A\00"
@.str.5 = [27 x i8] c"Rake/Slip = %9.5f degrees\0A\00"
@.str.6 = [58 x i8] c"\0AOutput Aki&Richards1980: Mxx Myy Mzz Mxy Mxz Myz \0A\00"
@.str.7 = [37 x i8] c"%9.5f %9.5f %9.5f %9.5f %9.5f %9.5f\0A\00"
@.str.8 = [55 x i8] c"\0AOutput Harvard CMTSOLUTION: Mrr Mtt Mpp Mrt Mrp Mtp\0A\00"
@.str.9 = [12 x i8] c"Mrr: %9.5f\0A\00"
@.str.10 = [12 x i8] c"Mtt: %9.5f\0A\00"
@.str.11 = [12 x i8] c"Mpp: %9.5f\0A\00"
@.str.12 = [12 x i8] c"Mrt: %9.5f\0A\00"
@.str.13 = [12 x i8] c"Mrp: %9.5f\0A\00"
@.str.14 = [13 x i8] c"Mtp: %9.5f\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
%20 = alloca float
store i32 %0, i32* %3
store i8** %1, i8*** %4
%21 = load i32, i32* %3
%22 = icmp ne i32 %21, 4
br i1 %22, label %23, label %28
23: ; preds = %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %2
store float 0x3F91DF46A0000000, float* %8
%29 = load i8**, i8*** %4
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call float @atof(i8* %31)
store float %32, float* %5
%33 = load i8**, i8*** %4
%34 = getelementptr inbounds i8*, i8** %33, i64 2
%35 = load i8*, i8** %34
%36 = call float @atof(i8* %35)
store float %36, float* %6
%37 = load i8**, i8*** %4
%38 = getelementptr inbounds i8*, i8** %37, i64 3
%39 = load i8*, i8** %38
%40 = call float @atof(i8* %39)
store float %40, float* %7
%41 = load float, float* %5
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), double %42)
%44 = load float, float* %6
%45 = fpext float %44 to double
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), double %45)
%47 = load float, float* %7
%48 = fpext float %47 to double
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), double %48)
%50 = load float, float* %8
%51 = load float, float* %5
%52 = fmul float %51, %50
store float %52, float* %5
%53 = load float, float* %8
%54 = load float, float* %6
%55 = fmul float %54, %53
store float %55, float* %6
%56 = load float, float* %8
%57 = load float, float* %7
%58 = fmul float %57, %56
store float %58, float* %7
%59 = load float, float* %6
%60 = call double @sin(float %59)
%61 = load float, float* %7
%62 = call double @cos(float %61)
%63 = fmul double %60, %62
%64 = load float, float* %5
%65 = fmul float 2.000000e+00, %64
%66 = call double @sin(float %65)
%67 = load float, float* %6
%68 = fmul float 2.000000e+00, %67
%69 = call double @sin(float %68)
%70 = load float, float* %7
%71 = call double @sin(float %70)
%72 = fmul double %69, %71
%73 = load float, float* %5
%74 = call double @sin(float %73)
%75 = fmul double %72, %74
%76 = load float, float* %5
%77 = call double @sin(float %76)
%78 = fmul double %75, %77
%79 = call double @llvm.fmuladd.f64(double %63, double %66, double %78)
%80 = fmul double -1.000000e+00, %79
%81 = fptrunc double %80 to float
store float %81, float* %9
%82 = load float, float* %6
%83 = call double @sin(float %82)
%84 = load float, float* %7
%85 = call double @cos(float %84)
%86 = fmul double %83, %85
%87 = load float, float* %5
%88 = fmul float 2.000000e+00, %87
%89 = call double @sin(float %88)
%90 = load float, float* %6
%91 = fmul float 2.000000e+00, %90
%92 = call double @sin(float %91)
%93 = load float, float* %7
%94 = call double @sin(float %93)
%95 = fmul double %92, %94
%96 = load float, float* %5
%97 = call double @cos(float %96)
%98 = fmul double %95, %97
%99 = load float, float* %5
%100 = call double @cos(float %99)
%101 = fmul double %98, %100
%102 = fneg double %101
%103 = call double @llvm.fmuladd.f64(double %86, double %89, double %102)
%104 = fptrunc double %103 to float
store float %104, float* %10
%105 = load float, float* %9
%106 = load float, float* %10
%107 = fadd float %105, %106
%108 = fpext float %107 to double
%109 = fmul double -1.000000e+00, %108
%110 = fptrunc double %109 to float
store float %110, float* %11
%111 = load float, float* %6
%112 = call double @sin(float %111)
%113 = load float, float* %7
%114 = call double @cos(float %113)
%115 = fmul double %112, %114
%116 = load float, float* %5
%117 = fmul float 2.000000e+00, %116
%118 = call double @cos(float %117)
%119 = load float, float* %6
%120 = fmul float 2.000000e+00, %119
%121 = call double @sin(float %120)
%122 = fmul double 5.000000e-01, %121
%123 = load float, float* %7
%124 = call double @sin(float %123)
%125 = fmul double %122, %124
%126 = load float, float* %5
%127 = fmul float 2.000000e+00, %126
%128 = call double @sin(float %127)
%129 = fmul double %125, %128
%130 = call double @llvm.fmuladd.f64(double %115, double %118, double %129)
%131 = fptrunc double %130 to float
store float %131, float* %12
%132 = load float, float* %6
%133 = call double @cos(float %132)
%134 = load float, float* %7
%135 = call double @cos(float %134)
%136 = fmul double %133, %135
%137 = load float, float* %5
%138 = call double @cos(float %137)
%139 = load float, float* %6
%140 = fmul float 2.000000e+00, %139
%141 = call double @cos(float %140)
%142 = load float, float* %7
%143 = call double @sin(float %142)
%144 = fmul double %141, %143
%145 = load float, float* %5
%146 = call double @sin(float %145)
%147 = fmul double %144, %146
%148 = call double @llvm.fmuladd.f64(double %136, double %138, double %147)
%149 = fmul double -1.000000e+00, %148
%150 = fptrunc double %149 to float
store float %150, float* %13
%151 = load float, float* %6
%152 = call double @cos(float %151)
%153 = load float, float* %7
%154 = call double @cos(float %153)
%155 = fmul double %152, %154
%156 = load float, float* %5
%157 = call double @sin(float %156)
%158 = load float, float* %6
%159 = fmul float 2.000000e+00, %158
%160 = call double @cos(float %159)
%161 = load float, float* %7
%162 = call double @sin(float %161)
%163 = fmul double %160, %162
%164 = load float, float* %5
%165 = call double @cos(float %164)
%166 = fmul double %163, %165
%167 = fneg double %166
%168 = call double @llvm.fmuladd.f64(double %155, double %157, double %167)
%169 = fmul double -1.000000e+00, %168
%170 = fptrunc double %169 to float
store float %170, float* %14
%171 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.6, i64 0, i64 0))
%172 = load float, float* %9
%173 = fpext float %172 to double
%174 = load float, float* %10
%175 = fpext float %174 to double
%176 = load float, float* %11
%177 = fpext float %176 to double
%178 = load float, float* %12
%179 = fpext float %178 to double
%180 = load float, float* %13
%181 = fpext float %180 to double
%182 = load float, float* %14
%183 = fpext float %182 to double
%184 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), double %173, double %175, double %177, double %179, double %181, double %183)
%185 = load float, float* %9
store float %185, float* %16
%186 = load float, float* %10
store float %186, float* %17
%187 = load float, float* %11
store float %187, float* %15
%188 = load float, float* %12
%189 = fpext float %188 to double
%190 = fmul double %189, -1.000000e+00
%191 = fptrunc double %190 to float
store float %191, float* %20
%192 = load float, float* %13
store float %192, float* %18
%193 = load float, float* %14
%194 = fpext float %193 to double
%195 = fmul double %194, -1.000000e+00
%196 = fptrunc double %195 to float
store float %196, float* %19
%197 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0))
%198 = load float, float* %15
%199 = fpext float %198 to double
%200 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), double %199)
%201 = load float, float* %16
%202 = fpext float %201 to double
%203 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), double %202)
%204 = load float, float* %17
%205 = fpext float %204 to double
%206 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), double %205)
%207 = load float, float* %18
%208 = fpext float %207 to double
%209 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), double %208)
%210 = load float, float* %19
%211 = fpext float %210 to double
%212 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0), double %211)
%213 = load float, float* %20
%214 = fpext float %213 to double
%215 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), double %214)
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [25 x i8] c"\0AStrike = %9.5f degrees\0A\00"
@.str.4 = [21 x i8] c"Dip = %9.5f degrees\0A\00"
@.str.5 = [27 x i8] c"Rake/Slip = %9.5f degrees\0A\00"
@.str.7 = [37 x i8] c"%9.5f %9.5f %9.5f %9.5f %9.5f %9.5f\0A\00"
@.str.9 = [12 x i8] c"Mrr: %9.5f\0A\00"
@.str.10 = [12 x i8] c"Mtt: %9.5f\0A\00"
@.str.11 = [12 x i8] c"Mpp: %9.5f\0A\00"
@.str.12 = [12 x i8] c"Mrt: %9.5f\0A\00"
@.str.13 = [12 x i8] c"Mrp: %9.5f\0A\00"
@.str.14 = [13 x i8] c"Mtp: %9.5f\0A\0A\00"
@str = [57 x i8] c"\0AOutput Aki&Richards1980: Mxx Myy Mzz Mxy Mxz Myz \00"
@str.15 = [54 x i8] c"\0AOutput Harvard CMTSOLUTION: Mrr Mtt Mpp Mrt Mrp Mtp\00"
@str.16 = [55 x i8] c"\0ADouble Couple - Moment Tensor Converter (by Onur TAN)\00"
@str.17 = [43 x i8] c"Usage : dc2mt Strike Dip Rake (in degrees)\00"
@str.18 = [57 x i8] c"Output Aki&Richards1980: Mxx Myy Mzz Mxy Mxz Myz \0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.16, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.17, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.18, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call float @atof(i8* %11)
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call float @atof(i8* %14)
%16 = getelementptr inbounds i8*, i8** %1, i64 3
%17 = load i8*, i8** %16
%18 = tail call float @atof(i8* %17)
%19 = fpext float %12 to double
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), double %19)
%21 = fpext float %15 to double
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), double %21)
%23 = fpext float %18 to double
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), double %23)
%25 = fmul float %12, 0x3F91DF46A0000000
%26 = fmul float %15, 0x3F91DF46A0000000
%27 = fmul float %18, 0x3F91DF46A0000000
%28 = tail call double @sin(float %26)
%29 = tail call double @cos(float %27)
%30 = fmul float %25, 2.000000e+00
%31 = tail call double @sin(float %30)
%32 = fmul float %26, 2.000000e+00
%33 = tail call double @sin(float %32)
%34 = tail call double @sin(float %27)
%35 = tail call double @sin(float %25)
%36 = tail call double @sin(float %25)
%37 = tail call double @sin(float %26)
%38 = tail call double @cos(float %27)
%39 = insertelement <2 x double> poison, double %38, i64 0
%40 = insertelement <2 x double> %39, double %28, i64 1
%41 = insertelement <2 x double> poison, double %37, i64 0
%42 = insertelement <2 x double> %41, double %29, i64 1
%43 = fmul <2 x double> %40, %42
%44 = tail call double @sin(float %30)
%45 = tail call double @sin(float %32)
%46 = tail call double @sin(float %27)
%47 = tail call double @cos(float %25)
%48 = tail call double @cos(float %25)
%49 = fneg double %45
%50 = insertelement <2 x double> poison, double %46, i64 0
%51 = insertelement <2 x double> %50, double %33, i64 1
%52 = insertelement <2 x double> poison, double %49, i64 0
%53 = insertelement <2 x double> %52, double %34, i64 1
%54 = fmul <2 x double> %51, %53
%55 = insertelement <2 x double> poison, double %47, i64 0
%56 = insertelement <2 x double> %55, double %35, i64 1
%57 = fmul <2 x double> %54, %56
%58 = insertelement <2 x double> poison, double %48, i64 0
%59 = insertelement <2 x double> %58, double %36, i64 1
%60 = fmul <2 x double> %57, %59
%61 = insertelement <2 x double> poison, double %44, i64 0
%62 = insertelement <2 x double> %61, double %31, i64 1
%63 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %43, <2 x double> %62, <2 x double> %60)
%64 = fptrunc <2 x double> %63 to <2 x float>
%65 = extractelement <2 x float> %64, i64 1
%66 = fneg float %65
%67 = extractelement <2 x float> %64, i64 0
%68 = fsub float %67, %65
%69 = fneg float %68
%70 = tail call double @sin(float %26)
%71 = tail call double @cos(float %27)
%72 = fmul double %70, %71
%73 = tail call double @cos(float %30)
%74 = tail call double @sin(float %32)
%75 = fmul double %74, 5.000000e-01
%76 = tail call double @sin(float %27)
%77 = fmul double %75, %76
%78 = tail call double @sin(float %30)
%79 = fmul double %77, %78
%80 = tail call double @llvm.fmuladd.f64(double %72, double %73, double %79)
%81 = fptrunc double %80 to float
%82 = tail call double @cos(float %26)
%83 = tail call double @cos(float %27)
%84 = fmul double %82, %83
%85 = tail call double @cos(float %25)
%86 = tail call double @cos(float %32)
%87 = tail call double @sin(float %27)
%88 = fmul double %86, %87
%89 = tail call double @sin(float %25)
%90 = fmul double %88, %89
%91 = tail call double @llvm.fmuladd.f64(double %84, double %85, double %90)
%92 = fptrunc double %91 to float
%93 = fneg float %92
%94 = tail call double @cos(float %26)
%95 = tail call double @cos(float %27)
%96 = fmul double %94, %95
%97 = tail call double @sin(float %25)
%98 = tail call double @cos(float %32)
%99 = tail call double @sin(float %27)
%100 = tail call double @cos(float %25)
%101 = fneg double %98
%102 = fmul double %99, %101
%103 = fmul double %102, %100
%104 = tail call double @llvm.fmuladd.f64(double %96, double %97, double %103)
%105 = fptrunc double %104 to float
%106 = fneg float %105
%107 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str, i64 0, i64 0))
%108 = fpext float %66 to double
%109 = fpext float %67 to double
%110 = fpext float %69 to double
%111 = fpext float %81 to double
%112 = fpext float %93 to double
%113 = fpext float %106 to double
%114 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), double %108, double %109, double %110, double %111, double %112, double %113)
%115 = fneg float %81
%116 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.15, i64 0, i64 0))
%117 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), double %110)
%118 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), double %108)
%119 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), double %109)
%120 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), double %112)
%121 = fpext float %105 to double
%122 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0), double %121)
%123 = fpext float %115 to double
%124 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), double %123)
ret i32 0
}