#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 */
char EOF;
double atof(char *);
int atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char getopt(int, char **, char *);
int /*<<< orphan*/ help();
double *malloc(int);
char *optarg;
scalar_t__ optind;
double pow(double, double);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ stderr;
void wbc(int argc, char *argv[]) {
  int N = 80;
  char ch;
  double x = 0.5;
  double theta = 1.0;
  double tau = 2.0;
  double gama = 1.0;
  double lambda = 2.0;
  double Ts = 0.05;
  double n = 5.0404;
  int windowN = (int)tau / Ts;
  double *xt = malloc(windowN * sizeof(double));
  while ((ch = getopt(argc, argv, "hN:n:")) != EOF)
    switch (ch) {
    case 'N':
      N = atoi(optarg);
      break;
    case 'n':
      n = atof(optarg);
      break;
    case 'h':
      help();
      break;
    default:
      fprintf(stderr, "Unknown option for one: '%s'\n", optarg);
      help();
    }
  argc -= optind;
  argv += optind;
  double dx = 0;
  long int i = 0;
  int head = 0, tail = 0;
  int queueFull = 0;
  theta = pow(theta, n);
  for (; i < N; i++) {
    *(xt + head) = x;
    dx = -gama * x +
         (lambda * theta * (*(xt + tail))) / (theta + pow(*(xt + tail), n));
    x = x + dx * Ts;
    printf("%.6f\n", x);
    head++;
    if (head > (windowN - 1)) {
      queueFull = 1;
      head = 0;
    }
    if (queueFull) {
      if (head == windowN - 1) {
        tail = 0;
      } else {
        tail = head + 1;
      }
    }
  }
}


