#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*/ feof(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, double);
int scanf(char *, int *, double *);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  static double pmf[5000];
  double sum = 0;
  int i;
  while (!feof(stdin)) {
    int res, val;
    double p;
    res = scanf("%d %lf\n", &val, &p);
    if (res == 2) {
      pmf[val] = p;
    }
  }
  for (i = 0; i < 5000; i++) {
    printf("%d %16.14f\n", i * 100, sum);
    sum += pmf[i];
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
call   1040 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1171 <main+0x41>
jmp    11ac <main+0x7c>
lea    0xe88(%rip),%rdi
lea    -0x24(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1050 <scanf@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x2,-0x20(%rbp)
jne    11a7 <main+0x77>
movsd  -0x30(%rbp),%xmm0
movslq -0x24(%rbp),%rcx
lea    0x2eae(%rip),%rax
movsd  %xmm0,(%rax,%rcx,8)
jmp    114e <main+0x1e>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x1388,-0x1c(%rbp)
jge    11fd <main+0xcd>
imul   $0x64,-0x1c(%rbp),%esi
movsd  -0x18(%rbp),%xmm0
lea    0xe38(%rip),%rdi
call   1030 <printf@plt>
movslq -0x1c(%rbp),%rcx
lea    0x2e70(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b3 <main+0x83>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    0x2ea4(%rip),%r12
mov    (%r12),%edi
call   1040 <feof@plt>
test   %eax,%eax
je     11b2 <main+0x82>
xorpd  %xmm0,%xmm0
lea    0x2ef4(%rip),%r15
xor    %ebx,%ebx
lea    0xea3(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
movsd  %xmm0,0x10(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
movsd  0x10(%rsp),%xmm0
call   1030 <printf@plt>
movsd  0x10(%rsp),%xmm0
addsd  (%r15),%xmm0
add    $0x64,%rbx
add    $0x8,%r15
cmp    $0x7a120,%rbx
jne    1170 <main+0x40>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xe47(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x18(%rsp),%rbx
lea    0x2e86(%rip),%r13
jmp    11e1 <main+0xb1>
nopl   0x0(%rax)
mov    (%r12),%edi
call   1040 <feof@plt>
test   %eax,%eax
jne    1151 <main+0x21>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <scanf@plt>
cmp    $0x2,%eax
jne    11d0 <main+0xa0>
movsd  0x18(%rsp),%xmm0
movslq 0xc(%rsp),%rax
movsd  %xmm0,0x0(%r13,%rax,8)
jmp    11d0 <main+0xa0>

LLVM IR (-O0):
@main.pmf = internal global [5000 x double] zeroinitializer
@stdin = global i32 0
@.str = [8 x i8] c"%d %lf\0A\00"
@.str.1 = [12 x i8] c"%d %16.14f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 0.000000e+00, double* %6
br label %11
11: ; preds = %25, %2
%12 = load i32, i32* @stdin
%13 = call i32 @feof(i32 %12)
%14 = icmp ne i32 %13, 0
%15 = xor i1 %14, true
br i1 %15, label %16, label %26
16: ; preds = %11
%17 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %9, double* %10)
store i32 %17, i32* %8
%18 = load i32, i32* %8
%19 = icmp eq i32 %18, 2
br i1 %19, label %20, label %25
20: ; preds = %16
%21 = load double, double* %10
%22 = load i32, i32* %9
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [5000 x double], [5000 x double]* @main.pmf, i64 0, i64 %23
store double %21, double* %24
br label %25
25: ; preds = %20, %16
br label %11
26: ; preds = %11
store i32 0, i32* %7
br label %27
27: ; preds = %41, %26
%28 = load i32, i32* %7
%29 = icmp slt i32 %28, 5000
br i1 %29, label %30, label %44
30: ; preds = %27
%31 = load i32, i32* %7
%32 = mul nsw i32 %31, 100
%33 = load double, double* %6
%34 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %32, double %33)
%35 = load i32, i32* %7
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [5000 x double], [5000 x double]* @main.pmf, i64 0, i64 %36
%38 = load double, double* %37
%39 = load double, double* %6
%40 = fadd double %39, %38
store double %40, double* %6
br label %41
41: ; preds = %30
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
store i32 %43, i32* %7
br label %27
44: ; preds = %27
ret i32 0
}

LLVM IR (-O2):
@main.pmf = internal unnamed_addr global [5000 x double] zeroinitializer
@stdin = global i32 0
@.str = [8 x i8] c"%d %lf\0A\00"
@.str.1 = [12 x i8] c"%d %16.14f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca double
%5 = load i32, i32* @stdin
%6 = call i32 @feof(i32 %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %23
8: ; preds = %2
%9 = bitcast i32* %3 to i8*
%10 = bitcast double* %4 to i8*
br label %11
11: ; preds = %8, %19
%12 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %3, double* %4)
%13 = icmp eq i32 %12, 2
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = load double, double* %4
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [5000 x double], [5000 x double]* @main.pmf, i64 0, i64 %17
store double %15, double* %18
br label %19
19: ; preds = %14, %11
%20 = load i32, i32* @stdin
%21 = call i32 @feof(i32 %20)
%22 = icmp eq i32 %21, 0
br i1 %22, label %11, label %23
23: ; preds = %19, %2
br label %24
24: ; preds = %23, %24
%25 = phi i64 [ %33, %24 ], [ 0, %23 ]
%26 = phi double [ %32, %24 ], [ 0.000000e+00, %23 ]
%27 = trunc i64 %25 to i32
%28 = mul i32 %27, 100
%29 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %28, double %26)
%30 = getelementptr inbounds [5000 x double], [5000 x double]* @main.pmf, i64 0, i64 %25
%31 = load double, double* %30
%32 = fadd double %26, %31
%33 = add nuw nsw i64 %25, 1
%34 = icmp eq i64 %33, 5000
br i1 %34, label %35, label %24
35: ; preds = %24
ret i32 0
}