// #target: macos-x64

extern fn int? testError();

fn void test()
{

    double x = ((double)testError() + testError()) ?? 100;
    double y = (1 << testError()) ?? 100;
    double z = testError() >> 1 ?? 100;
    double w = (double)testError() * testError() ?? 100;
}

/* #expect: else_checks.ll


declare i64 @testError(ptr) #0


define void @else_checks.test() #0 {
entry:
  %x = alloca double, align 8
  %retparam = alloca i32, align 4
  %retparam1 = alloca i32, align 4
  %y = alloca double, align 8
  %retparam5 = alloca i32, align 4
  %z = alloca double, align 8
  %retparam12 = alloca i32, align 4
  %w = alloca double, align 8
  %retparam19 = alloca i32, align 4
  %retparam23 = alloca i32, align 4
  %0 = call i64 @testError(ptr %retparam)
  %not_err = icmp eq i64 %0, 0
  %1 = call i1 @llvm.expect.i1(i1 %not_err, i1 true)
  br i1 %1, label %after_check, label %else_block

after_check:                                      ; preds = %entry
  %2 = load i32, ptr %retparam, align 4
  %sifp = sitofp i32 %2 to double
  %3 = call i64 @testError(ptr %retparam1)
  %not_err2 = icmp eq i64 %3, 0
  %4 = call i1 @llvm.expect.i1(i1 %not_err2, i1 true)
  br i1 %4, label %after_check3, label %else_block

after_check3:                                     ; preds = %after_check
  %5 = load i32, ptr %retparam1, align 4
  %sifp4 = sitofp i32 %5 to double
  %fadd = fadd double %sifp, %sifp4
  br label %phi_block

else_block:                                       ; preds = %after_check, %entry
  br label %phi_block

phi_block:                                        ; preds = %else_block, %after_check3
  %val = phi double [ %fadd, %after_check3 ], [ 1.000000e+02, %else_block ]
  store double %val, ptr %x, align 8
  %6 = call i64 @testError(ptr %retparam5)
  %not_err6 = icmp eq i64 %6, 0
  %7 = call i1 @llvm.expect.i1(i1 %not_err6, i1 true)
  br i1 %7, label %after_check7, label %else_block9

after_check7:                                     ; preds = %phi_block
  %8 = load i32, ptr %retparam5, align 4
  %shl = shl i32 1, %8
  %9 = freeze i32 %shl
  %sifp8 = sitofp i32 %9 to double
  br label %phi_block10

else_block9:                                      ; preds = %phi_block
  br label %phi_block10

phi_block10:                                      ; preds = %else_block9, %after_check7
  %val11 = phi double [ %sifp8, %after_check7 ], [ 1.000000e+02, %else_block9 ]
  store double %val11, ptr %y, align 8
  %10 = call i64 @testError(ptr %retparam12)
  %not_err13 = icmp eq i64 %10, 0
  %11 = call i1 @llvm.expect.i1(i1 %not_err13, i1 true)
  br i1 %11, label %after_check14, label %else_block16

after_check14:                                    ; preds = %phi_block10
  %12 = load i32, ptr %retparam12, align 4
  %ashr = ashr i32 %12, 1
  %13 = freeze i32 %ashr
  %sifp15 = sitofp i32 %13 to double
  br label %phi_block17

else_block16:                                     ; preds = %phi_block10
  br label %phi_block17

phi_block17:                                      ; preds = %else_block16, %after_check14
  %val18 = phi double [ %sifp15, %after_check14 ], [ 1.000000e+02, %else_block16 ]
  store double %val18, ptr %z, align 8
  %14 = call i64 @testError(ptr %retparam19)
  %not_err20 = icmp eq i64 %14, 0
  %15 = call i1 @llvm.expect.i1(i1 %not_err20, i1 true)
  br i1 %15, label %after_check21, label %else_block27

after_check21:                                    ; preds = %phi_block17
  %16 = load i32, ptr %retparam19, align 4
  %sifp22 = sitofp i32 %16 to double
  %17 = call i64 @testError(ptr %retparam23)
  %not_err24 = icmp eq i64 %17, 0
  %18 = call i1 @llvm.expect.i1(i1 %not_err24, i1 true)
  br i1 %18, label %after_check25, label %else_block27

after_check25:                                    ; preds = %after_check21
  %19 = load i32, ptr %retparam23, align 4
  %sifp26 = sitofp i32 %19 to double
  %fmul = fmul double %sifp22, %sifp26
  br label %phi_block28

else_block27:                                     ; preds = %after_check21, %phi_block17
  br label %phi_block28

phi_block28:                                      ; preds = %else_block27, %after_check25
  %val29 = phi double [ %fmul, %after_check25 ], [ 1.000000e+02, %else_block27 ]
  store double %val29, ptr %w, align 8
  ret void
}
