#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 evaluateDerivative(int *, int, int);
int /*<<< orphan*/ gets(char *);
int parseLineToGetNumArr(char *, int *);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, int *);
int main(void) {
  int coeff[1000000], input, polyDegree;
  char line[1000000 + 1];
  while (scanf("%d", &input) > 0) {
    gets(line);
    gets(line);
    polyDegree = parseLineToGetNumArr(line, coeff);
    polyDegree--;
    printf("%d\n", evaluateDerivative(coeff, polyDegree, input));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4c4b60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
lea    -0x3d0914(%rbp),%rsi
call   1070 <scanf@plt>
cmp    $0x0,%rax
jle    11ea <main+0x9a>
lea    -0x4c4b60(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x4c4b60(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x4c4b60(%rbp),%rdi
lea    -0x3d0910(%rbp),%rsi
call   1060 <parseLineToGetNumArr@plt>
mov    %eax,-0x3d0918(%rbp)
mov    -0x3d0918(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3d0918(%rbp)
lea    -0x3d0910(%rbp),%rdi
mov    -0x3d0918(%rbp),%esi
mov    -0x3d0914(%rbp),%edx
call   1040 <evaluateDerivative@plt>
mov    %eax,%esi
lea    0xe23(%rip),%rdi
call   1030 <printf@plt>
jmp    1162 <main+0x12>
xor    %eax,%eax
add    $0x4c4b60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4c4b60,%rsp
lea    0xe99(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
test   %rax,%rax
jle    11e4 <main+0x94>
lea    0x10(%rsp),%rbx
lea    0xf4260(%rsp),%r14
lea    0xe79(%rip),%r15
lea    0xe6f(%rip),%r12
lea    0xc(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <parseLineToGetNumArr@plt>
lea    -0x1(%rax),%esi
mov    0xc(%rsp),%edx
mov    %r14,%rdi
call   1040 <evaluateDerivative@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1070 <scanf@plt>
test   %rax,%rax
jg     11a0 <main+0x50>
xor    %eax,%eax
add    $0x4c4b60,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000000 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca [1000001 x i8]
store i32 0, i32* %1
br label %6
6: ; preds = %9, %0
%7 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = icmp sgt i64 %7, 0
br i1 %8, label %9, label %24
9: ; preds = %6
%10 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %5, i64 0, i64 0
%11 = call i32 @gets(i8* %10)
%12 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %5, i64 0, i64 0
%13 = call i32 @gets(i8* %12)
%14 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %5, i64 0, i64 0
%15 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %2, i64 0, i64 0
%16 = call i32 @parseLineToGetNumArr(i8* %14, i32* %15)
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = add nsw i32 %17, -1
store i32 %18, i32* %4
%19 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %2, i64 0, i64 0
%20 = load i32, i32* %4
%21 = load i32, i32* %3
%22 = call i32 @evaluateDerivative(i32* %19, i32 %20, i32 %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %22)
br label %6
24: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [1000000 x i32]
%2 = alloca i32
%3 = alloca [1000001 x i8]
%4 = bitcast [1000000 x i32]* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %3, i64 0, i64 0
%7 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = icmp sgt i64 %7, 0
br i1 %8, label %9, label %21
9: ; preds = %0
%10 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %1, i64 0, i64 0
br label %11
11: ; preds = %9, %11
%12 = call i32 @gets(i8* %6)
%13 = call i32 @gets(i8* %6)
%14 = call i32 @parseLineToGetNumArr(i8* %6, i32* %10)
%15 = add nsw i32 %14, -1
%16 = load i32, i32* %2
%17 = call i32 @evaluateDerivative(i32* %10, i32 %15, i32 %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%20 = icmp sgt i64 %19, 0
br i1 %20, label %11, label %21
21: ; preds = %11, %0
ret i32 0
}