#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(double *);
double *geomrnd(int, double);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ srand(int);
int /*<<< orphan*/ sscanf(char *, char *, ...);
int main(int argc, char *argv[]) {
  int n;
  double p;
  sscanf(argv[1], "%d", &n);
  sscanf(argv[2], "%lf", &p);
  int rint;
  FILE *fp;
  fp = fopen("/dev/urandom", "r");
  fread(&rint, 1, sizeof(int), fp);
  fclose(fp);
  srand(rint);
  double *arr = geomrnd(n, p);
  for (int i = 0; i < n; i++) {
    printf("%.20f\n", arr[i]);
  }
  free(arr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe5b(%rip),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1090 <sscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe44(%rip),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1090 <sscanf@plt>
lea    0xe36(%rip),%rdi
lea    0xe3c(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rcx
lea    -0x24(%rbp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1040 <fread@plt>
mov    -0x30(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x24(%rbp),%edi
call   1080 <srand@plt>
mov    -0x14(%rbp),%edi
movsd  -0x20(%rbp),%xmm0
call   1050 <geomrnd@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1254 <main+0xd4>
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xdd5(%rip),%rdi
call   1070 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1221 <main+0xa1>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe69(%rip),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1090 <sscanf@plt>
mov    0x10(%rbx),%rdi
lea    0xe57(%rip),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1090 <sscanf@plt>
lea    0xe48(%rip),%rdi
lea    0xe4e(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%rbx
lea    0x4(%rsp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %rax,%rcx
call   1040 <fread@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    0x4(%rsp),%edi
call   1080 <srand@plt>
mov    (%rsp),%edi
movsd  0x8(%rsp),%xmm0
call   1050 <geomrnd@plt>
mov    %rax,%r15
cmpl   $0x0,(%rsp)
jle    123b <main+0xbb>
xor    %ebx,%ebx
lea    0xe00(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
movsd  (%r15,%rbx,8),%xmm0
mov    %r14,%rdi
call   1070 <printf@plt>
add    $0x1,%rbx
movslq (%rsp),%rax
cmp    %rax,%rbx
jl     1220 <main+0xa0>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [13 x i8] c"/dev/urandom\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [7 x i8] c"%.20f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
%8 = alloca i32
%9 = alloca i32*
%10 = alloca double*
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 (i8*, i8*, ...) @sscanf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 2
%18 = load i8*, i8** %17
%19 = call i32 (i8*, i8*, ...) @sscanf(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %7)
%20 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %20, i32** %9
%21 = load i32*, i32** %9
%22 = call i32 @fread(i32* %8, i32 1, i32 4, i32* %21)
%23 = load i32*, i32** %9
%24 = call i32 @fclose(i32* %23)
%25 = load i32, i32* %8
%26 = call i32 @srand(i32 %25)
%27 = load i32, i32* %6
%28 = load double, double* %7
%29 = call double* @geomrnd(i32 %27, double %28)
store double* %29, double** %10
store i32 0, i32* %11
br label %30
30: ; preds = %41, %2
%31 = load i32, i32* %11
%32 = load i32, i32* %6
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %44
34: ; preds = %30
%35 = load double*, double** %10
%36 = load i32, i32* %11
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %35, i64 %37
%39 = load double, double* %38
%40 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %39)
br label %41
41: ; preds = %34
%42 = load i32, i32* %11
%43 = add nsw i32 %42, 1
store i32 %43, i32* %11
br label %30
44: ; preds = %30
%45 = load double*, double** %10
%46 = call i32 @free(double* %45)
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [13 x i8] c"/dev/urandom\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [7 x i8] c"%.20f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca i32
%6 = bitcast i32* %3 to i8*
%7 = bitcast double* %4 to i8*
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = call i32 (i8*, i8*, ...) @sscanf(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = call i32 (i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %4)
%14 = bitcast i32* %5 to i8*
%15 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @fread(i32* %5, i32 1, i32 4, i32* %15)
%17 = call i32 @fclose(i32* %15)
%18 = load i32, i32* %5
%19 = call i32 @srand(i32 %18)
%20 = load i32, i32* %3
%21 = load double, double* %4
%22 = call double* @geomrnd(i32 %20, double %21)
%23 = load i32, i32* %3
%24 = icmp sgt i32 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %27, %2
%26 = call i32 @free(double* %22)
ret i32 0
27: ; preds = %2, %27
%28 = phi i64 [ %32, %27 ], [ 0, %2 ]
%29 = getelementptr inbounds double, double* %22, i64 %28
%30 = load double, double* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %30)
%32 = add nuw nsw i64 %28, 1
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = icmp slt i64 %32, %34
br i1 %35, label %27, label %25
}