#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*/ ArbF3();
int /*<<< orphan*/ BNCHz();
int /*<<< orphan*/ BNCIO(int);
double pow(int, int);
int /*<<< orphan*/ printf(char *, double, ...);
int PulseF4(double freq) {
  char com1, data;
  int i8, i7, i6, i5, i4, i3, i2, i1, i0;
  double f8, f7, f6, f5, f4, f3, f2, f1;
  double xx, yy;
  int ii, jj, kk;
  int contrep;
  int stat = 0;
  printf("frequency = %0.2lf\n", freq);
  BNCIO(46);
  BNCIO(4);
  BNCIO(49);
  xx = freq;
  printf("frequency = %0.2lf, %lf\n", freq, xx);
  for (kk = 8; kk > -3; kk--) {
    yy = xx / pow(10, kk);
    ii = (int)yy;
    xx = xx - ((double)ii * pow(10, kk));
    if (kk == -1)
      BNCIO(16);
    BNCIO(ii);
    printf("frequency = %0.2lf, xx= %lf, yy=%lf \n", freq, xx, yy);
  }
  BNCHz();
  if (freq <= 10.) {
    BNCIO(40);
    BNCIO(1);
    BNCHz();
    BNCIO(24);
    BNCIO(46);
    BNCIO(2);
    contrep = 16000 / freq;
    xx = contrep;
    printf("frequency = %0.2lf, %lf\n", freq, xx);
    for (kk = 8; kk > -3; kk--) {
      yy = xx / pow(10, kk);
      ii = (int)yy;
      xx = xx - ((double)ii * pow(10, kk));
      if (kk == -1)
        BNCIO(16);
      BNCIO(ii);
      printf("frequency = %0.2lf, xx= %lf, yy=%lf \n", freq, xx, yy);
    }
    BNCHz();
    ArbF3();
  }
  return (stat);
}


