// File: vividvilla[P]hackerrank/src/candies.cpp
// Function: getMinimumCandies(std::vector<int, std::allocator<int>>)
int getMinimumCandies(vector<int> c) {
    int N = c.size();
    vector<int> minR = vector<int>(N, 1);
    vector<int> minL = vector<int>(N, 1);

    for (int i = N - 2; i >= 0; i--) {
        if (c[i + 1] < c[i])
            minR[i] = 1 + minR[i + 1];
    }

    for (int i = 1; i < N; i++) {
        if (c[i - 1] < c[i])
            minL[i] = 1 + minL[i - 1];
    }

    int t = 0;
    for (int i = 0; i < N; i++)
        t += max(minR[i], minL[i]);

    return t;
}

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0x40(%rsp)
movq %rdi, 0xc0(%rsp)
callq 0x1680
movl %eax, 0xbc(%rsp)
movslq 0xbc(%rsp), %rax
movq %rax, 0x48(%rsp)
movl $0x1, 0x9c(%rsp)
leaq 0x9b(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x16a0
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rcx
leaq 0xa0(%rsp), %rdi
leaq 0x9c(%rsp), %rdx
callq 0x16b0
jmp 0x12bb
leaq 0x9b(%rsp), %rdi
callq 0x1730
movslq 0xbc(%rsp), %rax
movq %rax, 0x30(%rsp)
movl $0x1, 0x6c(%rsp)
leaq 0x6b(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x16a0
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rcx
leaq 0x70(%rsp), %rdi
leaq 0x6c(%rsp), %rdx
callq 0x16b0
jmp 0x1307
leaq 0x6b(%rsp), %rdi
callq 0x1730
movl 0xbc(%rsp), %eax
subl $0x2, %eax
movl %eax, 0x64(%rsp)
cmpl $0x0, 0x64(%rsp)
jl 0x13f7
movq 0x40(%rsp), %rdi
movl 0x64(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x1740
movq 0x40(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x2c(%rsp)
movslq 0x64(%rsp), %rsi
callq 0x1740
movq %rax, %rcx
movl 0x2c(%rsp), %eax
cmpl (%rcx), %eax
jge 0x13e5
movl 0x64(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq 0xa0(%rsp), %rdi
callq 0x1740
movl (%rax), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
movslq 0x64(%rsp), %rsi
leaq 0xa0(%rsp), %rdi
callq 0x1740
movl 0x28(%rsp), %ecx
movl %ecx, (%rax)
jmp 0x13e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
leaq 0x9b(%rsp), %rdi
callq 0x1730
jmp 0x154f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
leaq 0x6b(%rsp), %rdi
callq 0x1730
jmp 0x1542
jmp 0x13e7
movl 0x64(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x64(%rsp)
jmp 0x131f
movl $0x1, 0x60(%rsp)
movl 0x60(%rsp), %eax
cmpl 0xbc(%rsp), %eax
jge 0x1484
movq 0x40(%rsp), %rdi
movl 0x60(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x1740
movq 0x40(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x24(%rsp)
movslq 0x60(%rsp), %rsi
callq 0x1740
movq %rax, %rcx
movl 0x24(%rsp), %eax
cmpl (%rcx), %eax
jge 0x1472
movl 0x60(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0x70(%rsp), %rdi
callq 0x1740
movl (%rax), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
movslq 0x60(%rsp), %rsi
leaq 0x70(%rsp), %rdi
callq 0x1740
movl 0x20(%rsp), %ecx
movl %ecx, (%rax)
jmp 0x1474
movl 0x60(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x60(%rsp)
jmp 0x13ff
movl $0x0, 0x5c(%rsp)
movl $0x0, 0x58(%rsp)
movl 0x58(%rsp), %eax
cmpl 0xbc(%rsp), %eax
jge 0x1517
movslq 0x58(%rsp), %rsi
leaq 0xa0(%rsp), %rdi
callq 0x1740
movq %rax, 0x10(%rsp)
movslq 0x58(%rsp), %rsi
leaq 0x70(%rsp), %rdi
callq 0x1740
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x1760
movq %rax, 0x18(%rsp)
jmp 0x14db
movq 0x18(%rsp), %rax
movl (%rax), %eax
addl 0x5c(%rsp), %eax
movl %eax, 0x5c(%rsp)
movl 0x58(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x58(%rsp)
jmp 0x1494
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x17a0
jmp 0x1542
movl 0x5c(%rsp), %eax
movl %eax, 0xc(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x17a0
leaq 0xa0(%rsp), %rdi
callq 0x17a0
movl 0xc(%rsp), %eax
addq $0xc8, %rsp
retq
leaq 0xa0(%rsp), %rdi
callq 0x17a0
movq 0x90(%rsp), %rdi
callq 0x1100
nopl (%rax)