#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 asin(double);
int /*<<< orphan*/ printf(char *, double);
double sqrt(int);
int main() {
  int a[2];
  int b[2];
  a[0] = 1;
  a[1] = 2;
  b[0] = 3;
  b[1] = 2;
  int cross_product = a[0] * b[1] - a[1] * b[0];
  printf("A B cross product is %d\n", cross_product);
  double a_length = sqrt(a[0] * a[0] + a[1] * a[1]);
  printf("A length is %f\n", a_length);
  double b_length = sqrt(b[0] * b[0] + b[1] * b[1]);
  printf("B length is %f\n", b_length);
  double sinab = cross_product / (a_length * b_length);
  printf("sin A B is %f\n", sinab);
  double ab_angle = asin(sinab);
  printf("A B angle is %f\n", ab_angle);
  double ab_area = cross_product;
  printf("A B parallelogram area is %f\n", ab_area);
  double ab_area2 = cross_product / 2;
  printf("A B triangle area is %f\n", ab_area2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x2,-0x8(%rbp)
movl   $0x3,-0x14(%rbp)
movl   $0x2,-0x10(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   -0x14(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x18(%rbp)
cvtsi2sdl -0x18(%rbp),%xmm0
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
imul   -0xc(%rbp),%edi
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
add    %eax,%edi
call   1050 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
imul   -0x14(%rbp),%edi
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
add    %eax,%edi
call   1050 <sqrt@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
cvtsi2sdl -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
lea    0xe40(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
call   1040 <asin@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
lea    0xe2f(%rip),%rdi
call   1030 <printf@plt>
cvtsi2sdl -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
lea    0xe25(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
lea    0xe1e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
movsd  0xebd(%rip),%xmm0
call   1030 <printf@plt>
mov    $0x5,%edi
call   1050 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    $0xd,%edi
call   1050 <sqrt@plt>
movsd  %xmm0,0x10(%rsp)
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
movsd  0xe6c(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
call   1040 <asin@plt>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
movsd  0xe30(%rip),%xmm0
call   1030 <printf@plt>
lea    0xeab(%rip),%rdi
movsd  0xe24(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"A B cross product is %d\0A\00"
@.str.1 = [16 x i8] c"A length is %f\0A\00"
@.str.2 = [16 x i8] c"B length is %f\0A\00"
@.str.3 = [15 x i8] c"sin A B is %f\0A\00"
@.str.4 = [17 x i8] c"A B angle is %f\0A\00"
@.str.5 = [30 x i8] c"A B parallelogram area is %f\0A\00"
@.str.6 = [25 x i8] c"A B triangle area is %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca [2 x i32]
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 0, i32* %1
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
store i32 1, i32* %11
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
store i32 2, i32* %12
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
store i32 3, i32* %13
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
store i32 2, i32* %14
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%16 = load i32, i32* %15
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%18 = load i32, i32* %17
%19 = mul nsw i32 %16, %18
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%21 = load i32, i32* %20
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%23 = load i32, i32* %22
%24 = mul nsw i32 %21, %23
%25 = sub nsw i32 %19, %24
store i32 %25, i32* %4
%26 = load i32, i32* %4
%27 = sitofp i32 %26 to double
%28 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), double %27)
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%30 = load i32, i32* %29
%31 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%32 = load i32, i32* %31
%33 = mul nsw i32 %30, %32
%34 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%35 = load i32, i32* %34
%36 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%37 = load i32, i32* %36
%38 = mul nsw i32 %35, %37
%39 = add nsw i32 %33, %38
%40 = call double @sqrt(i32 %39)
store double %40, double* %5
%41 = load double, double* %5
%42 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %41)
%43 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%44 = load i32, i32* %43
%45 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%46 = load i32, i32* %45
%47 = mul nsw i32 %44, %46
%48 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%49 = load i32, i32* %48
%50 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%51 = load i32, i32* %50
%52 = mul nsw i32 %49, %51
%53 = add nsw i32 %47, %52
%54 = call double @sqrt(i32 %53)
store double %54, double* %6
%55 = load double, double* %6
%56 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %55)
%57 = load i32, i32* %4
%58 = sitofp i32 %57 to double
%59 = load double, double* %5
%60 = load double, double* %6
%61 = fmul double %59, %60
%62 = fdiv double %58, %61
store double %62, double* %7
%63 = load double, double* %7
%64 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %63)
%65 = load double, double* %7
%66 = call double @asin(double %65)
store double %66, double* %8
%67 = load double, double* %8
%68 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), double %67)
%69 = load i32, i32* %4
%70 = sitofp i32 %69 to double
store double %70, double* %9
%71 = load double, double* %9
%72 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), double %71)
%73 = load i32, i32* %4
%74 = sdiv i32 %73, 2
%75 = sitofp i32 %74 to double
store double %75, double* %10
%76 = load double, double* %10
%77 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), double %76)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"A B cross product is %d\0A\00"
@.str.1 = [16 x i8] c"A length is %f\0A\00"
@.str.2 = [16 x i8] c"B length is %f\0A\00"
@.str.3 = [15 x i8] c"sin A B is %f\0A\00"
@.str.4 = [17 x i8] c"A B angle is %f\0A\00"
@.str.5 = [30 x i8] c"A B parallelogram area is %f\0A\00"
@.str.6 = [25 x i8] c"A B triangle area is %f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), double -4.000000e+00)
%2 = tail call double @sqrt(i32 5)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %2)
%4 = tail call double @sqrt(i32 13)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %4)
%6 = fmul double %2, %4
%7 = fdiv double -4.000000e+00, %6
%8 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %7)
%9 = tail call double @asin(double %7)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), double %9)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), double -4.000000e+00)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), double -2.000000e+00)
ret i32 0
}