#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();
double f1(int, float, double);
double f2(int, float, double);
double f3(int, float, double);
void __attribute__((mips16)) g2(int i, float f, double d) {
  double r = i + f + d;
  if (f1(i, f, d) != r)
    abort();
  if (f2(i + 1, f + 1, d + 1) != r + 3)
    abort();
  if (f3(i + 2, f + 2, d + 2) != r + 6)
    abort();
}


x86 assembly (clang, -O0):
<g2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
movss  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1060 <f1@plt>
ucomisd -0x18(%rbp),%xmm0
jne    1195 <g2+0x55>
jp     1195 <g2+0x55>
jmp    119c <g2+0x5c>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
movss  0xe76(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
movsd  0xe51(%rip),%xmm1
addsd  -0x10(%rbp),%xmm1
call   1030 <f2@plt>
movsd  0xe37(%rip),%xmm1
addsd  -0x18(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jne    11e3 <g2+0xa3>
jp     11e3 <g2+0xa3>
jmp    11ea <g2+0xaa>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x4(%rbp),%edi
add    $0x2,%edi
movss  0xe2c(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
movsd  0xe13(%rip),%xmm1
addsd  -0x10(%rbp),%xmm1
call   1050 <f3@plt>
movsd  0xdf9(%rip),%xmm1
addsd  -0x18(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jne    1231 <g2+0xf1>
jp     1231 <g2+0xf1>
jmp    1238 <g2+0xf8>
mov    $0x0,%al
call   1040 <abort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g2>:
push   %rbx
sub    $0x20,%rsp
mov    %edi,%ebx
cvtsi2ss %edi,%xmm2
addss  %xmm0,%xmm2
cvtss2sd %xmm2,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x10(%rsp)
movss  %xmm0,0xc(%rsp)
movsd  %xmm1,0x18(%rsp)
call   1060 <f1@plt>
ucomisd 0x10(%rsp),%xmm0
jne    11f4 <g2+0xb4>
jp     11f4 <g2+0xb4>
lea    0x1(%rbx),%edi
movss  0xe7d(%rip),%xmm0
addss  0xc(%rsp),%xmm0
movsd  0xe77(%rip),%xmm1
addsd  0x18(%rsp),%xmm1
call   1030 <f2@plt>
movsd  0xe6c(%rip),%xmm1
addsd  0x10(%rsp),%xmm1
ucomisd %xmm1,%xmm0
jne    11f4 <g2+0xb4>
jp     11f4 <g2+0xb4>
add    $0x2,%ebx
movss  0xc(%rsp),%xmm0
addss  0xe41(%rip),%xmm0
movsd  0x18(%rsp),%xmm1
addsd  0xe47(%rip),%xmm1
mov    %ebx,%edi
call   1050 <f3@plt>
movsd  0x10(%rsp),%xmm1
addsd  0xe3a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11f4 <g2+0xb4>
jp     11f4 <g2+0xb4>
add    $0x20,%rsp
pop    %rbx
ret
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
define void @g2(i32 %0, float %1, double %2) {
%4 = alloca i32
%5 = alloca float
%6 = alloca double
%7 = alloca double
store i32 %0, i32* %4
store float %1, float* %5
store double %2, double* %6
%8 = load i32, i32* %4
%9 = sitofp i32 %8 to float
%10 = load float, float* %5
%11 = fadd float %9, %10
%12 = fpext float %11 to double
%13 = load double, double* %6
%14 = fadd double %12, %13
store double %14, double* %7
%15 = load i32, i32* %4
%16 = load float, float* %5
%17 = load double, double* %6
%18 = call double @f1(i32 %15, float %16, double %17)
%19 = load double, double* %7
%20 = fcmp une double %18, %19
br i1 %20, label %21, label %23
21: ; preds = %3
%22 = call i32 (...) @abort()
unreachable
23: ; preds = %3
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
%26 = load float, float* %5
%27 = fadd float %26, 1.000000e+00
%28 = load double, double* %6
%29 = fadd double %28, 1.000000e+00
%30 = call double @f2(i32 %25, float %27, double %29)
%31 = load double, double* %7
%32 = fadd double %31, 3.000000e+00
%33 = fcmp une double %30, %32
br i1 %33, label %34, label %36
34: ; preds = %23
%35 = call i32 (...) @abort()
unreachable
36: ; preds = %23
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 2
%39 = load float, float* %5
%40 = fadd float %39, 2.000000e+00
%41 = load double, double* %6
%42 = fadd double %41, 2.000000e+00
%43 = call double @f3(i32 %38, float %40, double %42)
%44 = load double, double* %7
%45 = fadd double %44, 6.000000e+00
%46 = fcmp une double %43, %45
br i1 %46, label %47, label %49
47: ; preds = %36
%48 = call i32 (...) @abort()
unreachable
49: ; preds = %36
ret void
}

LLVM IR (-O2):
define void @g2(i32 %0, float %1, double %2) {
%4 = sitofp i32 %0 to float
%5 = fadd float %4, %1
%6 = fpext float %5 to double
%7 = fadd double %6, %2
%8 = tail call double @f1(i32 %0, float %1, double %2)
%9 = fcmp une double %8, %7
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = tail call i32 (...) @abort()
unreachable
12: ; preds = %3
%13 = add nsw i32 %0, 1
%14 = fadd float %1, 1.000000e+00
%15 = fadd double %2, 1.000000e+00
%16 = tail call double @f2(i32 %13, float %14, double %15)
%17 = fadd double %7, 3.000000e+00
%18 = fcmp une double %16, %17
br i1 %18, label %19, label %21
19: ; preds = %12
%20 = tail call i32 (...) @abort()
unreachable
21: ; preds = %12
%22 = add nsw i32 %0, 2
%23 = fadd float %1, 2.000000e+00
%24 = fadd double %2, 2.000000e+00
%25 = tail call double @f3(i32 %22, float %23, double %24)
%26 = fadd double %7, 6.000000e+00
%27 = fcmp une double %25, %26
br i1 %27, label %28, label %30
28: ; preds = %21
%29 = tail call i32 (...) @abort()
unreachable
30: ; preds = %21
ret void
}