x86 assembly (clang, -O0):
<wbc>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x50,-0x14(%rbp)
movsd  0xe7f(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe6a(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe55(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe50(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe3b(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe26(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe11(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
cvttsd2si -0x30(%rbp),%eax
cvtsi2sd %eax,%xmm0
divsd  -0x48(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x54(%rbp)
movslq -0x54(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdfe(%rip),%rdx
call   1080 <getopt@plt>
mov    %al,-0x15(%rbp)
movsbl %al,%eax
mov    0x2da4(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     12e5 <wbc+0x165>
movsbl -0x15(%rbp),%eax
mov    %eax,-0x80(%rbp)
sub    $0x4e,%eax
je     127e <wbc+0xfe>
jmp    125c <wbc+0xdc>
mov    -0x80(%rbp),%eax
sub    $0x68,%eax
je     12ae <wbc+0x12e>
jmp    126d <wbc+0xed>
mov    -0x80(%rbp),%eax
sub    $0x6e,%eax
je     1295 <wbc+0x115>
jmp    12ba <wbc+0x13a>
mov    0x2d73(%rip),%rax
mov    (%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    12e0 <wbc+0x160>
mov    0x2d5c(%rip),%rax
mov    (%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x50(%rbp)
jmp    12e0 <wbc+0x160>
mov    $0x0,%al
call   1090 <help@plt>
jmp    12e0 <wbc+0x160>
mov    0x2d07(%rip),%rax
mov    (%rax),%edi
mov    0x2d2e(%rip),%rax
mov    (%rax),%rdx
lea    0xd5a(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1090 <help@plt>
jmp    121c <wbc+0x9c>
mov    0x2cec(%rip),%rax
mov    (%rax),%rcx
movslq -0x4(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    0x2cd8(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
movq   $0x0,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
call   1070 <pow@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x70(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmp    %rcx,%rax
jge    14b7 <wbc+0x337>
movsd  -0x20(%rbp),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x78(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x60(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x50(%rbp),%xmm1
call   1070 <pow@plt>
movsd  -0xa0(%rbp),%xmm3
ff
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0x90(%rbp),%xmm2
ff
movaps %xmm0,%xmm4
movsd  -0x88(%rbp),%xmm0
ff
addsd  %xmm4,%xmm3
divsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xc0d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%eax
mov    -0x54(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jle    146c <wbc+0x2ec>
movl   $0x1,-0x7c(%rbp)
movl   $0x0,-0x74(%rbp)
cmpl   $0x0,-0x7c(%rbp)
je     14a1 <wbc+0x321>
mov    -0x74(%rbp),%eax
mov    -0x54(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1493 <wbc+0x313>
movl   $0x0,-0x78(%rbp)
jmp    149c <wbc+0x31c>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    14a1 <wbc+0x321>
jmp    14a6 <wbc+0x326>
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x70(%rbp)
jmp    1348 <wbc+0x1c8>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wbc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0x140,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
lea    0xe79(%rip),%rdx
mov    %ebp,%edi
mov    %r14,%rsi
call   1080 <getopt@plt>
mov    0x2e28(%rip),%r13
cmp    0x0(%r13),%al
jne    11d0 <wbc+0x50>
movsd  0xe3a(%rip),%xmm0
mov    $0x50,%ebp
jmp    126e <wbc+0xee>
movl   $0x50,(%rsp)
movsd  0xe21(%rip),%xmm0
mov    0x2e12(%rip),%rbx
lea    0xe33(%rip),%r12
jmp    1228 <wbc+0xa8>
nop
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe23(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
call   1090 <help@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r12,%rdx
call   1080 <getopt@plt>
cmp    0x0(%r13),%al
movsd  0x8(%rsp),%xmm0
je     1260 <wbc+0xe0>
movsbl %al,%eax
cmp    $0x6e,%eax
je     1250 <wbc+0xd0>
cmp    $0x68,%eax
movsd  %xmm0,0x8(%rsp)
je     1208 <wbc+0x88>
cmp    $0x4e,%eax
jne    11f0 <wbc+0x70>
mov    (%rbx),%rdi
call   10a0 <atoi@plt>
mov    %eax,(%rsp)
jmp    120f <wbc+0x8f>
nopl   (%rax)
mov    (%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x8(%rsp)
jmp    120f <wbc+0x8f>
mov    (%rsp),%eax
test   %eax,%eax
jle    1327 <wbc+0x1a7>
movslq %eax,%rbp
movsd  0xd92(%rip),%xmm1
movsd  %xmm1,(%rsp)
xor    %r13d,%r13d
xor    %ebx,%ebx
xor    %r14d,%r14d
xor    %eax,%eax
movsd  %xmm0,0x8(%rsp)
nopl   0x0(%rax,%rax,1)
movslq %eax,%r12
movsd  (%rsp),%xmm0
movsd  %xmm0,(%r15,%r12,8)
movslq %r14d,%r14
movsd  (%r15,%r14,8),%xmm0
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x8(%rsp),%xmm1
call   1070 <pow@plt>
addsd  0xd48(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  (%rsp),%xmm0
subsd  %xmm0,%xmm1
mulsd  0xd35(%rip),%xmm1
addsd  %xmm1,%xmm0
lea    0xd56(%rip),%rdi
movsd  %xmm0,(%rsp)
call   1040 <printf@plt>
lea    0x1(%r12),%eax
cmp    $0x27,%r12d
cmovge %r13d,%eax
mov    $0x1,%ecx
cmovge %ecx,%ebx
lea    0x1(%rax),%ecx
cmp    $0x27,%eax
cmove  %r13d,%ecx
test   %ebx,%ebx
cmovne %ecx,%r14d
add    $0xffffffffffffffff,%rbp
jne    1290 <wbc+0x110>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"hN:n:\00"
@EOF = global i8 0
@optarg = global i8* null
@stderr = global i32 0
@.str.1 = [30 x i8] c"Unknown option for one: '%s'\0A\00"
@optind = global i64 0
@.str.2 = [6 x i8] c"%.6f\0A\00"
define void @wbc(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i8
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca i32
%15 = alloca double*
%16 = alloca double
%17 = alloca i64
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 80, i32* %5
store double 5.000000e-01, double* %7
store double 1.000000e+00, double* %8
store double 2.000000e+00, double* %9
store double 1.000000e+00, double* %10
store double 2.000000e+00, double* %11
store double 5.000000e-02, double* %12
store double 5.040400e+00, double* %13
%21 = load double, double* %9
%22 = fptosi double %21 to i32
%23 = sitofp i32 %22 to double
%24 = load double, double* %12
%25 = fdiv double %23, %24
%26 = fptosi double %25 to i32
store i32 %26, i32* %14
%27 = load i32, i32* %14
%28 = sext i32 %27 to i64
%29 = mul i64 %28, 8
%30 = trunc i64 %29 to i32
%31 = call double* @malloc(i32 %30)
store double* %31, double** %15
br label %32
32: ; preds = %56, %2
%33 = load i32, i32* %3
%34 = load i8**, i8*** %4
%35 = call signext i8 @getopt(i32 %33, i8** %34, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8 %35, i8* %6
%36 = sext i8 %35 to i32
%37 = load i8, i8* @EOF
%38 = sext i8 %37 to i32
%39 = icmp ne i32 %36, %38
br i1 %39, label %40, label %57
40: ; preds = %32
%41 = load i8, i8* %6
%42 = sext i8 %41 to i32
switch i32 %42, label %51 [
i32 78, label %43
i32 110, label %46
i32 104, label %49
]
43: ; preds = %40
%44 = load i8*, i8** @optarg
%45 = call i32 @atoi(i8* %44)
store i32 %45, i32* %5
br label %56
46: ; preds = %40
%47 = load i8*, i8** @optarg
%48 = call double @atof(i8* %47)
store double %48, double* %13
br label %56
49: ; preds = %40
%50 = call i32 (...) @help()
br label %56
51: ; preds = %40
%52 = load i32, i32* @stderr
%53 = load i8*, i8** @optarg
%54 = call i32 @fprintf(i32 %52, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %53)
%55 = call i32 (...) @help()
br label %56
56: ; preds = %51, %49, %46, %43
br label %32
57: ; preds = %32
%58 = load i64, i64* @optind
%59 = load i32, i32* %3
%60 = sext i32 %59 to i64
%61 = sub nsw i64 %60, %58
%62 = trunc i64 %61 to i32
store i32 %62, i32* %3
%63 = load i64, i64* @optind
%64 = load i8**, i8*** %4
%65 = getelementptr inbounds i8*, i8** %64, i64 %63
store i8** %65, i8*** %4
store double 0.000000e+00, double* %16
store i64 0, i64* %17
store i32 0, i32* %18
store i32 0, i32* %19
store i32 0, i32* %20
%66 = load double, double* %8
%67 = load double, double* %13
%68 = call double @pow(double %66, double %67)
store double %68, double* %8
br label %69
69: ; preds = %130, %57
%70 = load i64, i64* %17
%71 = load i32, i32* %5
%72 = sext i32 %71 to i64
%73 = icmp slt i64 %70, %72
br i1 %73, label %74, label %133
74: ; preds = %69
%75 = load double, double* %7
%76 = load double*, double** %15
%77 = load i32, i32* %18
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds double, double* %76, i64 %78
store double %75, double* %79
%80 = load double, double* %10
%81 = fneg double %80
%82 = load double, double* %7
%83 = load double, double* %11
%84 = load double, double* %8
%85 = fmul double %83, %84
%86 = load double*, double** %15
%87 = load i32, i32* %19
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds double, double* %86, i64 %88
%90 = load double, double* %89
%91 = fmul double %85, %90
%92 = load double, double* %8
%93 = load double*, double** %15
%94 = load i32, i32* %19
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds double, double* %93, i64 %95
%97 = load double, double* %96
%98 = load double, double* %13
%99 = call double @pow(double %97, double %98)
%100 = fadd double %92, %99
%101 = fdiv double %91, %100
%102 = call double @llvm.fmuladd.f64(double %81, double %82, double %101)
store double %102, double* %16
%103 = load double, double* %7
%104 = load double, double* %16
%105 = load double, double* %12
%106 = call double @llvm.fmuladd.f64(double %104, double %105, double %103)
store double %106, double* %7
%107 = load double, double* %7
%108 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %107)
%109 = load i32, i32* %18
%110 = add nsw i32 %109, 1
store i32 %110, i32* %18
%111 = load i32, i32* %18
%112 = load i32, i32* %14
%113 = sub nsw i32 %112, 1
%114 = icmp sgt i32 %111, %113
br i1 %114, label %115, label %116
115: ; preds = %74
store i32 1, i32* %20
store i32 0, i32* %18
br label %116
116: ; preds = %115, %74
%117 = load i32, i32* %20
%118 = icmp ne i32 %117, 0
br i1 %118, label %119, label %129
119: ; preds = %116
%120 = load i32, i32* %18
%121 = load i32, i32* %14
%122 = sub nsw i32 %121, 1
%123 = icmp eq i32 %120, %122
br i1 %123, label %124, label %125
124: ; preds = %119
store i32 0, i32* %19
br label %128
125: ; preds = %119
%126 = load i32, i32* %18
%127 = add nsw i32 %126, 1
store i32 %127, i32* %19
br label %128
128: ; preds = %125, %124
br label %129
129: ; preds = %128, %116
br label %130
130: ; preds = %129
%131 = load i64, i64* %17
%132 = add nsw i64 %131, 1
store i64 %132, i64* %17
br label %69
133: ; preds = %69
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"hN:n:\00"
@EOF = global i8 0
@optarg = global i8* null
@stderr = global i32 0
@.str.1 = [30 x i8] c"Unknown option for one: '%s'\0A\00"
@optind = global i64 0
@.str.2 = [6 x i8] c"%.6f\0A\00"
define void @wbc(i32 %0, i8** %1) {
%3 = tail call double* @malloc(i32 320)
%4 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = load i8, i8* @EOF
%6 = icmp eq i8 %4, %5
br i1 %6, label %10, label %13
7: ; preds = %31
%8 = sext i32 %32 to i64
%9 = icmp sgt i32 %32, 0
br i1 %9, label %10, label %66
10: ; preds = %2, %7
%11 = phi i64 [ %8, %7 ], [ 80, %2 ]
%12 = phi double [ %33, %7 ], [ 5.040400e+00, %2 ]
br label %37
13: ; preds = %2, %31
%14 = phi i8 [ %34, %31 ], [ %4, %2 ]
%15 = phi double [ %33, %31 ], [ 5.040400e+00, %2 ]
%16 = phi i32 [ %32, %31 ], [ 80, %2 ]
%17 = sext i8 %14 to i32
switch i32 %17, label %26 [
i32 78, label %18
i32 110, label %21
i32 104, label %24
]
18: ; preds = %13
%19 = load i8*, i8** @optarg
%20 = tail call i32 @atoi(i8* %19)
br label %31
21: ; preds = %13
%22 = load i8*, i8** @optarg
%23 = tail call double @atof(i8* %22)
br label %31
24: ; preds = %13
%25 = tail call i32 (...) @help()
br label %31
26: ; preds = %13
%27 = load i32, i32* @stderr
%28 = load i8*, i8** @optarg
%29 = tail call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %28)
%30 = tail call i32 (...) @help()
br label %31
31: ; preds = %26, %24, %21, %18
%32 = phi i32 [ %16, %26 ], [ %16, %24 ], [ %16, %21 ], [ %20, %18 ]
%33 = phi double [ %15, %26 ], [ %15, %24 ], [ %23, %21 ], [ %15, %18 ]
%34 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%35 = load i8, i8* @EOF
%36 = icmp eq i8 %34, %35
br i1 %36, label %7, label %13
37: ; preds = %10, %37
%38 = phi i32 [ %58, %37 ], [ 0, %10 ]
%39 = phi i32 [ %63, %37 ], [ 0, %10 ]
%40 = phi i32 [ %57, %37 ], [ 0, %10 ]
%41 = phi i64 [ %64, %37 ], [ 0, %10 ]
%42 = phi double [ %53, %37 ], [ 5.000000e-01, %10 ]
%43 = sext i32 %40 to i64
%44 = getelementptr inbounds double, double* %3, i64 %43
store double %42, double* %44
%45 = sext i32 %39 to i64
%46 = getelementptr inbounds double, double* %3, i64 %45
%47 = load double, double* %46
%48 = fmul double %47, 2.000000e+00
%49 = tail call double @pow(double %47, double %12)
%50 = fadd double %49, 1.000000e+00
%51 = fdiv double %48, %50
%52 = tail call double @llvm.fmuladd.f64(double %42, double -1.000000e+00, double %51)
%53 = tail call double @llvm.fmuladd.f64(double %52, double 5.000000e-02, double %42)
%54 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %53)
%55 = add nsw i32 %40, 1
%56 = icmp sgt i32 %40, 38
%57 = select i1 %56, i32 0, i32 %55
%58 = select i1 %56, i32 1, i32 %38
%59 = icmp eq i32 %58, 0
%60 = icmp eq i32 %57, 39
%61 = add nsw i32 %57, 1
%62 = select i1 %60, i32 0, i32 %61
%63 = select i1 %59, i32 %39, i32 %62
%64 = add nuw nsw i64 %41, 1
%65 = icmp eq i64 %64, %11
br i1 %65, label %66, label %37
66: ; preds = %37, %7
ret void
}