#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 */
double acos(double);
double cos(double);
double sin(double);
double sqrt(double);
void set_monocli(double lattice[3][3], double metric[3][3],
                 const char choice[6]) {
  double a, b, c, angle;
  int pos_char;
  ;
  ;
  if (choice[0] == '-') {
    pos_char = 1;
  } else {
    pos_char = 0;
  }
  a = sqrt(metric[0][0]);
  b = sqrt(metric[1][1]);
  c = sqrt(metric[2][2]);
  switch (choice[pos_char]) {
  case 'a':
    angle = acos(metric[1][2] / b / c);
    lattice[0][2] = c;
    lattice[1][0] = a;
    lattice[0][1] = b * cos(angle);
    lattice[2][1] = b * sin(angle);
    break;
  case 'b':
    angle = acos(metric[0][2] / a / c);
    lattice[0][0] = a;
    lattice[1][1] = b;
    lattice[0][2] = c * cos(angle);
    lattice[2][2] = c * sin(angle);
    break;
  case 'c':
    angle = acos(metric[0][1] / a / b);
    lattice[0][1] = b;
    lattice[1][2] = c;
    lattice[0][0] = a * cos(angle);
    lattice[2][0] = a * sin(angle);
    break;
  default:;
  }
}


x86 assembly (clang, -O0):
<set_monocli>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1170 <set_monocli+0x30>
movl   $0x1,-0x3c(%rbp)
jmp    1177 <set_monocli+0x37>
movl   $0x0,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x40(%rax),%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x40(%rbp)
sub    $0x61,%eax
je     11ee <set_monocli+0xae>
jmp    11cc <set_monocli+0x8c>
mov    -0x40(%rbp),%eax
sub    $0x62,%eax
je     127e <set_monocli+0x13e>
jmp    11dd <set_monocli+0x9d>
mov    -0x40(%rbp),%eax
sub    $0x63,%eax
je     130d <set_monocli+0x1cd>
jmp    139c <set_monocli+0x25c>
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm0
divsd  -0x28(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
call   1030 <acos@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x18(%rax)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x38(%rax)
jmp    13a1 <set_monocli+0x261>
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
call   1030 <acos@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x40(%rax)
jmp    13a1 <set_monocli+0x261>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
call   1030 <acos@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x28(%rax)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x30(%rax)
jmp    13a1 <set_monocli+0x261>
jmp    13a1 <set_monocli+0x261>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_monocli>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r14
xor    %ebx,%ebx
cmpb   $0x2d,(%rdx)
sete   %bpl
movsd  (%rsi),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1174 <set_monocli+0x34>
sqrtsd %xmm0,%xmm0
jmp    117d <set_monocli+0x3d>
call   1060 <sqrt@plt>
xorpd  %xmm1,%xmm1
movsd  %xmm0,0x8(%rsp)
mov    %bpl,%bl
movsd  0x20(%r12),%xmm0
ucomisd %xmm1,%xmm0
jb     1199 <set_monocli+0x59>
sqrtsd %xmm0,%xmm3
jmp    11a2 <set_monocli+0x62>
call   1060 <sqrt@plt>
movapd %xmm0,%xmm3
movsd  0x40(%r12),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11b9 <set_monocli+0x79>
sqrtsd %xmm0,%xmm0
jmp    11ca <set_monocli+0x8a>
movsd  %xmm3,0x10(%rsp)
call   1060 <sqrt@plt>
movsd  0x10(%rsp),%xmm3
movsbl (%r15,%rbx,1),%eax
cmp    $0x63,%eax
je     1216 <set_monocli+0xd6>
cmp    $0x62,%eax
je     124a <set_monocli+0x10a>
cmp    $0x61,%eax
jne    12df <set_monocli+0x19f>
add    $0x28,%r12
mov    $0x1,%r15d
mov    $0x2,%ebx
xor    %r13d,%r13d
movapd %xmm3,%xmm1
movapd %xmm0,%xmm2
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  %xmm3,0x10(%rsp)
jmp    127c <set_monocli+0x13c>
add    $0x8,%r12
mov    $0x2,%r13d
mov    $0x1,%ebx
xor    %r15d,%r15d
movsd  0x8(%rsp),%xmm4
movapd %xmm4,%xmm1
movapd %xmm3,%xmm2
movsd  %xmm3,0x20(%rsp)
movsd  %xmm0,0x18(%rsp)
movsd  %xmm4,0x10(%rsp)
jmp    127c <set_monocli+0x13c>
add    $0x10,%r12
mov    $0x2,%r15d
mov    $0x1,%r13d
xor    %ebx,%ebx
movsd  0x8(%rsp),%xmm4
movapd %xmm4,%xmm1
movapd %xmm0,%xmm2
movsd  %xmm4,0x20(%rsp)
movsd  %xmm3,0x18(%rsp)
movsd  %xmm0,0x10(%rsp)
movsd  (%r12),%xmm0
divsd  %xmm1,%xmm0
divsd  %xmm2,%xmm0
call   1030 <acos@plt>
movapd %xmm0,%xmm1
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  %xmm0,(%r14,%rbx,8)
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x18(%r14,%r13,8)
movapd %xmm1,%xmm0
call   1050 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%r14,%r15,8)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x30(%r14,%r15,8)
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @set_monocli([3 x double]* %0, [3 x double]* %1, i8* %2) {
%4 = alloca [3 x double]*
%5 = alloca [3 x double]*
%6 = alloca i8*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca i32
store [3 x double]* %0, [3 x double]** %4
store [3 x double]* %1, [3 x double]** %5
store i8* %2, i8** %6
%12 = load i8*, i8** %6
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 45
br i1 %16, label %17, label %18
17: ; preds = %3
store i32 1, i32* %11
br label %19
18: ; preds = %3
store i32 0, i32* %11
br label %19
19: ; preds = %18, %17
%20 = load [3 x double]*, [3 x double]** %5
%21 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0
%22 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0, i64 0
%23 = load double, double* %22
%24 = call double @sqrt(double %23)
store double %24, double* %7
%25 = load [3 x double]*, [3 x double]** %5
%26 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 1
%27 = getelementptr inbounds [3 x double], [3 x double]* %26, i64 0, i64 1
%28 = load double, double* %27
%29 = call double @sqrt(double %28)
store double %29, double* %8
%30 = load [3 x double]*, [3 x double]** %5
%31 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 2
%32 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 0, i64 2
%33 = load double, double* %32
%34 = call double @sqrt(double %33)
store double %34, double* %9
%35 = load i8*, i8** %6
%36 = load i32, i32* %11
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
switch i32 %40, label %137 [
i32 97, label %41
i32 98, label %73
i32 99, label %105
]
41: ; preds = %19
%42 = load [3 x double]*, [3 x double]** %5
%43 = getelementptr inbounds [3 x double], [3 x double]* %42, i64 1
%44 = getelementptr inbounds [3 x double], [3 x double]* %43, i64 0, i64 2
%45 = load double, double* %44
%46 = load double, double* %8
%47 = fdiv double %45, %46
%48 = load double, double* %9
%49 = fdiv double %47, %48
%50 = call double @acos(double %49)
store double %50, double* %10
%51 = load double, double* %9
%52 = load [3 x double]*, [3 x double]** %4
%53 = getelementptr inbounds [3 x double], [3 x double]* %52, i64 0
%54 = getelementptr inbounds [3 x double], [3 x double]* %53, i64 0, i64 2
store double %51, double* %54
%55 = load double, double* %7
%56 = load [3 x double]*, [3 x double]** %4
%57 = getelementptr inbounds [3 x double], [3 x double]* %56, i64 1
%58 = getelementptr inbounds [3 x double], [3 x double]* %57, i64 0, i64 0
store double %55, double* %58
%59 = load double, double* %8
%60 = load double, double* %10
%61 = call double @cos(double %60)
%62 = fmul double %59, %61
%63 = load [3 x double]*, [3 x double]** %4
%64 = getelementptr inbounds [3 x double], [3 x double]* %63, i64 0
%65 = getelementptr inbounds [3 x double], [3 x double]* %64, i64 0, i64 1
store double %62, double* %65
%66 = load double, double* %8
%67 = load double, double* %10
%68 = call double @sin(double %67)
%69 = fmul double %66, %68
%70 = load [3 x double]*, [3 x double]** %4
%71 = getelementptr inbounds [3 x double], [3 x double]* %70, i64 2
%72 = getelementptr inbounds [3 x double], [3 x double]* %71, i64 0, i64 1
store double %69, double* %72
br label %138
73: ; preds = %19
%74 = load [3 x double]*, [3 x double]** %5
%75 = getelementptr inbounds [3 x double], [3 x double]* %74, i64 0
%76 = getelementptr inbounds [3 x double], [3 x double]* %75, i64 0, i64 2
%77 = load double, double* %76
%78 = load double, double* %7
%79 = fdiv double %77, %78
%80 = load double, double* %9
%81 = fdiv double %79, %80
%82 = call double @acos(double %81)
store double %82, double* %10
%83 = load double, double* %7
%84 = load [3 x double]*, [3 x double]** %4
%85 = getelementptr inbounds [3 x double], [3 x double]* %84, i64 0
%86 = getelementptr inbounds [3 x double], [3 x double]* %85, i64 0, i64 0
store double %83, double* %86
%87 = load double, double* %8
%88 = load [3 x double]*, [3 x double]** %4
%89 = getelementptr inbounds [3 x double], [3 x double]* %88, i64 1
%90 = getelementptr inbounds [3 x double], [3 x double]* %89, i64 0, i64 1
store double %87, double* %90
%91 = load double, double* %9
%92 = load double, double* %10
%93 = call double @cos(double %92)
%94 = fmul double %91, %93
%95 = load [3 x double]*, [3 x double]** %4
%96 = getelementptr inbounds [3 x double], [3 x double]* %95, i64 0
%97 = getelementptr inbounds [3 x double], [3 x double]* %96, i64 0, i64 2
store double %94, double* %97
%98 = load double, double* %9
%99 = load double, double* %10
%100 = call double @sin(double %99)
%101 = fmul double %98, %100
%102 = load [3 x double]*, [3 x double]** %4
%103 = getelementptr inbounds [3 x double], [3 x double]* %102, i64 2
%104 = getelementptr inbounds [3 x double], [3 x double]* %103, i64 0, i64 2
store double %101, double* %104
br label %138
105: ; preds = %19
%106 = load [3 x double]*, [3 x double]** %5
%107 = getelementptr inbounds [3 x double], [3 x double]* %106, i64 0
%108 = getelementptr inbounds [3 x double], [3 x double]* %107, i64 0, i64 1
%109 = load double, double* %108
%110 = load double, double* %7
%111 = fdiv double %109, %110
%112 = load double, double* %8
%113 = fdiv double %111, %112
%114 = call double @acos(double %113)
store double %114, double* %10
%115 = load double, double* %8
%116 = load [3 x double]*, [3 x double]** %4
%117 = getelementptr inbounds [3 x double], [3 x double]* %116, i64 0
%118 = getelementptr inbounds [3 x double], [3 x double]* %117, i64 0, i64 1
store double %115, double* %118
%119 = load double, double* %9
%120 = load [3 x double]*, [3 x double]** %4
%121 = getelementptr inbounds [3 x double], [3 x double]* %120, i64 1
%122 = getelementptr inbounds [3 x double], [3 x double]* %121, i64 0, i64 2
store double %119, double* %122
%123 = load double, double* %7
%124 = load double, double* %10
%125 = call double @cos(double %124)
%126 = fmul double %123, %125
%127 = load [3 x double]*, [3 x double]** %4
%128 = getelementptr inbounds [3 x double], [3 x double]* %127, i64 0
%129 = getelementptr inbounds [3 x double], [3 x double]* %128, i64 0, i64 0
store double %126, double* %129
%130 = load double, double* %7
%131 = load double, double* %10
%132 = call double @sin(double %131)
%133 = fmul double %130, %132
%134 = load [3 x double]*, [3 x double]** %4
%135 = getelementptr inbounds [3 x double], [3 x double]* %134, i64 2
%136 = getelementptr inbounds [3 x double], [3 x double]* %135, i64 0, i64 0
store double %133, double* %136
br label %138
137: ; preds = %19
br label %138
138: ; preds = %137, %105, %73, %41
ret void
}

