#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 */
struct result {
  int dummy;
};

/* Variables and functions */
double errHalf(struct result *, int, struct result *, int, int,
               int /*<<< orphan*/);
double errMaximize(struct result *r1, int size1, struct result *r2, int size2) {
  double max1, max2;
  if (size1 > 30)
    size1 = 30;
  if (size2 > 30)
    size2 = 30;
  max1 = errHalf(r1, size1, r2, size2, 5, 0);
  max2 = errHalf(r2, size2, r1, size1, 5, 0);
  return (max1 > max2 ? max1 : max2);
}


x86 assembly (clang, -O0):
<errMaximize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x1e,-0xc(%rbp)
jle    1137 <errMaximize+0x27>
movl   $0x1e,-0xc(%rbp)
cmpl   $0x1e,-0x1c(%rbp)
jle    1148 <errMaximize+0x38>
movl   $0x1e,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    $0x5,%r8d
xor    %r9d,%r9d
call   1030 <errHalf@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    $0x5,%r8d
xor    %r9d,%r9d
call   1030 <errHalf@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    11a9 <errMaximize+0x99>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    11b3 <errMaximize+0xa3>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<errMaximize>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
cmp    $0x1e,%esi
mov    $0x1e,%ebp
cmovge %ebp,%ebx
mov    %rdx,%r14
mov    %rdi,%r15
cmp    $0x1e,%ecx
cmovl  %ecx,%ebp
mov    %ebx,%esi
mov    %ebp,%ecx
mov    $0x5,%r8d
xor    %r9d,%r9d
call   1030 <errHalf@plt>
movsd  %xmm0,(%rsp)
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r15,%rdx
mov    %ebx,%ecx
mov    $0x5,%r8d
xor    %r9d,%r9d
call   1030 <errHalf@plt>
movsd  (%rsp),%xmm1
maxsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.result = type { i32 }
define double @errMaximize(%struct.result* %0, i32 %1, %struct.result* %2, i32 %3) {
%5 = alloca %struct.result*
%6 = alloca i32
%7 = alloca %struct.result*
%8 = alloca i32
%9 = alloca double
%10 = alloca double
store %struct.result* %0, %struct.result** %5
store i32 %1, i32* %6
store %struct.result* %2, %struct.result** %7
store i32 %3, i32* %8
%11 = load i32, i32* %6
%12 = icmp sgt i32 %11, 30
br i1 %12, label %13, label %14
13: ; preds = %4
store i32 30, i32* %6
br label %14
14: ; preds = %13, %4
%15 = load i32, i32* %8
%16 = icmp sgt i32 %15, 30
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 30, i32* %8
br label %18
18: ; preds = %17, %14
%19 = load %struct.result*, %struct.result** %5
%20 = load i32, i32* %6
%21 = load %struct.result*, %struct.result** %7
%22 = load i32, i32* %8
%23 = call double @errHalf(%struct.result* %19, i32 %20, %struct.result* %21, i32 %22, i32 5, i32 0)
store double %23, double* %9
%24 = load %struct.result*, %struct.result** %7
%25 = load i32, i32* %8
%26 = load %struct.result*, %struct.result** %5
%27 = load i32, i32* %6
%28 = call double @errHalf(%struct.result* %24, i32 %25, %struct.result* %26, i32 %27, i32 5, i32 0)
store double %28, double* %10
%29 = load double, double* %9
%30 = load double, double* %10
%31 = fcmp ogt double %29, %30
br i1 %31, label %32, label %34
32: ; preds = %18
%33 = load double, double* %9
br label %36
34: ; preds = %18
%35 = load double, double* %10
br label %36
36: ; preds = %34, %32
%37 = phi double [ %33, %32 ], [ %35, %34 ]
ret double %37
}

LLVM IR (-O2):
%struct.result = type { i32 }
define double @errMaximize(%struct.result* %0, i32 %1, %struct.result* %2, i32 %3) {
%5 = icmp slt i32 %1, 30
%6 = select i1 %5, i32 %1, i32 30
%7 = icmp slt i32 %3, 30
%8 = select i1 %7, i32 %3, i32 30
%9 = tail call double @errHalf(%struct.result* %0, i32 %6, %struct.result* %2, i32 %8, i32 5, i32 0)
%10 = tail call double @errHalf(%struct.result* %2, i32 %8, %struct.result* %0, i32 %6, i32 5, i32 0)
%11 = fcmp ogt double %9, %10
%12 = select i1 %11, double %9, double %10
ret double %12
}