#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 */
scalar_t__ check_polynomial_parse(char *, char *, int);
int test_polynomial_parse() {
  int ret = 0;
  ret += check_polynomial_parse("2x^2+3", "2.00x^2.00+3.00", 2);
  ret += check_polynomial_parse("32433.033x^2.2002+2x+3.1452",
                                "32433.0330x^2.2002+2.0000x+3.1452", 4);
  ret += check_polynomial_parse("x^32.225+23.32x^2.02+233",
                                "x^32.225+23.320x^2.020+233.000", 3);
  ret += check_polynomial_parse("x^32.225+23.32x^2.02+233",
                                "x^32.23+23.32x^2.02+233.00", 2);
  ret += check_polynomial_parse("x^32.225+23.32x^2.02+233",
                                "x^32.2+23.3x^2.0+233.0", 1);
  ret += check_polynomial_parse("x^3-x^2-x-2", "x^3.00-x^2.00-x-2.00", 2);
  ret += check_polynomial_parse("-2.2x^-3.3-4.4x^-5.5-6.6x-7.7",
                                "-6.6x-7.7-2.2x^-3.3-4.4x^-5.5", 1);
  ret += check_polynomial_parse("x+x+x+x+x", "5x", 0);
  ret += check_polynomial_parse("x+x+x+x+x-x-x-x-x", "x", 0);
  ret += check_polynomial_parse("x+x+x+x+x-x-x-x-x-x", "0", 0);
  ret += check_polynomial_parse("x^3+x^3-x^3", "x^3", 0);
  ret += check_polynomial_parse("x", "x", 0);
  ret += check_polynomial_parse("0", "0", 0);
  return ret;
}