LLVM IR (-O2):
define void @set_monocli([3 x double]* nocapture writeonly %0, [3 x double]* nocapture %1, i8* nocapture %2) {
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 45
%6 = zext i1 %5 to i64
%7 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
%8 = load double, double* %7
%9 = tail call double @sqrt(double %8)
%10 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 1
%11 = load double, double* %10
%12 = tail call double @sqrt(double %11)
%13 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 2
%14 = load double, double* %13
%15 = tail call double @sqrt(double %14)
%16 = getelementptr inbounds i8, i8* %2, i64 %6
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
switch i32 %18, label %47 [
i32 97, label %19
i32 98, label %21
i32 99, label %23
]
19: ; preds = %3
%20 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 1, i64 2
br label %25
21: ; preds = %3
%22 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 2
br label %25
23: ; preds = %3
%24 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 1
br label %25
25: ; preds = %19, %21, %23
%26 = phi double* [ %20, %19 ], [ %22, %21 ], [ %24, %23 ]
%27 = phi double [ %12, %19 ], [ %9, %21 ], [ %9, %23 ]
%28 = phi double [ %15, %19 ], [ %15, %21 ], [ %12, %23 ]
%29 = phi i64 [ 2, %19 ], [ 0, %21 ], [ 1, %23 ]
%30 = phi double [ %15, %19 ], [ %9, %21 ], [ %12, %23 ]
%31 = phi i64 [ 0, %19 ], [ 1, %21 ], [ 2, %23 ]
%32 = phi double [ %9, %19 ], [ %12, %21 ], [ %15, %23 ]
%33 = phi double [ %12, %19 ], [ %15, %21 ], [ %9, %23 ]
%34 = phi i64 [ 1, %19 ], [ 2, %21 ], [ 0, %23 ]
%35 = load double, double* %26
%36 = fdiv double %35, %27
%37 = fdiv double %36, %28
%38 = tail call double @acos(double %37)
%39 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 %29
store double %30, double* %39
%40 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 %31
store double %32, double* %40
%41 = tail call double @cos(double %38)
%42 = fmul double %33, %41
%43 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 %34
store double %42, double* %43
%44 = tail call double @sin(double %38)
%45 = fmul double %33, %44
%46 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 %34
store double %45, double* %46
br label %47
47: ; preds = %25, %3
ret void
}