#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 *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  float Mrr, Mtt, Mpp, Mrt, Mrp, Mtp;
  float Mxx, Myy, Mzz, Mxy, Mxz, Myz;
  if (argc != 7) {
    printf("\nHRV-CMT - Aki&Richards1980 Moment Tensor Element Converter (by "
           "Onur TAN)\n");
    printf("Usage : cmt2aki  Mrr Mtt Mpp Mrt Mrp Mtp\n");
    printf("Input Harvard CMTSOLUTION:  Mrr Mtt Mpp Mrt Mrp Mtp\n");
    printf("Output Aki&Richards1980:  Mxx  Myy  Mzz  Mxy  Mxz  Myz \n\n");
    exit(1);
  }
  Mrr = atof(argv[1]);
  Mtt = atof(argv[2]);
  Mpp = atof(argv[3]);
  Mrt = atof(argv[4]);
  Mrp = atof(argv[5]);
  Mtp = atof(argv[6]);
  Mxx = Mtt;
  Myy = Mpp;
  Mzz = Mrr;
  Mxy = Mtp * -1.;
  Mxz = Mrt;
  Myz = Mrp * -1.;
  printf("Output 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);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x7,-0x4(%rbp)
je     118b <main+0x5b>
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xef5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf11(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
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)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x28(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdda(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdb2(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x40(%rbp)
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x30(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x34(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x38(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
movss  -0x3c(%rbp),%xmm4
cvtss2sd %xmm4,%xmm4
movss  -0x40(%rbp),%xmm5
cvtss2sd %xmm5,%xmm5
lea    0xe7f(%rip),%rdi
mov    $0x6,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
cmp    $0x7,%edi
jne    121a <main+0xda>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1040 <atof@plt>
movss  %xmm0,0xc(%rsp)
mov    0x10(%rbx),%rdi
call   1040 <atof@plt>
movss  %xmm0,0x8(%rsp)
mov    0x18(%rbx),%rdi
call   1040 <atof@plt>
movss  %xmm0,0x4(%rsp)
mov    0x20(%rbx),%rdi
call   1040 <atof@plt>
movss  %xmm0,(%rsp)
mov    0x28(%rbx),%rdi
call   1040 <atof@plt>
movaps %xmm0,0x10(%rsp)
mov    0x30(%rbx),%rdi
call   1040 <atof@plt>
movaps 0xe56(%rip),%xmm2
xorps  %xmm2,%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x10(%rsp),%xmm1
xorps  %xmm2,%xmm1
movaps %xmm1,0x10(%rsp)
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x4(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  0xc(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
movaps 0x20(%rsp),%xmm3
cvtss2sd %xmm3,%xmm3
movss  (%rsp),%xmm4
cvtss2sd %xmm4,%xmm4
movaps 0x10(%rsp),%xmm5
cvtss2sd %xmm5,%xmm5
lea    0xe05(%rip),%rdi
mov    $0x6,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret
lea    0xe4c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
lea    0xea7(%rip),%rdi
call   1030 <puts@plt>
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [75 x i8] c"\0AHRV-CMT - Aki&Richards1980 Moment Tensor Element Converter (by Onur TAN)\0A\00"
@.str.1 = [42 x i8] c"Usage : cmt2aki Mrr Mtt Mpp Mrt Mrp Mtp\0A\00"
@.str.2 = [53 x i8] c"Input Harvard CMTSOLUTION: Mrr Mtt Mpp Mrt Mrp Mtp\0A\00"
@.str.3 = [58 x i8] c"Output Aki&Richards1980: Mxx Myy Mzz Mxy Mxz Myz \0A\0A\00"
@.str.4 = [57 x i8] c"Output Aki&Richards1980: Mxx Myy Mzz Mxy Mxz Myz \0A\00"
@.str.5 = [37 x i8] c"%9.5f %9.5f %9.5f %9.5f %9.5f %9.5f\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
store i32 %0, i32* %3
store i8** %1, i8*** %4
%17 = load i32, i32* %3
%18 = icmp ne i32 %17, 7
br i1 %18, label %19, label %25
19: ; preds = %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %2
%26 = load i8**, i8*** %4
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call float @atof(i8* %28)
store float %29, float* %5
%30 = load i8**, i8*** %4
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = call float @atof(i8* %32)
store float %33, float* %6
%34 = load i8**, i8*** %4
%35 = getelementptr inbounds i8*, i8** %34, i64 3
%36 = load i8*, i8** %35
%37 = call float @atof(i8* %36)
store float %37, float* %7
%38 = load i8**, i8*** %4
%39 = getelementptr inbounds i8*, i8** %38, i64 4
%40 = load i8*, i8** %39
%41 = call float @atof(i8* %40)
store float %41, float* %8
%42 = load i8**, i8*** %4
%43 = getelementptr inbounds i8*, i8** %42, i64 5
%44 = load i8*, i8** %43
%45 = call float @atof(i8* %44)
store float %45, float* %9
%46 = load i8**, i8*** %4
%47 = getelementptr inbounds i8*, i8** %46, i64 6
%48 = load i8*, i8** %47
%49 = call float @atof(i8* %48)
store float %49, float* %10
%50 = load float, float* %6
store float %50, float* %11
%51 = load float, float* %7
store float %51, float* %12
%52 = load float, float* %5
store float %52, float* %13
%53 = load float, float* %10
%54 = fpext float %53 to double
%55 = fmul double %54, -1.000000e+00
%56 = fptrunc double %55 to float
store float %56, float* %14
%57 = load float, float* %8
store float %57, float* %15
%58 = load float, float* %9
%59 = fpext float %58 to double
%60 = fmul double %59, -1.000000e+00
%61 = fptrunc double %60 to float
store float %61, float* %16
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.4, i64 0, i64 0))
%63 = load float, float* %11
%64 = fpext float %63 to double
%65 = load float, float* %12
%66 = fpext float %65 to double
%67 = load float, float* %13
%68 = fpext float %67 to double
%69 = load float, float* %14
%70 = fpext float %69 to double
%71 = load float, float* %15
%72 = fpext float %71 to double
%73 = load float, float* %16
%74 = fpext float %73 to double
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), double %64, double %66, double %68, double %70, double %72, double %74)
ret i32 0
}

LLVM IR (-O2):
@.str.5 = [37 x i8] c"%9.5f %9.5f %9.5f %9.5f %9.5f %9.5f\0A\00"
@str = [56 x i8] c"Output Aki&Richards1980: Mxx Myy Mzz Mxy Mxz Myz \00"
@str.6 = [74 x i8] c"\0AHRV-CMT - Aki&Richards1980 Moment Tensor Element Converter (by Onur TAN)\00"
@str.7 = [41 x i8] c"Usage : cmt2aki Mrr Mtt Mpp Mrt Mrp Mtp\00"
@str.8 = [52 x i8] c"Input Harvard CMTSOLUTION: Mrr Mtt Mpp Mrt Mrp Mtp\00"
@str.9 = [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, 7
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str.6, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.7, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.8, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.9, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call float @atof(i8* %12)
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call float @atof(i8* %15)
%17 = getelementptr inbounds i8*, i8** %1, i64 3
%18 = load i8*, i8** %17
%19 = tail call float @atof(i8* %18)
%20 = getelementptr inbounds i8*, i8** %1, i64 4
%21 = load i8*, i8** %20
%22 = tail call float @atof(i8* %21)
%23 = getelementptr inbounds i8*, i8** %1, i64 5
%24 = load i8*, i8** %23
%25 = tail call float @atof(i8* %24)
%26 = getelementptr inbounds i8*, i8** %1, i64 6
%27 = load i8*, i8** %26
%28 = tail call float @atof(i8* %27)
%29 = fneg float %28
%30 = fneg float %25
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str, i64 0, i64 0))
%32 = fpext float %16 to double
%33 = fpext float %19 to double
%34 = fpext float %13 to double
%35 = fpext float %29 to double
%36 = fpext float %22 to double
%37 = fpext float %30 to double
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), double %32, double %33, double %34, double %35, double %36, double %37)
ret i32 0
}