x86 assembly (clang, -O0):
<PulseF4>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movsd  %xmm0,-0x8(%rbp)
movl   $0x0,-0x94(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xe9a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    $0x2e,%edi
call   1040 <BNCIO@plt>
mov    $0x4,%edi
call   1040 <BNCIO@plt>
mov    $0x31,%edi
call   1040 <BNCIO@plt>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm1
lea    0xe6e(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movl   $0x8,-0x8c(%rbp)
cmpl   $0xfffffffd,-0x8c(%rbp)
jle    12c7 <PulseF4+0x177>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
mov    -0x8c(%rbp),%esi
mov    $0xa,%edi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
cvttsd2si -0x80(%rbp),%eax
mov    %eax,-0x84(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
cvtsi2sdl -0x84(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x8c(%rbp),%esi
mov    $0xa,%edi
call   1050 <pow@plt>
movsd  -0xa8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xa0(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
cmpl   $0xffffffff,-0x8c(%rbp)
jne    128b <PulseF4+0x13b>
mov    $0x10,%edi
call   1040 <BNCIO@plt>
mov    -0x84(%rbp),%edi
call   1040 <BNCIO@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm2
lea    0xd91(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    -0x8c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8c(%rbp)
jmp    11c7 <PulseF4+0x77>
mov    $0x0,%al
call   1070 <BNCHz@plt>
movsd  0xd2a(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     146e <PulseF4+0x31e>
mov    $0x28,%edi
call   1040 <BNCIO@plt>
mov    $0x1,%edi
call   1040 <BNCIO@plt>
mov    $0x0,%al
call   1070 <BNCHz@plt>
mov    $0x18,%edi
call   1040 <BNCIO@plt>
mov    $0x2e,%edi
call   1040 <BNCIO@plt>
mov    $0x2,%edi
call   1040 <BNCIO@plt>
movsd  0xce6(%rip),%xmm0
divsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x90(%rbp)
cvtsi2sdl -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x78(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm1
lea    0xcd5(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movl   $0x8,-0x8c(%rbp)
cmpl   $0xfffffffd,-0x8c(%rbp)
jle    1460 <PulseF4+0x310>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
mov    -0x8c(%rbp),%esi
mov    $0xa,%edi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xc8(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
cvttsd2si -0x80(%rbp),%eax
mov    %eax,-0x84(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
cvtsi2sdl -0x84(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0x8c(%rbp),%esi
mov    $0xa,%edi
call   1050 <pow@plt>
movsd  -0xc0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xb8(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
cmpl   $0xffffffff,-0x8c(%rbp)
jne    1424 <PulseF4+0x2d4>
mov    $0x10,%edi
call   1040 <BNCIO@plt>
mov    -0x84(%rbp),%edi
call   1040 <BNCIO@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm2
lea    0xbf8(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    -0x8c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8c(%rbp)
jmp    1360 <PulseF4+0x210>
mov    $0x0,%al
call   1070 <BNCHz@plt>
mov    $0x0,%al
call   1060 <ArbF3@plt>
mov    -0x94(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PulseF4>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
movsd  %xmm0,0x8(%rsp)
lea    0xeab(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    $0x2e,%edi
call   1040 <BNCIO@plt>
mov    $0x4,%edi
call   1040 <BNCIO@plt>
mov    $0x31,%edi
call   1040 <BNCIO@plt>
lea    0xe93(%rip),%rdi
movsd  0x8(%rsp),%xmm0
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
mov    $0x9,%ebx
lea    0xe90(%rip),%r14
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
jmp    1218 <PulseF4+0xc8>
nopl   0x0(%rax,%rax,1)
movsd  0x20(%rsp),%xmm2
movapd %xmm2,%xmm1
divsd  0x10(%rsp),%xmm1
movapd %xmm1,0x10(%rsp)
cvttsd2si %xmm1,%edi
cvttpd2dq %xmm1,%xmm3
cvtdq2pd %xmm3,%xmm1
mulsd  %xmm0,%xmm1
subsd  %xmm1,%xmm2
movsd  %xmm2,0x20(%rsp)
call   1040 <BNCIO@plt>
mov    %r14,%rdi
movsd  0x8(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movaps 0x10(%rsp),%xmm2
mov    $0x3,%al
call   1030 <printf@plt>
add    $0xffffffff,%ebx
cmp    $0xfffffffe,%ebx
jle    1259 <PulseF4+0x109>
lea    -0x1(%rbx),%ebp
mov    $0xa,%edi
mov    %ebp,%esi
call   1050 <pow@plt>
movsd  %xmm0,0x10(%rsp)
mov    $0xa,%edi
mov    %ebp,%esi
call   1050 <pow@plt>
cmp    $0x1,%ebx
jae    11c0 <PulseF4+0x70>
mov    $0x10,%edi
movsd  %xmm0,0x38(%rsp)
call   1040 <BNCIO@plt>
movsd  0x38(%rsp),%xmm0
jmp    11c0 <PulseF4+0x70>
xor    %eax,%eax
call   1070 <BNCHz@plt>
movsd  0xd98(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
ucomisd %xmm1,%xmm0
jb     1397 <PulseF4+0x247>
mov    $0x28,%edi
call   1040 <BNCIO@plt>
mov    $0x1,%edi
call   1040 <BNCIO@plt>
xor    %eax,%eax
call   1070 <BNCHz@plt>
mov    $0x18,%edi
call   1040 <BNCIO@plt>
mov    $0x2e,%edi
call   1040 <BNCIO@plt>
mov    $0x2,%edi
call   1040 <BNCIO@plt>
movsd  0xd4f(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
divsd  %xmm0,%xmm1
cvttpd2dq %xmm1,%xmm1
cvtdq2pd %xmm1,%xmm1
lea    0xd52(%rip),%rdi
movapd %xmm1,0x20(%rsp)
mov    $0x2,%al
call   1030 <printf@plt>
mov    $0x9,%ebx
lea    0xd52(%rip),%r14
jmp    1348 <PulseF4+0x1f8>
nopl   (%rax)
movapd 0x20(%rsp),%xmm2
movapd %xmm2,%xmm1
divsd  0x10(%rsp),%xmm1
movapd %xmm1,0x10(%rsp)
cvttsd2si %xmm1,%edi
cvttpd2dq %xmm1,%xmm3
cvtdq2pd %xmm3,%xmm1
mulsd  %xmm0,%xmm1
subsd  %xmm1,%xmm2
movapd %xmm2,0x20(%rsp)
call   1040 <BNCIO@plt>
mov    %r14,%rdi
movsd  0x8(%rsp),%xmm0
movapd 0x20(%rsp),%xmm1
movaps 0x10(%rsp),%xmm2
mov    $0x3,%al
call   1030 <printf@plt>
add    $0xffffffff,%ebx
cmp    $0xfffffffe,%ebx
jle    1389 <PulseF4+0x239>
lea    -0x1(%rbx),%ebp
mov    $0xa,%edi
mov    %ebp,%esi
call   1050 <pow@plt>
movsd  %xmm0,0x10(%rsp)
mov    $0xa,%edi
mov    %ebp,%esi
call   1050 <pow@plt>
cmp    $0x1,%ebx
jae    12f0 <PulseF4+0x1a0>
mov    $0x10,%edi
movsd  %xmm0,0x38(%rsp)
call   1040 <BNCIO@plt>
movsd  0x38(%rsp),%xmm0
jmp    12f0 <PulseF4+0x1a0>
xor    %eax,%eax
call   1070 <BNCHz@plt>
xor    %eax,%eax
call   1060 <ArbF3@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"frequency = %0.2lf\0A\00"
@.str.1 = [25 x i8] c"frequency = %0.2lf, %lf\0A\00"
@.str.2 = [38 x i8] c"frequency = %0.2lf, xx= %lf, yy=%lf \0A\00"
define i32 @PulseF4(double %0) {
%2 = alloca double
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
store double %0, double* %2
store i32 0, i32* %28
%29 = load double, double* %2
%30 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double %29)
%31 = call i32 @BNCIO(i32 46)
%32 = call i32 @BNCIO(i32 4)
%33 = call i32 @BNCIO(i32 49)
%34 = load double, double* %2
store double %34, double* %22
%35 = load double, double* %2
%36 = load double, double* %22
%37 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), double %35, double %36)
store i32 8, i32* %26
br label %38
38: ; preds = %66, %1
%39 = load i32, i32* %26
%40 = icmp sgt i32 %39, -3
br i1 %40, label %41, label %69
41: ; preds = %38
%42 = load double, double* %22
%43 = load i32, i32* %26
%44 = call double @pow(i32 10, i32 %43)
%45 = fdiv double %42, %44
store double %45, double* %23
%46 = load double, double* %23
%47 = fptosi double %46 to i32
store i32 %47, i32* %24
%48 = load double, double* %22
%49 = load i32, i32* %24
%50 = sitofp i32 %49 to double
%51 = load i32, i32* %26
%52 = call double @pow(i32 10, i32 %51)
%53 = fneg double %50
%54 = call double @llvm.fmuladd.f64(double %53, double %52, double %48)
store double %54, double* %22
%55 = load i32, i32* %26
%56 = icmp eq i32 %55, -1
br i1 %56, label %57, label %59
57: ; preds = %41
%58 = call i32 @BNCIO(i32 16)
br label %59
59: ; preds = %57, %41
%60 = load i32, i32* %24
%61 = call i32 @BNCIO(i32 %60)
%62 = load double, double* %2
%63 = load double, double* %22
%64 = load double, double* %23
%65 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), double %62, double %63, double %64)
br label %66
66: ; preds = %59
%67 = load i32, i32* %26
%68 = add nsw i32 %67, -1
store i32 %68, i32* %26
br label %38
69: ; preds = %38
%70 = call i32 (...) @BNCHz()
%71 = load double, double* %2
%72 = fcmp ole double %71, 1.000000e+01
br i1 %72, label %73, label %122
73: ; preds = %69
%74 = call i32 @BNCIO(i32 40)
%75 = call i32 @BNCIO(i32 1)
%76 = call i32 (...) @BNCHz()
%77 = call i32 @BNCIO(i32 24)
%78 = call i32 @BNCIO(i32 46)
%79 = call i32 @BNCIO(i32 2)
%80 = load double, double* %2
%81 = fdiv double 1.600000e+04, %80
%82 = fptosi double %81 to i32
store i32 %82, i32* %27
%83 = load i32, i32* %27
%84 = sitofp i32 %83 to double
store double %84, double* %22
%85 = load double, double* %2
%86 = load double, double* %22
%87 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), double %85, double %86)
store i32 8, i32* %26
br label %88
88: ; preds = %116, %73
%89 = load i32, i32* %26
%90 = icmp sgt i32 %89, -3
br i1 %90, label %91, label %119
91: ; preds = %88
%92 = load double, double* %22
%93 = load i32, i32* %26
%94 = call double @pow(i32 10, i32 %93)
%95 = fdiv double %92, %94
store double %95, double* %23
%96 = load double, double* %23
%97 = fptosi double %96 to i32
store i32 %97, i32* %24
%98 = load double, double* %22
%99 = load i32, i32* %24
%100 = sitofp i32 %99 to double
%101 = load i32, i32* %26
%102 = call double @pow(i32 10, i32 %101)
%103 = fneg double %100
%104 = call double @llvm.fmuladd.f64(double %103, double %102, double %98)
store double %104, double* %22
%105 = load i32, i32* %26
%106 = icmp eq i32 %105, -1
br i1 %106, label %107, label %109
107: ; preds = %91
%108 = call i32 @BNCIO(i32 16)
br label %109
109: ; preds = %107, %91
%110 = load i32, i32* %24
%111 = call i32 @BNCIO(i32 %110)
%112 = load double, double* %2
%113 = load double, double* %22
%114 = load double, double* %23
%115 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), double %112, double %113, double %114)
br label %116
116: ; preds = %109
%117 = load i32, i32* %26
%118 = add nsw i32 %117, -1
store i32 %118, i32* %26
br label %88
119: ; preds = %88
%120 = call i32 (...) @BNCHz()
%121 = call i32 (...) @ArbF3()
br label %122
122: ; preds = %119, %69
%123 = load i32, i32* %28
ret i32 %123
}

LLVM IR (-O2):
@.str = [20 x i8] c"frequency = %0.2lf\0A\00"
@.str.1 = [25 x i8] c"frequency = %0.2lf, %lf\0A\00"
@.str.2 = [38 x i8] c"frequency = %0.2lf, xx= %lf, yy=%lf \0A\00"
define i32 @PulseF4(double %0) {
%2 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double %0)
%3 = tail call i32 @BNCIO(i32 46)
%4 = tail call i32 @BNCIO(i32 4)
%5 = tail call i32 @BNCIO(i32 49)
%6 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), double %0, double %0)
br label %7
7: ; preds = %1, %20
%8 = phi double [ %0, %1 ], [ %16, %20 ]
%9 = phi i32 [ 8, %1 ], [ %23, %20 ]
%10 = tail call double @pow(i32 10, i32 %9)
%11 = fdiv double %8, %10
%12 = fptosi double %11 to i32
%13 = sitofp i32 %12 to double
%14 = tail call double @pow(i32 10, i32 %9)
%15 = fneg double %13
%16 = tail call double @llvm.fmuladd.f64(double %15, double %14, double %8)
%17 = icmp eq i32 %9, -1
br i1 %17, label %18, label %20
18: ; preds = %7
%19 = tail call i32 @BNCIO(i32 16)
br label %20
20: ; preds = %18, %7
%21 = tail call i32 @BNCIO(i32 %12)
%22 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), double %0, double %16, double %11)
%23 = add nsw i32 %9, -1
%24 = icmp sgt i32 %9, -2
br i1 %24, label %7, label %25
25: ; preds = %20
%26 = tail call i32 (...) @BNCHz()
%27 = fcmp ugt double %0, 1.000000e+01
br i1 %27, label %60, label %28
28: ; preds = %25
%29 = tail call i32 @BNCIO(i32 40)
%30 = tail call i32 @BNCIO(i32 1)
%31 = tail call i32 (...) @BNCHz()
%32 = tail call i32 @BNCIO(i32 24)
%33 = tail call i32 @BNCIO(i32 46)
%34 = tail call i32 @BNCIO(i32 2)
%35 = fdiv double 1.600000e+04, %0
%36 = fptosi double %35 to i32
%37 = sitofp i32 %36 to double
%38 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), double %0, double %37)
br label %39
39: ; preds = %28, %52
%40 = phi double [ %37, %28 ], [ %48, %52 ]
%41 = phi i32 [ 8, %28 ], [ %55, %52 ]
%42 = tail call double @pow(i32 10, i32 %41)
%43 = fdiv double %40, %42
%44 = fptosi double %43 to i32
%45 = sitofp i32 %44 to double
%46 = tail call double @pow(i32 10, i32 %41)
%47 = fneg double %45
%48 = tail call double @llvm.fmuladd.f64(double %47, double %46, double %40)
%49 = icmp eq i32 %41, -1
br i1 %49, label %50, label %52
50: ; preds = %39
%51 = tail call i32 @BNCIO(i32 16)
br label %52
52: ; preds = %50, %39
%53 = tail call i32 @BNCIO(i32 %44)
%54 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), double %0, double %48, double %43)
%55 = add nsw i32 %41, -1
%56 = icmp sgt i32 %41, -2
br i1 %56, label %39, label %57
57: ; preds = %52
%58 = tail call i32 (...) @BNCHz()
%59 = tail call i32 (...) @ArbF3()
br label %60
60: ; preds = %57, %25
ret i32 0
}