#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 */
double RAND_MAX;
int /*<<< orphan*/ compute(int);
int getpid();
scalar_t__ rand();
int /*<<< orphan*/ srand(int);
int main(int argc, char *argv[]) {
  int i, delay, pid;
  pid = getpid();
  srand(pid);
  delay = 30 + ((double)rand() / RAND_MAX) * 130;
  for (i = 0; i < 200; i++) {
    compute(delay);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2e6d(%rip),%rax
divsd  (%rax),%xmm0
movsd  0xe79(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe75(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xc8,-0x14(%rbp)
jge    11c8 <main+0x88>
mov    -0x18(%rbp),%edi
call   1050 <compute@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a5 <main+0x65>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2e84(%rip),%rax
divsd  (%rax),%xmm0
mulsd  0xe90(%rip),%xmm0
addsd  0xe90(%rip),%xmm0
cvttsd2si %xmm0,%ebx
mov    $0xc8,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1050 <compute@plt>
add    $0xffffffff,%ebp
jne    1190 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (...) @getpid()
store i32 %9, i32* %8
%10 = load i32, i32* %8
%11 = call i32 @srand(i32 %10)
%12 = call i64 (...) @rand()
%13 = sitofp i64 %12 to double
%14 = load double, double* @RAND_MAX
%15 = fdiv double %13, %14
%16 = call double @llvm.fmuladd.f64(double %15, double 1.300000e+02, double 3.000000e+01)
%17 = fptosi double %16 to i32
store i32 %17, i32* %7
store i32 0, i32* %6
br label %18
18: ; preds = %24, %2
%19 = load i32, i32* %6
%20 = icmp slt i32 %19, 200
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load i32, i32* %7
%23 = call i32 @compute(i32 %22)
br label %24
24: ; preds = %21
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %18
27: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @getpid()
%4 = tail call i32 @srand(i32 %3)
%5 = tail call i64 (...) @rand()
%6 = sitofp i64 %5 to double
%7 = load double, double* @RAND_MAX
%8 = fdiv double %6, %7
%9 = tail call double @llvm.fmuladd.f64(double %8, double 1.300000e+02, double 3.000000e+01)
%10 = fptosi double %9 to i32
br label %11
11: ; preds = %2, %11
%12 = phi i32 [ 0, %2 ], [ %14, %11 ]
%13 = tail call i32 @compute(i32 %10)
%14 = add nuw nsw i32 %12, 1
%15 = icmp eq i32 %14, 200
br i1 %15, label %16, label %11
16: ; preds = %11
ret i32 0
}