#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 */
int pow(float, int);
int /*<<< orphan*/ printf(char *, float);
float sqrt(float);
int main() {
  float a = 4;
  float b = -12;
  float c = 1;
  float d = -3;
  float r, p, q, t, s, root;
  r = b / a;
  p = (c / a) - (pow(r, 2) / 3);
  q = (d / a) - ((c * r) / (3 * a)) + ((2 * pow(r, 3)) / 27);
  t = ((4 * pow(p, 3)) + (27 * pow(q, 2))) / 27;
  s = pow((sqrt(t) - q) / 2, 1 / 3.0);
  root = s - (p / (3 * s)) - (r / 3);
  printf("Roten är %f\n", root);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xecd(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xebc(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xeab(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe9a(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x18(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movss  -0x38(%rbp),%xmm0
mov    $0x3,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
mulss  -0x18(%rbp),%xmm1
movss  0xe2a(%rip),%xmm2
mulss  -0x8(%rbp),%xmm2
divss  %xmm2,%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x18(%rbp),%xmm0
mov    $0x3,%edi
call   1040 <pow@plt>
movss  -0x34(%rbp),%xmm0
shl    $0x1,%eax
mov    $0x1b,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
mov    $0x3,%edi
call   1040 <pow@plt>
shl    $0x2,%eax
mov    %eax,-0x30(%rbp)
movss  -0x20(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
imul   $0x1b,%ecx,%ecx
add    %ecx,%eax
mov    $0x1b,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
call   1050 <sqrt@plt>
subss  -0x20(%rbp),%xmm0
movss  0xd9a(%rip),%xmm1
divss  %xmm1,%xmm0
xor    %edi,%edi
call   1040 <pow@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
movss  0xd70(%rip),%xmm2
mulss  -0x28(%rbp),%xmm2
divss  %xmm2,%xmm1
subss  %xmm1,%xmm0
movss  -0x18(%rbp),%xmm1
movss  0xd56(%rip),%xmm2
divss  %xmm2,%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
lea    0xd55(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movss  0xec3(%rip),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
cltq
imul   $0x55555556,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0xe98(%rip),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
movss  0xe82(%rip),%xmm0
mov    $0x3,%edi
call   1040 <pow@plt>
add    %eax,%eax
cltq
imul   $0x4bda12f7,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rax
add    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
addss  0xe59(%rip),%xmm0
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
mov    $0x3,%edi
call   1040 <pow@plt>
mov    %eax,%ebx
movss  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
lea    (%rax,%rax,8),%eax
lea    (%rax,%rax,2),%eax
lea    (%rax,%rbx,4),%eax
cltq
imul   $0x4bda12f7,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rax
add    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     120b <main+0xdb>
sqrtss %xmm0,%xmm0
jmp    1210 <main+0xe0>
call   1050 <sqrt@plt>
subss  0x8(%rsp),%xmm0
mulss  0xdee(%rip),%xmm0
xor    %edi,%edi
call   1040 <pow@plt>
cvtsi2ss %eax,%xmm2
movss  0xdcf(%rip),%xmm1
mulss  %xmm2,%xmm1
movss  0xc(%rsp),%xmm0
divss  %xmm1,%xmm0
addss  %xmm2,%xmm0
addss  0xdc5(%rip),%xmm0
lea    0xdc2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Roten \C3\A4r %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
store i32 0, i32* %1
store float 4.000000e+00, float* %2
store float -1.200000e+01, float* %3
store float 1.000000e+00, float* %4
store float -3.000000e+00, float* %5
%12 = load float, float* %3
%13 = load float, float* %2
%14 = fdiv float %12, %13
store float %14, float* %6
%15 = load float, float* %4
%16 = load float, float* %2
%17 = fdiv float %15, %16
%18 = load float, float* %6
%19 = call i32 @pow(float %18, i32 2)
%20 = sdiv i32 %19, 3
%21 = sitofp i32 %20 to float
%22 = fsub float %17, %21
store float %22, float* %7
%23 = load float, float* %5
%24 = load float, float* %2
%25 = fdiv float %23, %24
%26 = load float, float* %4
%27 = load float, float* %6
%28 = fmul float %26, %27
%29 = load float, float* %2
%30 = fmul float 3.000000e+00, %29
%31 = fdiv float %28, %30
%32 = fsub float %25, %31
%33 = load float, float* %6
%34 = call i32 @pow(float %33, i32 3)
%35 = mul nsw i32 2, %34
%36 = sdiv i32 %35, 27
%37 = sitofp i32 %36 to float
%38 = fadd float %32, %37
store float %38, float* %8
%39 = load float, float* %7
%40 = call i32 @pow(float %39, i32 3)
%41 = mul nsw i32 4, %40
%42 = load float, float* %8
%43 = call i32 @pow(float %42, i32 2)
%44 = mul nsw i32 27, %43
%45 = add nsw i32 %41, %44
%46 = sdiv i32 %45, 27
%47 = sitofp i32 %46 to float
store float %47, float* %9
%48 = load float, float* %9
%49 = call float @sqrt(float %48)
%50 = load float, float* %8
%51 = fsub float %49, %50
%52 = fdiv float %51, 2.000000e+00
%53 = call i32 @pow(float %52, i32 0)
%54 = sitofp i32 %53 to float
store float %54, float* %10
%55 = load float, float* %10
%56 = load float, float* %7
%57 = load float, float* %10
%58 = fmul float 3.000000e+00, %57
%59 = fdiv float %56, %58
%60 = fsub float %55, %59
%61 = load float, float* %6
%62 = fdiv float %61, 3.000000e+00
%63 = fsub float %60, %62
store float %63, float* %11
%64 = load float, float* %11
%65 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), float %64)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Roten \C3\A4r %f\0A\00"
define i32 @main() {
%1 = tail call i32 @pow(float -3.000000e+00, i32 2)
%2 = sdiv i32 %1, 3
%3 = sitofp i32 %2 to float
%4 = fsub float 2.500000e-01, %3
%5 = tail call i32 @pow(float -3.000000e+00, i32 3)
%6 = shl nsw i32 %5, 1
%7 = sdiv i32 %6, 27
%8 = sitofp i32 %7 to float
%9 = fadd float %8, -5.000000e-01
%10 = tail call i32 @pow(float %4, i32 3)
%11 = shl nsw i32 %10, 2
%12 = tail call i32 @pow(float %9, i32 2)
%13 = mul nsw i32 %12, 27
%14 = add nsw i32 %13, %11
%15 = sdiv i32 %14, 27
%16 = sitofp i32 %15 to float
%17 = tail call float @sqrt(float %16)
%18 = fsub float %17, %9
%19 = fmul float %18, 5.000000e-01
%20 = tail call i32 @pow(float %19, i32 0)
%21 = sitofp i32 %20 to float
%22 = fmul float %21, 3.000000e+00
%23 = fdiv float %4, %22
%24 = fsub float %21, %23
%25 = fadd float %24, 1.000000e+00
%26 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), float %25)
ret i32 0
}