#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 RAND_MAX;
int atoi(char *);
double cos(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char getopt(int, char **, char *);
int /*<<< orphan*/ help();
int log(double);
char *optarg;
scalar_t__ optind;
int /*<<< orphan*/ printf(char *, double, ...);
double rand();
double sqrt(int);
int /*<<< orphan*/ stderr;
void white(int argc, char *argv[]) {
  int N = 80;
  char ch;
  int showTime = 0;
  int isUniform = 0;
  while ((ch = getopt(argc, argv, "hN:tu")) != EOF)
    switch (ch) {
    case 'N':
      N = atoi(optarg);
      break;
    case 'u':
      isUniform = 1;
      break;
    case 't':
      showTime = 1;
      break;
    case 'h':
      help();
      break;
    default:
      fprintf(stderr, "Unknown option for one: '%s'\n", optarg);
      help();
    }
  argc -= optind;
  argv += optind;
  int n = 0;
  double x, y;
  for (; n < N; n++) {
    x = (rand() + 1.0) / (RAND_MAX + 1.0);
    if (isUniform == 0) {
      y = (rand() + 1.0) / (RAND_MAX + 1.0);
      x = sqrt(-2 * log(y)) * cos(2 * 3.14159265358979323846 * x);
    }
    if (showTime) {
      printf("%u %.6f\n", n, x);
    } else {
      printf("%.6f\n", x);
    }
  }
}


x86 assembly (clang, -O0):
<white>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x50,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xeee(%rip),%rdx
call   1070 <getopt@plt>
mov    %al,-0x15(%rbp)
movsbl %al,%eax
mov    0x2e0c(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     126f <white+0xdf>
movsbl -0x15(%rbp),%eax
add    $0xffffffb2,%eax
mov    %eax,%ecx
mov    %rcx,-0x40(%rbp)
sub    $0x27,%eax
ja     1244 <white+0xb4>
mov    -0x40(%rbp),%rax
lea    0xe10(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2de8(%rip),%rax
mov    (%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    126a <white+0xda>
movl   $0x1,-0x20(%rbp)
jmp    126a <white+0xda>
movl   $0x1,-0x1c(%rbp)
jmp    126a <white+0xda>
mov    $0x0,%al
call   1080 <help@plt>
jmp    126a <white+0xda>
mov    0x2d75(%rip),%rax
mov    (%rax),%edi
mov    0x2da4(%rip),%rax
mov    (%rax),%rdx
lea    0xe58(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1080 <help@plt>
jmp    11b4 <white+0x24>
mov    0x2d5a(%rip),%rax
mov    (%rax),%rcx
movslq -0x4(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    0x2d46(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13a2 <white+0x212>
mov    $0x0,%al
call   10b0 <rand@plt>
movsd  0xd45(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xd39(%rip),%xmm1
mov    0x2d0a(%rip),%rax
addsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    1355 <white+0x1c5>
mov    $0x0,%al
call   10b0 <rand@plt>
movsd  0xd0c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xd00(%rip),%xmm1
mov    0x2cd1(%rip),%rax
addsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1060 <log@plt>
imul   $0xfffffffe,%eax,%edi
call   10a0 <sqrt@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  0xcd2(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     137c <white+0x1ec>
cvtsi2sdl -0x24(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
lea    0xd64(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    138f <white+0x1ff>
movsd  -0x30(%rbp),%xmm0
lea    0xd4f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1394 <white+0x204>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12a0 <white+0x110>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<white>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
lea    0xf06(%rip),%rdx
call   1070 <getopt@plt>
mov    0x2e2a(%rip),%rcx
cmp    (%rcx),%al
jne    11ca <white+0x3a>
mov    $0x50,%ebx
xor    %r15d,%r15d
xor    %r13d,%r13d
jmp    1270 <white+0xe0>
mov    $0x50,%ebx
xor    %r15d,%r15d
xor    %r13d,%r13d
jmp    1225 <white+0x95>
nopw   0x0(%rax,%rax,1)
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
mov    0x2e08(%rip),%rax
mov    (%rax),%rdx
lea    0xebc(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1080 <help@plt>
mov    %r12d,%r15d
mov    %ebp,%edi
mov    %r14,%rsi
lea    0xe9b(%rip),%rdx
call   1070 <getopt@plt>
mov    0x2dbf(%rip),%rcx
cmp    (%rcx),%al
je     1268 <white+0xd8>
mov    %r15d,%r12d
movsbl %al,%eax
add    $0xffffffb2,%eax
cmp    $0x27,%eax
ja     11e0 <white+0x50>
mov    $0x1,%r15d
lea    0xdd0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2da8(%rip),%rax
mov    (%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,%ebx
jmp    1206 <white+0x76>
nopl   0x0(%rax)
mov    $0x1,%r13d
jmp    1206 <white+0x76>
test   %ebx,%ebx
jle    136d <white+0x1dd>
xorpd  %xmm0,%xmm0
mov    0x2d5d(%rip),%rbp
lea    0xe55(%rip),%r14
lea    0xe4b(%rip),%r12
jmp    12b8 <white+0x128>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
movapd %xmm2,%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xd5a(%rip),%xmm1
movsd  (%rsp),%xmm0
addsd  %xmm1,%xmm0
add    $0xffffffff,%ebx
je     136d <white+0x1dd>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   10b0 <rand@plt>
movsd  0xd34(%rip),%xmm1
movapd %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  0x0(%rbp),%xmm0
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm2
test   %r15d,%r15d
je     12f0 <white+0x160>
test   %r13d,%r13d
jne    1355 <white+0x1c5>
jmp    1290 <white+0x100>
nopl   (%rax)
xor    %eax,%eax
movsd  %xmm2,0x10(%rsp)
call   10b0 <rand@plt>
addsd  0xcfb(%rip),%xmm0
movsd  0x0(%rbp),%xmm1
addsd  0xcee(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1060 <log@plt>
lea    (%rax,%rax,1),%edi
neg    %edi
call   10a0 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xccf(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <cos@plt>
movapd %xmm0,%xmm2
mulsd  0x8(%rsp),%xmm2
test   %r13d,%r13d
je     1290 <white+0x100>
mov    %r12,%rdi
movsd  (%rsp),%xmm0
movapd %xmm2,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
jmp    129e <white+0x10e>
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:tu\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
@RAND_MAX = global double 0.000000e+00
@.str.2 = [9 x i8] c"%u %.6f\0A\00"
@.str.3 = [6 x i8] c"%.6f\0A\00"
define void @white(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = alloca double
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 80, i32* %5
store i32 0, i32* %7
store i32 0, i32* %8
br label %12
12: ; preds = %35, %2
%13 = load i32, i32* %3
%14 = load i8**, i8*** %4
%15 = call signext i8 @getopt(i32 %13, i8** %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8 %15, i8* %6
%16 = sext i8 %15 to i32
%17 = load i8, i8* @EOF
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %16, %18
br i1 %19, label %20, label %36
20: ; preds = %12
%21 = load i8, i8* %6
%22 = sext i8 %21 to i32
switch i32 %22, label %30 [
i32 78, label %23
i32 117, label %26
i32 116, label %27
i32 104, label %28
]
23: ; preds = %20
%24 = load i8*, i8** @optarg
%25 = call i32 @atoi(i8* %24)
store i32 %25, i32* %5
br label %35
26: ; preds = %20
store i32 1, i32* %8
br label %35
27: ; preds = %20
store i32 1, i32* %7
br label %35
28: ; preds = %20
%29 = call i32 (...) @help()
br label %35
30: ; preds = %20
%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, %27, %26, %23
br label %12
36: ; preds = %12
%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 i32 0, i32* %9
br label %45
45: ; preds = %84, %36
%46 = load i32, i32* %9
%47 = load i32, i32* %5
%48 = icmp slt i32 %46, %47
br i1 %48, label %49, label %87
49: ; preds = %45
%50 = call double (...) @rand()
%51 = fadd double %50, 1.000000e+00
%52 = load double, double* @RAND_MAX
%53 = fadd double %52, 1.000000e+00
%54 = fdiv double %51, %53
store double %54, double* %10
%55 = load i32, i32* %8
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %72
57: ; preds = %49
%58 = call double (...) @rand()
%59 = fadd double %58, 1.000000e+00
%60 = load double, double* @RAND_MAX
%61 = fadd double %60, 1.000000e+00
%62 = fdiv double %59, %61
store double %62, double* %11
%63 = load double, double* %11
%64 = call i32 @log(double %63)
%65 = mul nsw i32 -2, %64
%66 = call double @sqrt(i32 %65)
%67 = load double, double* %10
%68 = fmul double 0x401921FB54442D18, %67
%69 = fptosi double %68 to i32
%70 = call double @cos(i32 %69)
%71 = fmul double %66, %70
store double %71, double* %10
br label %72
72: ; preds = %57, %49
%73 = load i32, i32* %7
%74 = icmp ne i32 %73, 0
br i1 %74, label %75, label %80
75: ; preds = %72
%76 = load i32, i32* %9
%77 = sitofp i32 %76 to double
%78 = load double, double* %10
%79 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), double %77, double %78)
br label %83
80: ; preds = %72
%81 = load double, double* %10
%82 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double %81)
br label %83
83: ; preds = %80, %75
br label %84
84: ; preds = %83
%85 = load i32, i32* %9
%86 = add nsw i32 %85, 1
store i32 %86, i32* %9
br label %45
87: ; preds = %45
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"hN:tu\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
@RAND_MAX = global double 0.000000e+00
@.str.2 = [9 x i8] c"%u %.6f\0A\00"
@.str.3 = [6 x i8] c"%.6f\0A\00"
define void @white(i32 %0, i8** %1) {
%3 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = load i8, i8* @EOF
%5 = icmp eq i8 %3, %4
br i1 %5, label %8, label %14
6: ; preds = %31
%7 = icmp sgt i32 %32, 0
br i1 %7, label %8, label %68
8: ; preds = %2, %6
%9 = phi i32 [ %34, %6 ], [ 0, %2 ]
%10 = phi i32 [ %33, %6 ], [ 0, %2 ]
%11 = phi i32 [ %32, %6 ], [ 80, %2 ]
%12 = icmp eq i32 %9, 0
%13 = icmp eq i32 %10, 0
br label %38
14: ; preds = %2, %31
%15 = phi i8 [ %35, %31 ], [ %3, %2 ]
%16 = phi i32 [ %34, %31 ], [ 0, %2 ]
%17 = phi i32 [ %33, %31 ], [ 0, %2 ]
%18 = phi i32 [ %32, %31 ], [ 80, %2 ]
%19 = sext i8 %15 to i32
switch i32 %19, label %26 [
i32 78, label %20
i32 117, label %31
i32 116, label %23
i32 104, label %24
]
20: ; preds = %14
%21 = load i8*, i8** @optarg
%22 = tail call i32 @atoi(i8* %21)
br label %31
23: ; preds = %14
br label %31
24: ; preds = %14
%25 = tail call i32 (...) @help()
br label %31
26: ; preds = %14
%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 = %14, %26, %24, %23, %20
%32 = phi i32 [ %18, %26 ], [ %18, %24 ], [ %18, %23 ], [ %22, %20 ], [ %18, %14 ]
%33 = phi i32 [ %17, %26 ], [ %17, %24 ], [ 1, %23 ], [ %17, %20 ], [ %17, %14 ]
%34 = phi i32 [ %16, %26 ], [ %16, %24 ], [ %16, %23 ], [ %16, %20 ], [ 1, %14 ]
%35 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%36 = load i8, i8* @EOF
%37 = icmp eq i8 %35, %36
br i1 %37, label %6, label %14
38: ; preds = %8, %65
%39 = phi i32 [ 0, %8 ], [ %66, %65 ]
%40 = tail call double (...) @rand()
%41 = fadd double %40, 1.000000e+00
%42 = load double, double* @RAND_MAX
%43 = fadd double %42, 1.000000e+00
%44 = fdiv double %41, %43
br i1 %12, label %45, label %58
45: ; preds = %38
%46 = tail call double (...) @rand()
%47 = fadd double %46, 1.000000e+00
%48 = load double, double* @RAND_MAX
%49 = fadd double %48, 1.000000e+00
%50 = fdiv double %47, %49
%51 = tail call i32 @log(double %50)
%52 = mul nsw i32 %51, -2
%53 = tail call double @sqrt(i32 %52)
%54 = fmul double %44, 0x401921FB54442D18
%55 = fptosi double %54 to i32
%56 = tail call double @cos(i32 %55)
%57 = fmul double %53, %56
br label %58
58: ; preds = %45, %38
%59 = phi double [ %57, %45 ], [ %44, %38 ]
br i1 %13, label %63, label %60
60: ; preds = %58
%61 = sitofp i32 %39 to double
%62 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), double %61, double %59)
br label %65
63: ; preds = %58
%64 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double %59)
br label %65
65: ; preds = %60, %63
%66 = add nuw nsw i32 %39, 1
%67 = icmp eq i32 %66, %11
br i1 %67, label %68, label %38
68: ; preds = %65, %6
ret void
}