#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;
int atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
double gauss(double, double);
char getopt(int, char **, char *);
int /*<<< orphan*/ help();
char *optarg;
scalar_t__ optind;
int /*<<< orphan*/ printf(char *, double);
double sqrt(double);
int /*<<< orphan*/ stderr;
void one(int argc, char *argv[]) {
  int N = 80;
  char ch;
  double A = 4, p = 0.95;
  double sigW = 2, sigV = 3;
  while ((ch = getopt(argc, argv, "hN:")) != EOF)
    switch (ch) {
    case 'N':
      N = atoi(optarg);
      break;
    case 'h':
      help();
      break;
    default:
      fprintf(stderr, "Unknown option for one: '%s'\n", optarg);
      help();
    }
  argc -= optind;
  argv += optind;
  double x = 70, y = 0;
  long int n = 0;
  sigV = sqrt(sigV);
  sigW = sqrt(sigW);
  for (; n < N; n++) {
    x = A + p * x + gauss(0.0, sigV);
    y = x + gauss(0.0, sigW);
    printf("%.6f\n", y);
  }
}


x86 assembly (clang, -O0):
<one>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x50,-0x14(%rbp)
movsd  0xe8a(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe75(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe60(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe4b(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe60(%rip),%rdx
call   1060 <getopt@plt>
mov    %al,-0x15(%rbp)
movsbl %al,%eax
mov    0x2e06(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1259 <one+0xe9>
movsbl -0x15(%rbp),%eax
mov    %eax,-0x54(%rbp)
sub    $0x4e,%eax
je     120b <one+0x9b>
jmp    11fa <one+0x8a>
mov    -0x54(%rbp),%eax
sub    $0x68,%eax
je     1222 <one+0xb2>
jmp    122e <one+0xbe>
mov    0x2de6(%rip),%rax
mov    (%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    1254 <one+0xe4>
mov    $0x0,%al
call   1070 <help@plt>
jmp    1254 <one+0xe4>
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
mov    0x2dba(%rip),%rax
mov    (%rax),%rdx
lea    0xde4(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1070 <help@plt>
jmp    11ba <one+0x4a>
mov    0x2d78(%rip),%rax
mov    (%rax),%rcx
movslq -0x4(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    0x2d64(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
movsd  0xd95(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x50(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmp    %rcx,%rax
jge    1353 <one+0x1e3>
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x38(%rbp),%xmm1
xorps  %xmm0,%xmm0
call   1030 <gauss@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x30(%rbp),%xmm1
xorps  %xmm0,%xmm0
call   1030 <gauss@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
lea    0xd0d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    12be <one+0x14e>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<one>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%r12d
lea    0xeb0(%rip),%rdx
call   1060 <getopt@plt>
mov    0x2e5c(%rip),%r13
mov    $0x50,%ebp
cmp    0x0(%r13),%al
je     1207 <one+0xa7>
mov    $0x50,%r15d
lea    0xe8c(%rip),%r14
mov    0x2e55(%rip),%rbp
jmp    11e4 <one+0x84>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rdx
lea    0xe68(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
call   1070 <help@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1060 <getopt@plt>
cmp    0x0(%r13),%al
je     11ff <one+0x9f>
movsbl %al,%eax
cmp    $0x68,%eax
je     11c9 <one+0x69>
cmp    $0x4e,%eax
jne    11b0 <one+0x50>
mov    0x0(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,%r15d
jmp    11d0 <one+0x70>
test   %r15d,%r15d
jle    127d <one+0x11d>
movslq %r15d,%rbp
movsd  0xdf1(%rip),%xmm0
movsd  %xmm0,(%rsp)
lea    0xe2f(%rip),%rbx
nopl   0x0(%rax,%rax,1)
movsd  (%rsp),%xmm0
mulsd  0xddb(%rip),%xmm0
addsd  0xddb(%rip),%xmm0
movsd  %xmm0,(%rsp)
xorpd  %xmm0,%xmm0
movsd  0xdd2(%rip),%xmm1
call   1030 <gauss@plt>
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
xorpd  %xmm0,%xmm0
movsd  0xdbb(%rip),%xmm1
call   1030 <gauss@plt>
addsd  (%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
add    $0xffffffffffffffff,%rbp
jne    1220 <one+0xc0>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"hN:\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 @one(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 i64
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 80, i32* %5
store double 4.000000e+00, double* %7
store double 0x3FEE666666666666, double* %8
store double 2.000000e+00, double* %9
store double 3.000000e+00, double* %10
br label %14
14: ; preds = %35, %2
%15 = load i32, i32* %3
%16 = load i8**, i8*** %4
%17 = call signext i8 @getopt(i32 %15, i8** %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8 %17, i8* %6
%18 = sext i8 %17 to i32
%19 = load i8, i8* @EOF
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %18, %20
br i1 %21, label %22, label %36
22: ; preds = %14
%23 = load i8, i8* %6
%24 = sext i8 %23 to i32
switch i32 %24, label %30 [
i32 78, label %25
i32 104, label %28
]
25: ; preds = %22
%26 = load i8*, i8** @optarg
%27 = call i32 @atoi(i8* %26)
store i32 %27, i32* %5
br label %35
28: ; preds = %22
%29 = call i32 (...) @help()
br label %35
30: ; preds = %22
%31 = load i32, i32* @stderr
%32 = load i8*, i8** @optarg
%33 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %32)
%34 = call i32 (...) @help()
br label %35
35: ; preds = %30, %28, %25
br label %14
36: ; preds = %14
%37 = load i64, i64* @optind
%38 = load i32, i32* %3
%39 = sext i32 %38 to i64
%40 = sub nsw i64 %39, %37
%41 = trunc i64 %40 to i32
store i32 %41, i32* %3
%42 = load i64, i64* @optind
%43 = load i8**, i8*** %4
%44 = getelementptr inbounds i8*, i8** %43, i64 %42
store i8** %44, i8*** %4
store double 7.000000e+01, double* %11
store double 0.000000e+00, double* %12
store i64 0, i64* %13
%45 = load double, double* %10
%46 = call double @sqrt(double %45)
store double %46, double* %10
%47 = load double, double* %9
%48 = call double @sqrt(double %47)
store double %48, double* %9
br label %49
49: ; preds = %68, %36
%50 = load i64, i64* %13
%51 = load i32, i32* %5
%52 = sext i32 %51 to i64
%53 = icmp slt i64 %50, %52
br i1 %53, label %54, label %71
54: ; preds = %49
%55 = load double, double* %7
%56 = load double, double* %8
%57 = load double, double* %11
%58 = call double @llvm.fmuladd.f64(double %56, double %57, double %55)
%59 = load double, double* %10
%60 = call double @gauss(double 0.000000e+00, double %59)
%61 = fadd double %58, %60
store double %61, double* %11
%62 = load double, double* %11
%63 = load double, double* %9
%64 = call double @gauss(double 0.000000e+00, double %63)
%65 = fadd double %62, %64
store double %65, double* %12
%66 = load double, double* %12
%67 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %66)
br label %68
68: ; preds = %54
%69 = load i64, i64* %13
%70 = add nsw i64 %69, 1
store i64 %70, i64* %13
br label %49
71: ; preds = %49
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"hN:\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 @one(i32 %0, i8** %1) {
%3 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = load i8, i8* @EOF
%5 = icmp eq i8 %3, %4
br i1 %5, label %9, label %11
6: ; preds = %25
%7 = sext i32 %26 to i64
%8 = icmp sgt i32 %26, 0
br i1 %8, label %9, label %41
9: ; preds = %2, %6
%10 = phi i64 [ %7, %6 ], [ 80, %2 ]
br label %30
11: ; preds = %2, %25
%12 = phi i8 [ %27, %25 ], [ %3, %2 ]
%13 = phi i32 [ %26, %25 ], [ 80, %2 ]
%14 = sext i8 %12 to i32
switch i32 %14, label %20 [
i32 78, label %15
i32 104, label %18
]
15: ; preds = %11
%16 = load i8*, i8** @optarg
%17 = tail call i32 @atoi(i8* %16)
br label %25
18: ; preds = %11
%19 = tail call i32 (...) @help()
br label %25
20: ; preds = %11
%21 = load i32, i32* @stderr
%22 = load i8*, i8** @optarg
%23 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = tail call i32 (...) @help()
br label %25
25: ; preds = %20, %18, %15
%26 = phi i32 [ %13, %20 ], [ %13, %18 ], [ %17, %15 ]
%27 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%28 = load i8, i8* @EOF
%29 = icmp eq i8 %27, %28
br i1 %29, label %6, label %11
30: ; preds = %9, %30
%31 = phi i64 [ %39, %30 ], [ 0, %9 ]
%32 = phi double [ %35, %30 ], [ 7.000000e+01, %9 ]
%33 = tail call double @llvm.fmuladd.f64(double %32, double 0x3FEE666666666666, double 4.000000e+00)
%34 = tail call double @gauss(double 0.000000e+00, double 0x3FFBB67AE8584CAA)
%35 = fadd double %33, %34
%36 = tail call double @gauss(double 0.000000e+00, double 0x3FF6A09E667F3BCD)
%37 = fadd double %35, %36
%38 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %37)
%39 = add nuw nsw i64 %31, 1
%40 = icmp eq i64 %39, %10
br i1 %40, label %41, label %30
41: ; preds = %30, %6
ret void
}