x86 assembly (clang, -O0):
<test_polynomial_parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    0xeda(%rip),%rsi
mov    $0x2,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
lea    0xecc(%rip),%rdi
lea    0xee1(%rip),%rsi
mov    $0x4,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
lea    0xee5(%rip),%rdi
lea    0xef7(%rip),%rsi
mov    $0x3,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
lea    0xec0(%rip),%rdi
lea    0xef1(%rip),%rsi
mov    $0x2,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
lea    0xe9b(%rip),%rdi
lea    0xee7(%rip),%rsi
mov    $0x1,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
lea    0xee0(%rip),%rdi
lea    0xee5(%rip),%rsi
mov    $0x2,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
lea    0xedc(%rip),%rdi
lea    0xef3(%rip),%rsi
mov    $0x1,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
lea    0xef3(%rip),%rdi
lea    0xef6(%rip),%rsi
xor    %edx,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
lea    0xede(%rip),%rdi
lea    0xed2(%rip),%rsi
xor    %edx,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
lea    0xece(%rip),%rdi
lea    0xe49(%rip),%rsi
xor    %edx,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
lea    0xec0(%rip),%rdi
lea    0xec1(%rip),%rsi
xor    %edx,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
lea    0xe73(%rip),%rsi
xor    %edx,%edx
mov    %rsi,%rdi
call   1030 <check_polynomial_parse@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
lea    0xdee(%rip),%rsi
xor    %edx,%edx
mov    %rsi,%rdi
call   1030 <check_polynomial_parse@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_polynomial_parse>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
lea    0xee0(%rip),%rdi
lea    0xee0(%rip),%rsi
mov    $0x2,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%r14
lea    0xedc(%rip),%rdi
lea    0xef1(%rip),%rsi
mov    $0x4,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%r15
add    %r14d,%r15d
lea    0xefc(%rip),%r14
lea    0xf0e(%rip),%rsi
mov    %r14,%rdi
mov    $0x3,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%rbx
add    %r15d,%ebx
lea    0xf13(%rip),%rsi
mov    %r14,%rdi
mov    $0x2,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%r15
add    %ebx,%r15d
lea    0xf14(%rip),%rsi
mov    %r14,%rdi
mov    $0x1,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%rbx
add    %r15d,%ebx
lea    0xf11(%rip),%rdi
lea    0xf16(%rip),%rsi
mov    $0x2,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%r14
add    %ebx,%r14d
lea    0xf14(%rip),%rdi
lea    0xf2b(%rip),%rsi
mov    $0x1,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%r15
add    %r14d,%r15d
lea    0xf32(%rip),%rdi
lea    0xf35(%rip),%rsi
xor    %edx,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%rbx
add    %r15d,%ebx
lea    0xf24(%rip),%rdi
lea    0xf18(%rip),%r14
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%r15
add    %ebx,%r15d
lea    0xf18(%rip),%rdi
lea    0xe93(%rip),%r12
mov    %r12,%rsi
xor    %edx,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%r13
add    %r15d,%r13d
lea    0xf0e(%rip),%rdi
lea    0xf0f(%rip),%rsi
xor    %edx,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%rbx
add    %r13d,%ebx
mov    %r14,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <check_polynomial_parse@plt>
mov    %rax,%r14
add    %ebx,%r14d
mov    %r12,%rdi
mov    %r12,%rsi
xor    %edx,%edx
call   1030 <check_polynomial_parse@plt>
add    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"2x^2+3\00"
@.str.1 = [16 x i8] c"2.00x^2.00+3.00\00"
@.str.2 = [28 x i8] c"32433.033x^2.2002+2x+3.1452\00"
@.str.3 = [34 x i8] c"32433.0330x^2.2002+2.0000x+3.1452\00"
@.str.4 = [25 x i8] c"x^32.225+23.32x^2.02+233\00"
@.str.5 = [31 x i8] c"x^32.225+23.320x^2.020+233.000\00"
@.str.6 = [27 x i8] c"x^32.23+23.32x^2.02+233.00\00"
@.str.7 = [23 x i8] c"x^32.2+23.3x^2.0+233.0\00"
@.str.8 = [12 x i8] c"x^3-x^2-x-2\00"
@.str.9 = [21 x i8] c"x^3.00-x^2.00-x-2.00\00"
@.str.10 = [30 x i8] c"-2.2x^-3.3-4.4x^-5.5-6.6x-7.7\00"
@.str.11 = [30 x i8] c"-6.6x-7.7-2.2x^-3.3-4.4x^-5.5\00"
@.str.12 = [10 x i8] c"x+x+x+x+x\00"
@.str.13 = [3 x i8] c"5x\00"
@.str.14 = [18 x i8] c"x+x+x+x+x-x-x-x-x\00"
@.str.15 = [2 x i8] c"x\00"
@.str.16 = [20 x i8] c"x+x+x+x+x-x-x-x-x-x\00"
@.str.17 = [2 x i8] c"0\00"
@.str.18 = [12 x i8] c"x^3+x^3-x^3\00"
@.str.19 = [4 x i8] c"x^3\00"
define i32 @test_polynomial_parse() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @check_polynomial_parse(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 2)
%3 = load i32, i32* %1
%4 = sext i32 %3 to i64
%5 = add nsw i64 %4, %2
%6 = trunc i64 %5 to i32
store i32 %6, i32* %1
%7 = call i64 @check_polynomial_parse(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 4)
%8 = load i32, i32* %1
%9 = sext i32 %8 to i64
%10 = add nsw i64 %9, %7
%11 = trunc i64 %10 to i32
store i32 %11, i32* %1
%12 = call i64 @check_polynomial_parse(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 3)
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = add nsw i64 %14, %12
%16 = trunc i64 %15 to i32
store i32 %16, i32* %1
%17 = call i64 @check_polynomial_parse(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 2)
%18 = load i32, i32* %1
%19 = sext i32 %18 to i64
%20 = add nsw i64 %19, %17
%21 = trunc i64 %20 to i32
store i32 %21, i32* %1
%22 = call i64 @check_polynomial_parse(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 1)
%23 = load i32, i32* %1
%24 = sext i32 %23 to i64
%25 = add nsw i64 %24, %22
%26 = trunc i64 %25 to i32
store i32 %26, i32* %1
%27 = call i64 @check_polynomial_parse(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 2)
%28 = load i32, i32* %1
%29 = sext i32 %28 to i64
%30 = add nsw i64 %29, %27
%31 = trunc i64 %30 to i32
store i32 %31, i32* %1
%32 = call i64 @check_polynomial_parse(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0), i32 1)
%33 = load i32, i32* %1
%34 = sext i32 %33 to i64
%35 = add nsw i64 %34, %32
%36 = trunc i64 %35 to i32
store i32 %36, i32* %1
%37 = call i64 @check_polynomial_parse(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32 0)
%38 = load i32, i32* %1
%39 = sext i32 %38 to i64
%40 = add nsw i64 %39, %37
%41 = trunc i64 %40 to i32
store i32 %41, i32* %1
%42 = call i64 @check_polynomial_parse(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i32 0)
%43 = load i32, i32* %1
%44 = sext i32 %43 to i64
%45 = add nsw i64 %44, %42
%46 = trunc i64 %45 to i32
store i32 %46, i32* %1
%47 = call i64 @check_polynomial_parse(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i64 0, i64 0), i32 0)
%48 = load i32, i32* %1
%49 = sext i32 %48 to i64
%50 = add nsw i64 %49, %47
%51 = trunc i64 %50 to i32
store i32 %51, i32* %1
%52 = call i64 @check_polynomial_parse(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i64 0, i64 0), i32 0)
%53 = load i32, i32* %1
%54 = sext i32 %53 to i64
%55 = add nsw i64 %54, %52
%56 = trunc i64 %55 to i32
store i32 %56, i32* %1
%57 = call i64 @check_polynomial_parse(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i32 0)
%58 = load i32, i32* %1
%59 = sext i32 %58 to i64
%60 = add nsw i64 %59, %57
%61 = trunc i64 %60 to i32
store i32 %61, i32* %1
%62 = call i64 @check_polynomial_parse(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i64 0, i64 0), i32 0)
%63 = load i32, i32* %1
%64 = sext i32 %63 to i64
%65 = add nsw i64 %64, %62
%66 = trunc i64 %65 to i32
store i32 %66, i32* %1
%67 = load i32, i32* %1
ret i32 %67
}

