#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 */
double abs(double);
double f(double);
double poleO(double, double, double, double, double);
int /*<<< orphan*/ printf(char *, ...);
double calka(double a, double b, double delta, double S, double fa, double fb,
             double fc) {
  double c = (a + b) / 2.0;
  printf("%f,%f S1\n", a, c);
  double fc1 = f((c + a) / 2.0);
  double fc2 = f((c + b) / 2.0);
  double S1 = poleO(a, c, fa, fc, fc1);
  printf("\n");
  printf("%f,%f S2\n", c, b);
  double S2 = poleO(c, b, fc, fb, fc2);
  printf("\n");
  if (abs((S1 + S2) - S) < delta)
    return S;
  return calka(a, c, delta / 2, S1, fa, fc, fc1) +
         calka(c, b, delta / 2, S2, fc, fb, fc2);
}


x86 assembly (clang, -O0):
<calka>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
movsd  %xmm6,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  0xe73(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
lea    0xe61(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movsd  -0x48(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  0xe40(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <f@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  0xe20(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <f@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm3
movsd  -0x50(%rbp),%xmm4
call   1040 <poleO@plt>
movsd  %xmm0,-0x60(%rbp)
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movsd  -0x48(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xde2(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movsd  -0x48(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm3
movsd  -0x58(%rbp),%xmm4
call   1040 <poleO@plt>
movsd  %xmm0,-0x68(%rbp)
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movsd  -0x60(%rbp),%xmm0
addsd  -0x68(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
call   1030 <abs@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    129d <calka+0x14d>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    131b <calka+0x1cb>
movsd  -0x10(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  0xd4c(%rip),%xmm3
divsd  %xmm3,%xmm2
movsd  -0x60(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x40(%rbp),%xmm5
movsd  -0x50(%rbp),%xmm6
call   1070 <calka@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  0xd13(%rip),%xmm3
divsd  %xmm3,%xmm2
movsd  -0x68(%rbp),%xmm3
movsd  -0x40(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
movsd  -0x58(%rbp),%xmm6
call   1070 <calka@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calka>:
sub    $0x68,%rsp
movsd  %xmm6,0x18(%rsp)
movsd  %xmm5,0x58(%rsp)
movsd  %xmm4,0x50(%rsp)
movsd  %xmm3,0x60(%rsp)
movsd  %xmm2,0x28(%rsp)
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x10(%rsp)
movapd %xmm0,%xmm2
addsd  %xmm1,%xmm2
mulsd  0xe62(%rip),%xmm2
movsd  %xmm2,0x8(%rsp)
lea    0xe5d(%rip),%rdi
movapd %xmm2,%xmm1
mov    $0x2,%al
call   1070 <printf@plt>
movsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
mulsd  0xe36(%rip),%xmm0
call   1060 <f@plt>
movsd  %xmm0,0x40(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0x20(%rsp),%xmm0
mulsd  0xe17(%rip),%xmm0
call   1060 <f@plt>
movsd  %xmm0,0x48(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x50(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
movsd  0x40(%rsp),%xmm4
call   1050 <poleO@plt>
movsd  %xmm0,0x38(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xde4(%rip),%rdi
movsd  0x8(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mov    $0x2,%al
call   1070 <printf@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x58(%rsp),%xmm3
movsd  0x48(%rsp),%xmm4
call   1050 <poleO@plt>
movsd  %xmm0,0x30(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0x38(%rsp),%xmm0
addsd  0x30(%rsp),%xmm0
subsd  0x60(%rsp),%xmm0
call   1040 <abs@plt>
movsd  0x28(%rsp),%xmm2
ucomisd %xmm0,%xmm2
movsd  0x60(%rsp),%xmm0
ja     130f <calka+0x1af>
mulsd  0xd5b(%rip),%xmm2
movsd  %xmm2,0x28(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x38(%rsp),%xmm3
movsd  0x50(%rsp),%xmm4
movsd  0x18(%rsp),%xmm5
movsd  0x40(%rsp),%xmm6
call   1080 <calka@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  0x28(%rsp),%xmm2
movsd  0x30(%rsp),%xmm3
movsd  0x18(%rsp),%xmm4
movsd  0x58(%rsp),%xmm5
movsd  0x48(%rsp),%xmm6
call   1080 <calka@plt>
addsd  0x10(%rsp),%xmm0
add    $0x68,%rsp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%f,%f S1\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [10 x i8] c"%f,%f S2\0A\00"
define double @calka(double %0, double %1, double %2, double %3, double %4, double %5, double %6) {
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
store double %0, double* %9
store double %1, double* %10
store double %2, double* %11
store double %3, double* %12
store double %4, double* %13
store double %5, double* %14
store double %6, double* %15
%21 = load double, double* %9
%22 = load double, double* %10
%23 = fadd double %21, %22
%24 = fdiv double %23, 2.000000e+00
store double %24, double* %16
%25 = load double, double* %9
%26 = load double, double* %16
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %25, double %26)
%28 = load double, double* %16
%29 = load double, double* %9
%30 = fadd double %28, %29
%31 = fdiv double %30, 2.000000e+00
%32 = call double @f(double %31)
store double %32, double* %17
%33 = load double, double* %16
%34 = load double, double* %10
%35 = fadd double %33, %34
%36 = fdiv double %35, 2.000000e+00
%37 = call double @f(double %36)
store double %37, double* %18
%38 = load double, double* %9
%39 = load double, double* %16
%40 = load double, double* %13
%41 = load double, double* %15
%42 = load double, double* %17
%43 = call double @poleO(double %38, double %39, double %40, double %41, double %42)
store double %43, double* %19
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%45 = load double, double* %16
%46 = load double, double* %10
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %45, double %46)
%48 = load double, double* %16
%49 = load double, double* %10
%50 = load double, double* %15
%51 = load double, double* %14
%52 = load double, double* %18
%53 = call double @poleO(double %48, double %49, double %50, double %51, double %52)
store double %53, double* %20
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%55 = load double, double* %19
%56 = load double, double* %20
%57 = fadd double %55, %56
%58 = load double, double* %12
%59 = fsub double %57, %58
%60 = call double @abs(double %59)
%61 = load double, double* %11
%62 = fcmp olt double %60, %61
br i1 %62, label %63, label %65
63: ; preds = %7
%64 = load double, double* %12
store double %64, double* %8
br label %85
65: ; preds = %7
%66 = load double, double* %9
%67 = load double, double* %16
%68 = load double, double* %11
%69 = fdiv double %68, 2.000000e+00
%70 = load double, double* %19
%71 = load double, double* %13
%72 = load double, double* %15
%73 = load double, double* %17
%74 = call double @calka(double %66, double %67, double %69, double %70, double %71, double %72, double %73)
%75 = load double, double* %16
%76 = load double, double* %10
%77 = load double, double* %11
%78 = fdiv double %77, 2.000000e+00
%79 = load double, double* %20
%80 = load double, double* %15
%81 = load double, double* %14
%82 = load double, double* %18
%83 = call double @calka(double %75, double %76, double %78, double %79, double %80, double %81, double %82)
%84 = fadd double %74, %83
store double %84, double* %8
br label %85
85: ; preds = %65, %63
%86 = load double, double* %8
ret double %86
}

LLVM IR (-O2):
@.str = [10 x i8] c"%f,%f S1\0A\00"
@.str.2 = [10 x i8] c"%f,%f S2\0A\00"
define double @calka(double %0, double %1, double %2, double %3, double %4, double %5, double %6) {
%8 = fadd double %0, %1
%9 = fmul double %8, 5.000000e-01
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %0, double %9)
%11 = fadd double %9, %0
%12 = fmul double %11, 5.000000e-01
%13 = tail call double @f(double %12)
%14 = fadd double %9, %1
%15 = fmul double %14, 5.000000e-01
%16 = tail call double @f(double %15)
%17 = tail call double @poleO(double %0, double %9, double %4, double %6, double %13)
%18 = tail call i32 @putchar(i32 10)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %9, double %1)
%20 = tail call double @poleO(double %9, double %1, double %6, double %5, double %16)
%21 = tail call i32 @putchar(i32 10)
%22 = fadd double %17, %20
%23 = fsub double %22, %3
%24 = tail call double @abs(double %23)
%25 = fcmp olt double %24, %2
br i1 %25, label %26, label %28
26: ; preds = %7, %28
%27 = phi double [ %32, %28 ], [ %3, %7 ]
ret double %27
28: ; preds = %7
%29 = fmul double %2, 5.000000e-01
%30 = tail call double @calka(double %0, double %9, double %29, double %17, double %4, double %6, double %13)
%31 = tail call double @calka(double %9, double %1, double %29, double %20, double %6, double %5, double %16)
%32 = fadd double %30, %31
br label %26
}