#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 atoi(char *);
int /*<<< orphan*/ printf(char *);
int storeCoef(char *cmdline[], int numcoef, int coefficients[]) {
  if (numcoef < 3) {
    printf("Not enough coefficients.  Bad command line.\n");
    return -1;
  } else if (numcoef > 5 + 2) {
    printf("Too many coefficients.  Bad command line.\n");
    return -1;
  } else {
    int i;
    for (i = 1; i < numcoef - 1; i++) {
      coefficients[i - 1] = atoi(cmdline[i]);
    }
    return numcoef - 3;
  }
  return 0;
}


x86 assembly (clang, -O0):
<storeCoef>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    1155 <storeCoef+0x35>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c9 <storeCoef+0xa9>
cmpl   $0x7,-0x14(%rbp)
jle    1177 <storeCoef+0x57>
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c9 <storeCoef+0xa9>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11c0 <storeCoef+0xa0>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <atoi@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    117e <storeCoef+0x5e>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<storeCoef>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
cmp    $0x2,%esi
jg     1137 <storeCoef+0x17>
lea    0xef5(%rip),%rdi
jmp    1146 <storeCoef+0x26>
mov    %esi,%r14d
cmp    $0x7,%esi
jbe    1153 <storeCoef+0x33>
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%r14d
jmp    118b <storeCoef+0x6b>
mov    %rdx,%r15
mov    %rdi,%r12
lea    -0x1(%r14),%r13d
add    $0xffffffffffffffff,%r13
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x8(%r12,%rbx,8),%rdi
call   1040 <atoi@plt>
mov    %eax,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1170 <storeCoef+0x50>
add    $0xfffffffd,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [45 x i8] c"Not enough coefficients. Bad command line.\0A\00"
@.str.1 = [43 x i8] c"Too many coefficients. Bad command line.\0A\00"
define i32 @storeCoef(i8** %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
store i8** %0, i8*** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %4
br label %42
13: ; preds = %3
%14 = load i32, i32* %6
%15 = icmp sgt i32 %14, 7
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %4
br label %42
18: ; preds = %13
store i32 1, i32* %8
br label %19
19: ; preds = %36, %18
%20 = load i32, i32* %8
%21 = load i32, i32* %6
%22 = sub nsw i32 %21, 1
%23 = icmp slt i32 %20, %22
br i1 %23, label %24, label %39
24: ; preds = %19
%25 = load i8**, i8*** %5
%26 = load i32, i32* %8
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = call i32 @atoi(i8* %29)
%31 = load i32*, i32** %7
%32 = load i32, i32* %8
%33 = sub nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %31, i64 %34
store i32 %30, i32* %35
br label %36
36: ; preds = %24
%37 = load i32, i32* %8
%38 = add nsw i32 %37, 1
store i32 %38, i32* %8
br label %19
39: ; preds = %19
%40 = load i32, i32* %6
%41 = sub nsw i32 %40, 3
store i32 %41, i32* %4
br label %42
42: ; preds = %39, %16, %11
%43 = load i32, i32* %4
ret i32 %43
}

LLVM IR (-O2):
@str = [42 x i8] c"Too many coefficients. Bad command line.\00"
@str.2 = [44 x i8] c"Not enough coefficients. Bad command line.\00"
define i32 @storeCoef(i8** nocapture %0, i32 %1, i32* nocapture writeonly %2) {
%4 = icmp slt i32 %1, 3
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.2, i64 0, i64 0))
br label %25
7: ; preds = %3
%8 = icmp ugt i32 %1, 7
br i1 %8, label %12, label %9
9: ; preds = %7
%10 = add nsw i32 %1, -1
%11 = zext i32 %10 to i64
br label %14
12: ; preds = %7
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
br label %25
14: ; preds = %9, %14
%15 = phi i64 [ 1, %9 ], [ %21, %14 ]
%16 = getelementptr inbounds i8*, i8** %0, i64 %15
%17 = load i8*, i8** %16
%18 = tail call i32 @atoi(i8* %17)
%19 = add nsw i64 %15, -1
%20 = getelementptr inbounds i32, i32* %2, i64 %19
store i32 %18, i32* %20
%21 = add nuw nsw i64 %15, 1
%22 = icmp eq i64 %21, %11
br i1 %22, label %23, label %14
23: ; preds = %14
%24 = add nsw i32 %1, -3
br label %25
25: ; preds = %23, %12, %5
%26 = phi i32 [ -1, %5 ], [ -1, %12 ], [ %24, %23 ]
ret i32 %26
}