#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*/ EXIT_FAILURE;
int RAND_MAX;
float atof(char *);
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ free(float *);
float *malloc(int);
float *nxta(float, float *, int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ random();
int /*<<< orphan*/ srand(int);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int argc, char *argv[]) {
  if (argc != 4) {
    printf("Error. Pls supply 2 arguments: 1) int random seed 2) rate value "
           "(float or pure fraction) 3) Number of steps (duration of "
           "simulation).\n");
    exit(EXIT_FAILURE);
  }
  float rateparam;
  srand(atoi(argv[1]));
  char ttstr[32] = {0};
  char *tstr = strchr(argv[2], '/');
  int n, d;
  if (!tstr)
    rateparam = atof(argv[2]);
  else {
    strncpy(ttstr, argv[2], (tstr - argv[2]) * sizeof(char));
    ttstr[tstr - argv[2]] = '\0';
    n = atoi(ttstr);
    strcpy(ttstr, tstr + 1);
    d = atoi(ttstr);
    rateparam = (float)n / d;
  }
  int nsteps = atoi(argv[3]);
  float summit;
  int dsummit;
  int i;
  float *rfa = malloc(nsteps * sizeof(float));
  for (i = 0; i < nsteps; ++i)
    rfa[i] = (float)random() / (RAND_MAX + 1.);
  float *erfa = nxta(rateparam, rfa, nsteps);
  printf("Random numbers drawn:\n");
  for (i = 0; i < nsteps; ++i)
    printf("%.3f ", rfa[i]);
  printf("\n");
  summit = .0;
  printf("Conversion to expectation times:\n");
  for (i = 0; i < nsteps; ++i)
    printf("%.3f ", erfa[i]);
  printf("\n");
  printf("Cumulative expectation times:\n");
  for (i = 0; i < nsteps; ++i) {
    summit += erfa[i];
    printf("%.3f ", summit);
  }
  printf("\nAvg floating point waiting time: %f\n", summit / (float)nsteps);
  printf("Discrete version\n");
  for (i = 0; i < nsteps; ++i)
    printf("%3d ", (int)(.5 + erfa[i]));
  printf("\n");
  for (i = 0; i < nsteps; ++i) {
    dsummit += (int)(.5 + erfa[i]);
    printf("%3d ", dsummit);
  }
  printf("\nAvg discrete waiting time: %f\n", dsummit / (float)nsteps);
  free(rfa);
  free(erfa);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     120c <main+0x3c>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    0x2dd3(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,%edi
call   10a0 <srand@plt>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1090 <memset@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    $0x2f,%esi
call   1070 <strchr@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    1268 <main+0x98>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atof@plt>
movss  %xmm0,-0x14(%rbp)
jmp    12de <main+0x10e>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x48(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    0x10(%rcx),%rcx
sub    %rcx,%rax
shl    $0x0,%rax
mov    %eax,%edx
call   1040 <strncpy@plt>
mov    -0x48(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    0x10(%rcx),%rcx
sub    %rcx,%rax
movb   $0x0,-0x40(%rbp,%rax,1)
lea    -0x40(%rbp),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x4c(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
add    $0x1,%rsi
call   1050 <strcpy@plt>
lea    -0x40(%rbp),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x50(%rbp)
cvtsi2ssl -0x4c(%rbp),%xmm0
cvtsi2ssl -0x50(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x54(%rbp)
movslq -0x54(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x68(%rbp)
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    135e <main+0x18e>
mov    $0x0,%al
call   10b0 <random@plt>
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm0
mov    0x2cbd(%rip),%rax
cvtsi2sdl (%rax),%xmm1
movsd  0xcd1(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x68(%rbp),%rax
movslq -0x60(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1308 <main+0x138>
movss  -0x14(%rbp),%xmm0
mov    -0x68(%rbp),%rdi
mov    -0x54(%rbp),%esi
call   10f0 <nxta@plt>
mov    %rax,-0x70(%rbp)
lea    0xd1d(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    13c1 <main+0x1f1>
mov    -0x68(%rbp),%rax
movslq -0x60(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd02(%rip),%rdi
mov    $0x1,%al
call   1080 <printf@plt>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1388 <main+0x1b8>
lea    0xccd(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x58(%rbp)
lea    0xcd6(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    1425 <main+0x255>
mov    -0x70(%rbp),%rax
movslq -0x60(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc9e(%rip),%rdi
mov    $0x1,%al
call   1080 <printf@plt>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    13ec <main+0x21c>
lea    0xc69(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
lea    0xc9c(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    1490 <main+0x2c0>
mov    -0x70(%rbp),%rax
movslq -0x60(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
addss  -0x58(%rbp),%xmm0
movss  %xmm0,-0x58(%rbp)
movss  -0x58(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc33(%rip),%rdi
mov    $0x1,%al
call   1080 <printf@plt>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1448 <main+0x278>
movss  -0x58(%rbp),%xmm0
cvtsi2ssl -0x54(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc4c(%rip),%rdi
mov    $0x1,%al
call   1080 <printf@plt>
lea    0xc64(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    150e <main+0x33e>
mov    -0x70(%rbp),%rax
movslq -0x60(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xb16(%rip),%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xc34(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    14c5 <main+0x2f5>
lea    0xb80(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    1575 <main+0x3a5>
mov    -0x70(%rbp),%rax
movslq -0x60(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xab8(%rip),%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
add    -0x5c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x5c(%rbp),%esi
lea    0xbcd(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1523 <main+0x353>
cvtsi2ssl -0x5c(%rbp),%xmm0
cvtsi2ssl -0x54(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xba4(%rip),%rdi
mov    $0x1,%al
call   1080 <printf@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
cmp    $0x4,%edi
jne    155c <main+0x37c>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
call   10e0 <atoi@plt>
mov    %eax,%edi
call   10b0 <srand@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
mov    0x10(%r14),%rbp
mov    %rbp,%rdi
mov    $0x2f,%esi
call   1090 <strchr@plt>
test   %rax,%rax
je     128b <main+0xab>
mov    %rax,%rbx
mov    %ebx,%edx
sub    %ebp,%edx
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    %rbp,%rsi
call   1050 <strncpy@plt>
mov    0x10(%r14),%rax
mov    %rbx,%rcx
sub    %rax,%rcx
movb   $0x0,0x10(%rsp,%rcx,1)
mov    %r15,%rdi
call   10e0 <atoi@plt>
mov    %eax,%ebp
add    $0x1,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <strcpy@plt>
mov    %r15,%rdi
call   10e0 <atoi@plt>
cvtsi2ss %ebp,%xmm1
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
jmp    1299 <main+0xb9>
mov    %rbp,%rdi
call   1080 <atof@plt>
movss  %xmm0,0xc(%rsp)
mov    0x18(%r14),%rdi
call   10e0 <atoi@plt>
mov    %eax,%r13d
lea    0x0(,%r13,4),%edi
call   10d0 <malloc@plt>
mov    %rax,%r14
mov    %r13d,%r15d
test   %r13d,%r13d
jle    130a <main+0x12a>
mov    0x2d24(%rip),%rbp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   10c0 <random@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0x0(%rbp),%xmm1
addsd  0xd0d(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    12d0 <main+0xf0>
movss  0xc(%rsp),%xmm0
mov    %r14,%rdi
mov    %r13d,%esi
call   1100 <nxta@plt>
mov    %rax,%r12
lea    0xd3c(%rip),%rdi
call   1070 <puts@plt>
test   %r13d,%r13d
jle    13af <main+0x1cf>
xor    %ebx,%ebx
lea    0xcd4(%rip),%rbp
nopl   0x0(%rax)
movss  (%r14,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   10a0 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1340 <main+0x160>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xd09(%rip),%rdi
call   1070 <puts@plt>
test   %r13d,%r13d
jle    141e <main+0x23e>
xor    %ebx,%ebx
lea    0xc8b(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
nop
movss  (%r12,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   10a0 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1390 <main+0x1b0>
jmp    13c5 <main+0x1e5>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xcb7(%rip),%rdi
call   1070 <puts@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xcc2(%rip),%rdi
call   1070 <puts@plt>
mov    %r13,%rbx
test   %r13d,%r13d
jle    1437 <main+0x257>
xorps  %xmm1,%xmm1
xor    %ebp,%ebp
lea    0xc21(%rip),%r13
nop
addss  (%r12,%rbp,4),%xmm1
movss  %xmm1,0xc(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
mov    %r13,%rdi
mov    $0x1,%al
call   10a0 <printf@plt>
movss  0xc(%rsp),%xmm1
add    $0x1,%rbp
cmp    %rbp,%r15
jne    13f0 <main+0x210>
jmp    143a <main+0x25a>
mov    %r13,%rbx
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xc66(%rip),%rdi
call   1070 <puts@plt>
xorps  %xmm1,%xmm1
mov    %rbx,%r13
xorps  %xmm0,%xmm0
cvtsi2ss %r13d,%xmm0
movss  %xmm0,0xc(%rsp)
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xbb9(%rip),%rdi
mov    $0x1,%al
call   10a0 <printf@plt>
lea    0xc4b(%rip),%rdi
call   1070 <puts@plt>
test   %r13d,%r13d
jle    1516 <main+0x336>
lea    0xbbc(%rip),%rbp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  (%r12,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xb66(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1490 <main+0x2b0>
mov    $0xa,%edi
call   1040 <putchar@plt>
test   %r13d,%r13d
jle    1520 <main+0x340>
lea    0xb6d(%rip),%r13
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movss  (%r12,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xb16(%rip),%xmm0
cvttsd2si %xmm0,%eax
add    %eax,%ebp
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   10a0 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    14e0 <main+0x300>
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
jmp    1523 <main+0x343>
mov    $0xa,%edi
call   1040 <putchar@plt>
xorps  %xmm0,%xmm0
divss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xb0d(%rip),%rdi
mov    $0x1,%al
call   10a0 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb64(%rip),%rdi
call   1070 <puts@plt>
mov    0x2a69(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@.str = [135 x i8] c"Error. Pls supply 2 arguments: 1) int random seed 2) rate value (float or pure fraction) 3) Number of steps (duration of simulation).\0A\00"
@EXIT_FAILURE = global i32 0
@RAND_MAX = global i32 0
@.str.1 = [23 x i8] c"Random numbers drawn:\0A\00"
@.str.2 = [6 x i8] c"%.3f \00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [34 x i8] c"Conversion to expectation times:\0A\00"
@.str.5 = [31 x i8] c"Cumulative expectation times:\0A\00"
@.str.6 = [38 x i8] c"\0AAvg floating point waiting time: %f\0A\00"
@.str.7 = [18 x i8] c"Discrete version\0A\00"
@.str.8 = [5 x i8] c"%3d \00"
@.str.9 = [32 x i8] c"\0AAvg discrete waiting time: %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca [32 x i8]
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca float
%13 = alloca i32
%14 = alloca i32
%15 = alloca float*
%16 = alloca float*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 4
br i1 %18, label %19, label %23
19: ; preds = %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str, i64 0, i64 0))
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @atoi(i8* %26)
%28 = call i32 @srand(i32 %27)
%29 = bitcast [32 x i8]* %7 to i8*
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = call i8* @strchr(i8* %32, i8 signext 47)
store i8* %33, i8** %8
%34 = load i8*, i8** %8
%35 = icmp ne i8* %34, null
br i1 %35, label %41, label %36
36: ; preds = %23
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 2
%39 = load i8*, i8** %38
%40 = call float @atof(i8* %39)
store float %40, float* %6
br label %77
41: ; preds = %23
%42 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 2
%45 = load i8*, i8** %44
%46 = load i8*, i8** %8
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 2
%49 = load i8*, i8** %48
%50 = ptrtoint i8* %46 to i64
%51 = ptrtoint i8* %49 to i64
%52 = sub i64 %50, %51
%53 = mul i64 %52, 1
%54 = trunc i64 %53 to i32
%55 = call i32 @strncpy(i8* %42, i8* %45, i32 %54)
%56 = load i8*, i8** %8
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 2
%59 = load i8*, i8** %58
%60 = ptrtoint i8* %56 to i64
%61 = ptrtoint i8* %59 to i64
%62 = sub i64 %60, %61
%63 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 %62
store i8 0, i8* %63
%64 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%65 = call i32 @atoi(i8* %64)
store i32 %65, i32* %9
%66 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%67 = load i8*, i8** %8
%68 = getelementptr inbounds i8, i8* %67, i64 1
%69 = call i32 @strcpy(i8* %66, i8* %68)
%70 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%71 = call i32 @atoi(i8* %70)
store i32 %71, i32* %10
%72 = load i32, i32* %9
%73 = sitofp i32 %72 to float
%74 = load i32, i32* %10
%75 = sitofp i32 %74 to float
%76 = fdiv float %73, %75
store float %76, float* %6
br label %77
77: ; preds = %41, %36
%78 = load i8**, i8*** %5
%79 = getelementptr inbounds i8*, i8** %78, i64 3
%80 = load i8*, i8** %79
%81 = call i32 @atoi(i8* %80)
store i32 %81, i32* %11
%82 = load i32, i32* %11
%83 = sext i32 %82 to i64
%84 = mul i64 %83, 4
%85 = trunc i64 %84 to i32
%86 = call float* @malloc(i32 %85)
store float* %86, float** %15
store i32 0, i32* %14
br label %87
87: ; preds = %104, %77
%88 = load i32, i32* %14
%89 = load i32, i32* %11
%90 = icmp slt i32 %88, %89
br i1 %90, label %91, label %107
91: ; preds = %87
%92 = call i64 (...) @random()
%93 = sitofp i64 %92 to float
%94 = fpext float %93 to double
%95 = load i32, i32* @RAND_MAX
%96 = sitofp i32 %95 to double
%97 = fadd double %96, 1.000000e+00
%98 = fdiv double %94, %97
%99 = fptrunc double %98 to float
%100 = load float*, float** %15
%101 = load i32, i32* %14
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds float, float* %100, i64 %102
store float %99, float* %103
br label %104
104: ; preds = %91
%105 = load i32, i32* %14
%106 = add nsw i32 %105, 1
store i32 %106, i32* %14
br label %87
107: ; preds = %87
%108 = load float, float* %6
%109 = load float*, float** %15
%110 = load i32, i32* %11
%111 = call float* @nxta(float %108, float* %109, i32 %110)
store float* %111, float** %16
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %14
br label %113
113: ; preds = %125, %107
%114 = load i32, i32* %14
%115 = load i32, i32* %11
%116 = icmp slt i32 %114, %115
br i1 %116, label %117, label %128
117: ; preds = %113
%118 = load float*, float** %15
%119 = load i32, i32* %14
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds float, float* %118, i64 %120
%122 = load float, float* %121
%123 = fpext float %122 to double
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %123)
br label %125
125: ; preds = %117
%126 = load i32, i32* %14
%127 = add nsw i32 %126, 1
store i32 %127, i32* %14
br label %113
128: ; preds = %113
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store float 0.000000e+00, float* %12
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %14
br label %131
131: ; preds = %143, %128
%132 = load i32, i32* %14
%133 = load i32, i32* %11
%134 = icmp slt i32 %132, %133
br i1 %134, label %135, label %146
135: ; preds = %131
%136 = load float*, float** %16
%137 = load i32, i32* %14
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds float, float* %136, i64 %138
%140 = load float, float* %139
%141 = fpext float %140 to double
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %141)
br label %143
143: ; preds = %135
%144 = load i32, i32* %14
%145 = add nsw i32 %144, 1
store i32 %145, i32* %14
br label %131
146: ; preds = %131
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %14
br label %149
149: ; preds = %164, %146
%150 = load i32, i32* %14
%151 = load i32, i32* %11
%152 = icmp slt i32 %150, %151
br i1 %152, label %153, label %167
153: ; preds = %149
%154 = load float*, float** %16
%155 = load i32, i32* %14
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds float, float* %154, i64 %156
%158 = load float, float* %157
%159 = load float, float* %12
%160 = fadd float %159, %158
store float %160, float* %12
%161 = load float, float* %12
%162 = fpext float %161 to double
%163 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %162)
br label %164
164: ; preds = %153
%165 = load i32, i32* %14
%166 = add nsw i32 %165, 1
store i32 %166, i32* %14
br label %149
167: ; preds = %149
%168 = load float, float* %12
%169 = load i32, i32* %11
%170 = sitofp i32 %169 to float
%171 = fdiv float %168, %170
%172 = fpext float %171 to double
%173 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), double %172)
%174 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %14
br label %175
175: ; preds = %189, %167
%176 = load i32, i32* %14
%177 = load i32, i32* %11
%178 = icmp slt i32 %176, %177
br i1 %178, label %179, label %192
179: ; preds = %175
%180 = load float*, float** %16
%181 = load i32, i32* %14
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds float, float* %180, i64 %182
%184 = load float, float* %183
%185 = fpext float %184 to double
%186 = fadd double 5.000000e-01, %185
%187 = fptosi double %186 to i32
%188 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %187)
br label %189
189: ; preds = %179
%190 = load i32, i32* %14
%191 = add nsw i32 %190, 1
store i32 %191, i32* %14
br label %175
192: ; preds = %175
%193 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %14
br label %194
194: ; preds = %211, %192
%195 = load i32, i32* %14
%196 = load i32, i32* %11
%197 = icmp slt i32 %195, %196
br i1 %197, label %198, label %214
198: ; preds = %194
%199 = load float*, float** %16
%200 = load i32, i32* %14
%201 = sext i32 %200 to i64
%202 = getelementptr inbounds float, float* %199, i64 %201
%203 = load float, float* %202
%204 = fpext float %203 to double
%205 = fadd double 5.000000e-01, %204
%206 = fptosi double %205 to i32
%207 = load i32, i32* %13
%208 = add nsw i32 %207, %206
store i32 %208, i32* %13
%209 = load i32, i32* %13
%210 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %209)
br label %211
211: ; preds = %198
%212 = load i32, i32* %14
%213 = add nsw i32 %212, 1
store i32 %213, i32* %14
br label %194
214: ; preds = %194
%215 = load i32, i32* %13
%216 = sitofp i32 %215 to float
%217 = load i32, i32* %11
%218 = sitofp i32 %217 to float
%219 = fdiv float %216, %218
%220 = fpext float %219 to double
%221 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), double %220)
%222 = load float*, float** %15
%223 = call i32 @free(float* %222)
%224 = load float*, float** %16
%225 = call i32 @free(float* %224)
ret i32 0
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@RAND_MAX = global i32 0
@.str.2 = [6 x i8] c"%.3f \00"
@.str.6 = [38 x i8] c"\0AAvg floating point waiting time: %f\0A\00"
@.str.8 = [5 x i8] c"%3d \00"
@.str.9 = [32 x i8] c"\0AAvg discrete waiting time: %f\0A\00"
@str = [22 x i8] c"Random numbers drawn:\00"
@str.10 = [33 x i8] c"Conversion to expectation times:\00"
@str.11 = [30 x i8] c"Cumulative expectation times:\00"
@str.12 = [17 x i8] c"Discrete version\00"
@str.13 = [134 x i8] c"Error. Pls supply 2 arguments: 1) int random seed 2) rate value (float or pure fraction) 3) Number of steps (duration of simulation).\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [32 x i8]
%4 = icmp eq i32 %0, 4
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([134 x i8], [134 x i8]* @str.13, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = tail call i32 @srand(i32 %12)
%14 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = tail call i8* @strchr(i8* dereferenceable(1) %16, i8 signext 47)
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %21
19: ; preds = %9
%20 = tail call float @atof(i8* %16)
br label %38
21: ; preds = %9
%22 = ptrtoint i8* %17 to i64
%23 = ptrtoint i8* %16 to i64
%24 = sub i64 %22, %23
%25 = trunc i64 %24 to i32
%26 = call i32 @strncpy(i8* %14, i8* %16, i32 %25)
%27 = load i8*, i8** %15
%28 = ptrtoint i8* %27 to i64
%29 = sub i64 %22, %28
%30 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 %29
store i8 0, i8* %30
%31 = call i32 @atoi(i8* %14)
%32 = getelementptr inbounds i8, i8* %17, i64 1
%33 = call i32 @strcpy(i8* %14, i8* %32)
%34 = call i32 @atoi(i8* %14)
%35 = sitofp i32 %31 to float
%36 = sitofp i32 %34 to float
%37 = fdiv float %35, %36
br label %38
38: ; preds = %21, %19
%39 = phi float [ %37, %21 ], [ %20, %19 ]
%40 = getelementptr inbounds i8*, i8** %1, i64 3
%41 = load i8*, i8** %40
%42 = call i32 @atoi(i8* %41)
%43 = shl i32 %42, 2
%44 = call float* @malloc(i32 %43)
%45 = icmp sgt i32 %42, 0
br i1 %45, label %46, label %61
46: ; preds = %38
%47 = zext i32 %42 to i64
br label %48
48: ; preds = %46, %48
%49 = phi i64 [ 0, %46 ], [ %59, %48 ]
%50 = call i64 (...) @random()
%51 = sitofp i64 %50 to float
%52 = fpext float %51 to double
%53 = load i32, i32* @RAND_MAX
%54 = sitofp i32 %53 to double
%55 = fadd double %54, 1.000000e+00
%56 = fdiv double %52, %55
%57 = fptrunc double %56 to float
%58 = getelementptr inbounds float, float* %44, i64 %49
store float %57, float* %58
%59 = add nuw nsw i64 %49, 1
%60 = icmp eq i64 %59, %47
br i1 %60, label %61, label %48
61: ; preds = %48, %38
%62 = call float* @nxta(float %39, float* %44, i32 %42)
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br i1 %45, label %64, label %87
64: ; preds = %61
%65 = zext i32 %42 to i64
br label %66
66: ; preds = %64, %66
%67 = phi i64 [ 0, %64 ], [ %72, %66 ]
%68 = getelementptr inbounds float, float* %44, i64 %67
%69 = load float, float* %68
%70 = fpext float %69 to double
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %70)
%72 = add nuw nsw i64 %67, 1
%73 = icmp eq i64 %72, %65
br i1 %73, label %74, label %66
74: ; preds = %66
%75 = call i32 @putchar(i32 10)
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.10, i64 0, i64 0))
br i1 %45, label %77, label %105
77: ; preds = %74
%78 = zext i32 %42 to i64
br label %79
79: ; preds = %77, %79
%80 = phi i64 [ 0, %77 ], [ %85, %79 ]
%81 = getelementptr inbounds float, float* %62, i64 %80
%82 = load float, float* %81
%83 = fpext float %82 to double
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %83)
%85 = add nuw nsw i64 %80, 1
%86 = icmp eq i64 %85, %78
br i1 %86, label %90, label %79
87: ; preds = %61
%88 = call i32 @putchar(i32 10)
%89 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.10, i64 0, i64 0))
br label %90
90: ; preds = %79, %87
%91 = call i32 @putchar(i32 10)
%92 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.11, i64 0, i64 0))
br i1 %45, label %93, label %108
93: ; preds = %90
%94 = zext i32 %42 to i64
br label %95
95: ; preds = %93, %95
%96 = phi i64 [ 0, %93 ], [ %103, %95 ]
%97 = phi float [ 0.000000e+00, %93 ], [ %100, %95 ]
%98 = getelementptr inbounds float, float* %62, i64 %96
%99 = load float, float* %98
%100 = fadd float %97, %99
%101 = fpext float %100 to double
%102 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %101)
%103 = add nuw nsw i64 %96, 1
%104 = icmp eq i64 %103, %94
br i1 %104, label %108, label %95
105: ; preds = %74
%106 = call i32 @putchar(i32 10)
%107 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.11, i64 0, i64 0))
br label %108
108: ; preds = %95, %105, %90
%109 = phi float [ 0.000000e+00, %90 ], [ 0.000000e+00, %105 ], [ %100, %95 ]
%110 = sitofp i32 %42 to float
%111 = fdiv float %109, %110
%112 = fpext float %111 to double
%113 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), double %112)
%114 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.12, i64 0, i64 0))
br i1 %45, label %117, label %115
115: ; preds = %108
%116 = call i32 @putchar(i32 10)
br label %147
117: ; preds = %108
%118 = zext i32 %42 to i64
br label %119
119: ; preds = %117, %119
%120 = phi i64 [ 0, %117 ], [ %127, %119 ]
%121 = getelementptr inbounds float, float* %62, i64 %120
%122 = load float, float* %121
%123 = fpext float %122 to double
%124 = fadd double %123, 5.000000e-01
%125 = fptosi double %124 to i32
%126 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %125)
%127 = add nuw nsw i64 %120, 1
%128 = icmp eq i64 %127, %118
br i1 %128, label %129, label %119
129: ; preds = %119
%130 = call i32 @putchar(i32 10)
br i1 %45, label %131, label %147
131: ; preds = %129
%132 = zext i32 %42 to i64
br label %133
133: ; preds = %131, %133
%134 = phi i64 [ 0, %131 ], [ %143, %133 ]
%135 = phi i32 [ undef, %131 ], [ %141, %133 ]
%136 = getelementptr inbounds float, float* %62, i64 %134
%137 = load float, float* %136
%138 = fpext float %137 to double
%139 = fadd double %138, 5.000000e-01
%140 = fptosi double %139 to i32
%141 = add nsw i32 %135, %140
%142 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %141)
%143 = add nuw nsw i64 %134, 1
%144 = icmp eq i64 %143, %132
br i1 %144, label %145, label %133
145: ; preds = %133
%146 = sitofp i32 %141 to float
br label %147
147: ; preds = %115, %145, %129
%148 = phi float [ 0.000000e+00, %129 ], [ %146, %145 ], [ 0.000000e+00, %115 ]
%149 = fdiv float %148, %110
%150 = fpext float %149 to double
%151 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), double %150)
%152 = call i32 @free(float* %44)
%153 = call i32 @free(float* %62)
ret i32 0
}