#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 /*<<< orphan*/ f(int, double *);
double arg(double *z) {
  if (!z[0]) {
    if (z[1] > 0)
      return 3.141593 / 2;
    else
      return -3.141593 / 2;
  }
  double tmp, temp[2] = {z[0], z[1]};
  z[0] = z[1] / z[0];
  z[1] = 0;
  f(6, z);
  tmp = z[0];
  z[0] = temp[0], temp[0] = tmp;
  z[1] = temp[1];
  if (z[0] > 0)
    return temp[0];
  else {
    if (z[1] >= 0)
      return temp[0] + 3.141593;
    else
      return temp[0] - 3.141593;
  }
}


x86 assembly (clang, -O0):
<arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1171 <arg+0x61>
jp     1171 <arg+0x61>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    115f <arg+0x4f>
movsd  0xeb3(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1258 <arg+0x148>
movsd  0xe99(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1258 <arg+0x148>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rsi
mov    $0x6,%edi
call   1030 <f@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1215 <arg+0x105>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1258 <arg+0x148>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1242 <arg+0x132>
movsd  0xddd(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1258 <arg+0x148>
movsd  -0x30(%rbp),%xmm0
movsd  0xdc1(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arg>:
push   %rbx
sub    $0x20,%rsp
movupd (%rdi),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1125 <arg+0x15>
jnp    1191 <arg+0x81>
mov    %rdi,%rbx
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
movapd %xmm0,%xmm2
movapd %xmm0,0x10(%rsp)
movapd %xmm1,(%rsp)
movapd %xmm1,%xmm0
divsd  %xmm2,%xmm0
movsd  %xmm0,(%rdi)
movq   $0x0,0x8(%rdi)
mov    $0x6,%edi
mov    %rbx,%rsi
call   1030 <f@plt>
movsd  (%rbx),%xmm0
movapd 0x10(%rsp),%xmm1
movupd %xmm1,(%rbx)
ucomisd 0xeaa(%rip),%xmm1
ja     11b4 <arg+0xa4>
xorpd  %xmm1,%xmm1
movapd (%rsp),%xmm2
ucomisd %xmm1,%xmm2
jae    11ac <arg+0x9c>
addsd  0xe89(%rip),%xmm0
jmp    11b4 <arg+0xa4>
unpckhpd %xmm0,%xmm0
xor    %eax,%eax
ucomisd %xmm1,%xmm0
seta   %al
lea    0xe5b(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
jmp    11b4 <arg+0xa4>
addsd  0xe5c(%rip),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @arg(double* %0) {
%2 = alloca double
%3 = alloca double*
%4 = alloca double
%5 = alloca [2 x double]
store double* %0, double** %3
%6 = load double*, double** %3
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = fcmp une double %8, 0.000000e+00
br i1 %9, label %17, label %10
10: ; preds = %1
%11 = load double*, double** %3
%12 = getelementptr inbounds double, double* %11, i64 1
%13 = load double, double* %12
%14 = fcmp ogt double %13, 0.000000e+00
br i1 %14, label %15, label %16
15: ; preds = %10
store double 0x3FF921FB82C2BD7F, double* %2
br label %72
16: ; preds = %10
store double 0xBFF921FB82C2BD7F, double* %2
br label %72
17: ; preds = %1
%18 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%19 = load double*, double** %3
%20 = getelementptr inbounds double, double* %19, i64 0
%21 = load double, double* %20
store double %21, double* %18
%22 = getelementptr inbounds double, double* %18, i64 1
%23 = load double*, double** %3
%24 = getelementptr inbounds double, double* %23, i64 1
%25 = load double, double* %24
store double %25, double* %22
%26 = load double*, double** %3
%27 = getelementptr inbounds double, double* %26, i64 1
%28 = load double, double* %27
%29 = load double*, double** %3
%30 = getelementptr inbounds double, double* %29, i64 0
%31 = load double, double* %30
%32 = fdiv double %28, %31
%33 = load double*, double** %3
%34 = getelementptr inbounds double, double* %33, i64 0
store double %32, double* %34
%35 = load double*, double** %3
%36 = getelementptr inbounds double, double* %35, i64 1
store double 0.000000e+00, double* %36
%37 = load double*, double** %3
%38 = call i32 @f(i32 6, double* %37)
%39 = load double*, double** %3
%40 = getelementptr inbounds double, double* %39, i64 0
%41 = load double, double* %40
store double %41, double* %4
%42 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%43 = load double, double* %42
%44 = load double*, double** %3
%45 = getelementptr inbounds double, double* %44, i64 0
store double %43, double* %45
%46 = load double, double* %4
%47 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
store double %46, double* %47
%48 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 1
%49 = load double, double* %48
%50 = load double*, double** %3
%51 = getelementptr inbounds double, double* %50, i64 1
store double %49, double* %51
%52 = load double*, double** %3
%53 = getelementptr inbounds double, double* %52, i64 0
%54 = load double, double* %53
%55 = fcmp ogt double %54, 0.000000e+00
br i1 %55, label %56, label %59
56: ; preds = %17
%57 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%58 = load double, double* %57
store double %58, double* %2
br label %72
59: ; preds = %17
%60 = load double*, double** %3
%61 = getelementptr inbounds double, double* %60, i64 1
%62 = load double, double* %61
%63 = fcmp oge double %62, 0.000000e+00
br i1 %63, label %64, label %68
64: ; preds = %59
%65 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%66 = load double, double* %65
%67 = fadd double %66, 0x400921FB82C2BD7F
store double %67, double* %2
br label %72
68: ; preds = %59
%69 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%70 = load double, double* %69
%71 = fsub double %70, 0x400921FB82C2BD7F
store double %71, double* %2
br label %72
72: ; preds = %68, %64, %56, %16, %15
%73 = load double, double* %2
ret double %73
}

LLVM IR (-O2):
define double @arg(double* %0) {
%2 = bitcast double* %0 to <2 x double>*
%3 = load <2 x double>, <2 x double>* %2
%4 = extractelement <2 x double> %3, i64 0
%5 = fcmp une double %4, 0.000000e+00
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = extractelement <2 x double> %3, i64 1
%8 = fcmp ogt double %7, 0.000000e+00
%9 = select i1 %8, double 0x3FF921FB82C2BD7F, double 0xBFF921FB82C2BD7F
br label %24
10: ; preds = %1
%11 = getelementptr inbounds double, double* %0, i64 1
%12 = extractelement <2 x double> %3, i64 1
%13 = fdiv double %12, %4
store double %13, double* %0
store double 0.000000e+00, double* %11
%14 = tail call i32 @f(i32 6, double* %0)
%15 = load double, double* %0
%16 = bitcast double* %0 to <2 x double>*
store <2 x double> %3, <2 x double>* %16
%17 = fcmp ogt double %4, 0.000000e+00
br i1 %17, label %24, label %18
18: ; preds = %10
%19 = fcmp ult double %12, 0.000000e+00
br i1 %19, label %22, label %20
20: ; preds = %18
%21 = fadd double %15, 0x400921FB82C2BD7F
br label %24
22: ; preds = %18
%23 = fadd double %15, 0xC00921FB82C2BD7F
br label %24
24: ; preds = %20, %22, %10, %6
%25 = phi double [ %9, %6 ], [ %21, %20 ], [ %23, %22 ], [ %15, %10 ]
ret double %25
}