#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*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ f(double *);
main() {
  double foo[6];
  double tx = 0.0, ty, d;
  f(&ty);
  if (ty < 0)
    ty = -ty;
  d = (tx > ty) ? tx : ty;
  if (ty != d)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
lea    -0x50(%rbp),%rdi
call   1040 <f@plt>
xorps  %xmm0,%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    117f <main+0x4f>
movsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    119e <main+0x6e>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    11a8 <main+0x78>
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
ucomisd -0x58(%rbp),%xmm0
jne    11cd <main+0x9d>
jp     11cd <main+0x9d>
jmp    11d4 <main+0xa4>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rsp,%rdi
call   1040 <f@plt>
movsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    1155 <main+0x25>
xorpd  0xeb0(%rip),%xmm0
movlpd %xmm0,(%rsp)
maxsd  %xmm0,%xmm1
ucomisd %xmm1,%xmm0
jne    1161 <main+0x31>
jnp    1168 <main+0x38>
xor    %eax,%eax
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x double]
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %3
%6 = call i32 @f(double* %4)
%7 = load double, double* %4
%8 = fcmp olt double %7, 0.000000e+00
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load double, double* %4
%11 = fneg double %10
store double %11, double* %4
br label %12
12: ; preds = %9, %0
%13 = load double, double* %3
%14 = load double, double* %4
%15 = fcmp ogt double %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load double, double* %3
br label %20
18: ; preds = %12
%19 = load double, double* %4
br label %20
20: ; preds = %18, %16
%21 = phi double [ %17, %16 ], [ %19, %18 ]
store double %21, double* %5
%22 = load double, double* %4
%23 = load double, double* %5
%24 = fcmp une double %22, %23
br i1 %24, label %25, label %27
25: ; preds = %20
%26 = call i32 (...) @abort()
unreachable
27: ; preds = %20
%28 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i32 @f(double* %1)
%4 = load double, double* %1
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = fneg double %4
store double %7, double* %1
br label %8
8: ; preds = %6, %0
%9 = phi double [ %7, %6 ], [ %4, %0 ]
%10 = fcmp olt double %9, 0.000000e+00
%11 = select i1 %10, double 0.000000e+00, double %9
%12 = fcmp une double %9, %11
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = call i32 (...) @abort()
unreachable
15: ; preds = %8
%16 = call i32 @exit(i32 0)
unreachable
}