#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*/ fscanf(int /*<<< orphan*/ *, char *, long long *);
void arrayFill(FILE *in, long long unsigned array[],
               long long unsigned farmerQuantity) {
  long long int amount, price;
  for (int i = 0; i < farmerQuantity; i++) {
    fscanf(in, "%llu", &amount);
    fscanf(in, "%llu", &price);
    array[price] += amount;
  }
}


x86 assembly (clang, -O0):
<arrayFill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x2c(%rbp)
movslq -0x2c(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1183 <arrayFill+0x73>
mov    -0x8(%rbp),%rdi
lea    0xebc(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1030 <fscanf@plt>
mov    -0x8(%rbp),%rdi
lea    0xea8(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1030 <fscanf@plt>
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
add    (%rax,%rcx,8),%rdx
mov    %rdx,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    112b <arrayFill+0x1b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arrayFill>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %rdx,%rdx
je     1170 <arrayFill+0x60>
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xecd(%rip),%r12
lea    0x10(%rsp),%r13
lea    0x8(%rsp),%rbp
nopl   (%rax)
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1030 <fscanf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
call   1030 <fscanf@plt>
mov    0x10(%rsp),%rax
mov    0x8(%rsp),%rcx
add    %rax,(%r14,%rcx,8)
add    $0xffffffffffffffff,%rbx
jne    1140 <arrayFill+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%llu\00"
define void @arrayFill(i32* %0, i64* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i64*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32
store i32* %0, i32** %4
store i64* %1, i64** %5
store i64 %2, i64* %6
store i32 0, i32* %9
br label %10
10: ; preds = %26, %3
%11 = load i32, i32* %9
%12 = sext i32 %11 to i64
%13 = load i64, i64* %6
%14 = icmp ult i64 %12, %13
br i1 %14, label %15, label %29
15: ; preds = %10
%16 = load i32*, i32** %4
%17 = call i32 @fscanf(i32* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %7)
%18 = load i32*, i32** %4
%19 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %8)
%20 = load i64, i64* %7
%21 = load i64*, i64** %5
%22 = load i64, i64* %8
%23 = getelementptr inbounds i64, i64* %21, i64 %22
%24 = load i64, i64* %23
%25 = add i64 %24, %20
store i64 %25, i64* %23
br label %26
26: ; preds = %15
%27 = load i32, i32* %9
%28 = add nsw i32 %27, 1
store i32 %28, i32* %9
br label %10
29: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%llu\00"
define void @arrayFill(i32* nocapture %0, i64* nocapture %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = bitcast i64* %4 to i8*
%7 = bitcast i64* %5 to i8*
%8 = icmp eq i64 %2, 0
br i1 %8, label %9, label %10
9: ; preds = %10, %3
ret void
10: ; preds = %3, %10
%11 = phi i64 [ %19, %10 ], [ 0, %3 ]
%12 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %4)
%13 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %5)
%14 = load i64, i64* %4
%15 = load i64, i64* %5
%16 = getelementptr inbounds i64, i64* %1, i64 %15
%17 = load i64, i64* %16
%18 = add i64 %17, %14
store i64 %18, i64* %16
%19 = add nuw i64 %11, 1
%20 = icmp eq i64 %19, %2
br i1 %20, label %9, label %10
}