#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*/ evaluate(int *, int, int);
int /*<<< orphan*/ exit(int);
int getXValue(char *, int *);
int /*<<< orphan*/ printPoly(int *, int);
int storeCoef(char **, int, int *);
int main(int argc, char *argv[]) {
  int coefficients[5], x, degree;
  if (getXValue(argv[argc - 1], &x) == -1) {
    exit(1);
  }
  degree = storeCoef(argv, argc, coefficients);
  if (degree == -1) {
    exit(1);
  }
  printPoly(coefficients, degree);
  evaluate(coefficients, degree, x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x34(%rbp),%rsi
call   1030 <getXValue@plt>
cmp    $0xffffffff,%eax
jne    1193 <main+0x43>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
lea    -0x30(%rbp),%rdx
call   1050 <storeCoef@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    11ba <main+0x6a>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%esi
call   1060 <printPoly@plt>
lea    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%esi
mov    -0x34(%rbp),%edx
call   1040 <evaluate@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
movslq %edi,%rax
mov    -0x8(%rsi,%rax,8),%rdi
lea    0xc(%rsp),%rsi
call   1030 <getXValue@plt>
cmp    $0xffffffff,%eax
je     11b0 <main+0x60>
lea    0x10(%rsp),%rdx
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <storeCoef@plt>
cmp    $0xffffffff,%eax
je     11b0 <main+0x60>
mov    %eax,%ebx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printPoly@plt>
mov    0xc(%rsp),%edx
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <evaluate@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [5 x i32]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i8**, i8*** %5
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8*, i8** %9, i64 %12
%14 = load i8*, i8** %13
%15 = call i32 @getXValue(i8* %14, i32* %7)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = load i32, i32* %4
%22 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%23 = call i32 @storeCoef(i8** %20, i32 %21, i32* %22)
store i32 %23, i32* %8
%24 = load i32, i32* %8
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %28
26: ; preds = %19
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %19
%29 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%30 = load i32, i32* %8
%31 = call i32 @printPoly(i32* %29, i32 %30)
%32 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%33 = load i32, i32* %8
%34 = load i32, i32* %7
%35 = call i32 @evaluate(i32* %32, i32 %33, i32 %34)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [5 x i32]
%4 = alloca i32
%5 = bitcast [5 x i32]* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = add nsw i32 %0, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = call i32 @getXValue(i8* %10, i32* %4)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%17 = call i32 @storeCoef(i8** %1, i32 %0, i32* %16)
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %15
%22 = call i32 @printPoly(i32* %16, i32 %17)
%23 = load i32, i32* %4
%24 = call i32 @evaluate(i32* %16, i32 %17, i32 %23)
ret i32 0
}