LLVM IR (-O2):
@.str = [7 x i8] c"2x^2+3\00"
@.str.1 = [16 x i8] c"2.00x^2.00+3.00\00"
@.str.2 = [28 x i8] c"32433.033x^2.2002+2x+3.1452\00"
@.str.3 = [34 x i8] c"32433.0330x^2.2002+2.0000x+3.1452\00"
@.str.4 = [25 x i8] c"x^32.225+23.32x^2.02+233\00"
@.str.5 = [31 x i8] c"x^32.225+23.320x^2.020+233.000\00"
@.str.6 = [27 x i8] c"x^32.23+23.32x^2.02+233.00\00"
@.str.7 = [23 x i8] c"x^32.2+23.3x^2.0+233.0\00"
@.str.8 = [12 x i8] c"x^3-x^2-x-2\00"
@.str.9 = [21 x i8] c"x^3.00-x^2.00-x-2.00\00"
@.str.10 = [30 x i8] c"-2.2x^-3.3-4.4x^-5.5-6.6x-7.7\00"
@.str.11 = [30 x i8] c"-6.6x-7.7-2.2x^-3.3-4.4x^-5.5\00"
@.str.12 = [10 x i8] c"x+x+x+x+x\00"
@.str.13 = [3 x i8] c"5x\00"
@.str.14 = [18 x i8] c"x+x+x+x+x-x-x-x-x\00"
@.str.15 = [2 x i8] c"x\00"
@.str.16 = [20 x i8] c"x+x+x+x+x-x-x-x-x-x\00"
@.str.17 = [2 x i8] c"0\00"
@.str.18 = [12 x i8] c"x^3+x^3-x^3\00"
@.str.19 = [4 x i8] c"x^3\00"
define i32 @test_polynomial_parse() {
%1 = tail call i64 @check_polynomial_parse(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 2)
%2 = tail call i64 @check_polynomial_parse(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 4)
%3 = add i64 %2, %1
%4 = tail call i64 @check_polynomial_parse(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 3)
%5 = add i64 %3, %4
%6 = tail call i64 @check_polynomial_parse(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 2)
%7 = add i64 %5, %6
%8 = tail call i64 @check_polynomial_parse(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 1)
%9 = add i64 %7, %8
%10 = tail call i64 @check_polynomial_parse(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 2)
%11 = add i64 %9, %10
%12 = tail call i64 @check_polynomial_parse(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0), i32 1)
%13 = add i64 %11, %12
%14 = tail call i64 @check_polynomial_parse(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32 0)
%15 = add i64 %13, %14
%16 = tail call i64 @check_polynomial_parse(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i32 0)
%17 = add i64 %15, %16
%18 = tail call i64 @check_polynomial_parse(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i64 0, i64 0), i32 0)
%19 = add i64 %17, %18
%20 = tail call i64 @check_polynomial_parse(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i64 0, i64 0), i32 0)
%21 = add i64 %19, %20
%22 = tail call i64 @check_polynomial_parse(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i32 0)
%23 = add i64 %21, %22
%24 = tail call i64 @check_polynomial_parse(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i64 0, i64 0), i32 0)
%25 = add i64 %23, %24
%26 = trunc i64 %25 to i32
ret i32 %26
}