int ubbf2(a1, a2)
double *a1, *a2;
{
  double s[5], aa2;
  int ic, ik;
  double d3(), Pi2;
  int i_min();
  Pi2 = 3.141592654 * 2.;
l1:
  ik = 1;
  for (aa2 = *a2 - Pi2; aa2 <= *a2 + Pi2 + 0.1; aa2 += Pi2) {
    s[ik] = d3(*a1, aa2);
    ik++;
  }
  ic = i_min(s[1], s[2], s[3]);
  if (ic == 1) {
    *a2 -= Pi2;
    goto l1;
  }
  if (ic == 2) {
    goto l2;
  }
  if (ic == 3) {
    *a2 += Pi2;
    goto l1;
  }
l2:
  return ic;
}


x86 assembly (clang, -O0):
<ubbf2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xec8(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x1,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  0xe98(%rip),%xmm2
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jb     11b9 <ubbf2+0x99>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x48(%rbp),%xmm1
mov    $0x2,%al
call   1030 <d3@plt>
movslq -0x50(%rbp),%rax
movsd  %xmm0,-0x40(%rbp,%rax,8)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
movsd  -0x58(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1156 <ubbf2+0x36>
movsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
mov    $0x3,%al
call   1040 <i_min@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x1,-0x4c(%rbp)
jne    11f6 <ubbf2+0xd6>
movsd  -0x58(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
jmp    113d <ubbf2+0x1d>
cmpl   $0x2,-0x4c(%rbp)
jne    1205 <ubbf2+0xe5>
jmp    122a <ubbf2+0x10a>
cmpl   $0x3,-0x4c(%rbp)
jne    1225 <ubbf2+0x105>
movsd  -0x58(%rbp),%xmm0
mov    -0x10(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
jmp    113d <ubbf2+0x1d>
jmp    122a <ubbf2+0x10a>
mov    -0x4c(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ubbf2>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%r12
mov    %rdi,%r14
movsd  (%rsi),%xmm0
lea    0x28(%rsp),%r15
movsd  0xec6(%rip),%xmm4
movsd  0xec6(%rip),%xmm2
jmp    1164 <ubbf2+0x44>
nopl   0x0(%rax)
addsd  (%r12),%xmm0
movsd  %xmm0,(%r12)
movsd  0xeac(%rip),%xmm2
movapd %xmm0,%xmm1
addsd  0xe90(%rip),%xmm1
addsd  %xmm4,%xmm0
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jb     11f8 <ubbf2+0xd8>
mov    %r15,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  %xmm1,0x8(%rsp)
movsd  (%r14),%xmm0
mov    $0x2,%al
call   1030 <d3@plt>
movsd  0x8(%rsp),%xmm1
movsd  %xmm0,(%rbx)
movsd  0xe54(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  (%r12),%xmm0
addsd  %xmm2,%xmm0
addsd  0xe46(%rip),%xmm0
add    $0x8,%rbx
ucomisd %xmm1,%xmm0
jae    1190 <ubbf2+0x70>
movsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x38(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
mov    $0x3,%al
call   1040 <i_min@plt>
movsd  0xdef(%rip),%xmm4
movapd %xmm4,%xmm0
cmp    $0x3,%eax
je     1150 <ubbf2+0x30>
cmp    $0x1,%eax
jne    1238 <ubbf2+0x118>
movsd  0xdcd(%rip),%xmm0
jmp    1150 <ubbf2+0x30>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @ubbf2(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca [5 x double]
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
store double* %0, double** %3
store double* %1, double** %4
store double 0x401921FB54524550, double* %9
br label %10
10: ; preds = %59, %47, %2
store i32 1, i32* %8
%11 = load double*, double** %4
%12 = load double, double* %11
%13 = load double, double* %9
%14 = fsub double %12, %13
store double %14, double* %6
br label %15
15: ; preds = %33, %10
%16 = load double, double* %6
%17 = load double*, double** %4
%18 = load double, double* %17
%19 = load double, double* %9
%20 = fadd double %18, %19
%21 = fadd double %20, 1.000000e-01
%22 = fcmp ole double %16, %21
br i1 %22, label %23, label %37
23: ; preds = %15
%24 = load double*, double** %3
%25 = load double, double* %24
%26 = load double, double* %6
%27 = call double (double, double, ...) bitcast (double (...)* @d3 to double (double, double, ...)*)(double %25, double %26)
%28 = load i32, i32* %8
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [5 x double], [5 x double]* %5, i64 0, i64 %29
store double %27, double* %30
%31 = load i32, i32* %8
%32 = add nsw i32 %31, 1
store i32 %32, i32* %8
br label %33
33: ; preds = %23
%34 = load double, double* %9
%35 = load double, double* %6
%36 = fadd double %35, %34
store double %36, double* %6
br label %15
37: ; preds = %15
%38 = getelementptr inbounds [5 x double], [5 x double]* %5, i64 0, i64 1
%39 = load double, double* %38
%40 = getelementptr inbounds [5 x double], [5 x double]* %5, i64 0, i64 2
%41 = load double, double* %40
%42 = getelementptr inbounds [5 x double], [5 x double]* %5, i64 0, i64 3
%43 = load double, double* %42
%44 = call i32 (double, double, double, ...) bitcast (i32 (...)* @i_min to i32 (double, double, double, ...)*)(double %39, double %41, double %43)
store i32 %44, i32* %7
%45 = load i32, i32* %7
%46 = icmp eq i32 %45, 1
br i1 %46, label %47, label %52
47: ; preds = %37
%48 = load double, double* %9
%49 = load double*, double** %4
%50 = load double, double* %49
%51 = fsub double %50, %48
store double %51, double* %49
br label %10
52: ; preds = %37
%53 = load i32, i32* %7
%54 = icmp eq i32 %53, 2
br i1 %54, label %55, label %56
55: ; preds = %52
br label %65
56: ; preds = %52
%57 = load i32, i32* %7
%58 = icmp eq i32 %57, 3
br i1 %58, label %59, label %64
59: ; preds = %56
%60 = load double, double* %9
%61 = load double*, double** %4
%62 = load double, double* %61
%63 = fadd double %62, %60
store double %63, double* %61
br label %10
64: ; preds = %56
br label %65
65: ; preds = %64, %55
%66 = load i32, i32* %7
ret i32 %66
}

LLVM IR (-O2):
define i32 @ubbf2(double* nocapture %0, double* nocapture %1) {
%3 = alloca [5 x double]
%4 = bitcast [5 x double]* %3 to i8*
%5 = getelementptr inbounds [5 x double], [5 x double]* %3, i64 0, i64 1
%6 = getelementptr inbounds [5 x double], [5 x double]* %3, i64 0, i64 2
%7 = getelementptr inbounds [5 x double], [5 x double]* %3, i64 0, i64 3
%8 = load double, double* %1
br label %9
9: ; preds = %40, %2
%10 = phi double [ %35, %40 ], [ undef, %2 ]
%11 = phi double [ %36, %40 ], [ undef, %2 ]
%12 = phi double [ %37, %40 ], [ undef, %2 ]
%13 = phi double [ %43, %40 ], [ %8, %2 ]
%14 = fadd double %13, 0xC01921FB54524550
%15 = fadd double %13, 0x401921FB54524550
%16 = fadd double %15, 1.000000e-01
%17 = fcmp ugt double %14, %16
br i1 %17, label %34, label %18
18: ; preds = %9, %18
%19 = phi i64 [ %24, %18 ], [ 1, %9 ]
%20 = phi double [ %25, %18 ], [ %14, %9 ]
%21 = load double, double* %0
%22 = tail call double (double, double, ...) bitcast (double (...)* @d3 to double (double, double, ...)*)(double %21, double %20)
%23 = getelementptr inbounds [5 x double], [5 x double]* %3, i64 0, i64 %19
store double %22, double* %23
%24 = add nuw i64 %19, 1
%25 = fadd double %20, 0x401921FB54524550
%26 = load double, double* %1
%27 = fadd double %26, 0x401921FB54524550
%28 = fadd double %27, 1.000000e-01
%29 = fcmp ugt double %25, %28
br i1 %29, label %30, label %18
30: ; preds = %18
%31 = load double, double* %5
%32 = load double, double* %6
%33 = load double, double* %7
br label %34
34: ; preds = %30, %9
%35 = phi double [ %33, %30 ], [ %10, %9 ]
%36 = phi double [ %32, %30 ], [ %11, %9 ]
%37 = phi double [ %31, %30 ], [ %12, %9 ]
%38 = tail call i32 (double, double, double, ...) bitcast (i32 (...)* @i_min to i32 (double, double, double, ...)*)(double %37, double %36, double %35)
switch i32 %38, label %44 [
i32 1, label %39
i32 3, label %40
]
39: ; preds = %34
br label %40
40: ; preds = %34, %39
%41 = phi double [ 0xC01921FB54524550, %39 ], [ 0x401921FB54524550, %34 ]
%42 = load double, double* %1
%43 = fadd double %42, %41
store double %43, double* %1
br label %9
44: ; preds = %34
ret i32 %38
}