#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 */
struct poly {
  int dummy;
};

/* Variables and functions */
struct poly *polyCreate();
struct poly *polyDelete(struct poly *);
double polyEval(struct poly *, double);
int /*<<< orphan*/ polySetCoefficient(struct poly *, int, double);
int /*<<< orphan*/ printf(char *, double);
int main(void) {
  struct poly *p0 = polyCreate();
  polySetCoefficient(p0, 0, 4.0);
  polySetCoefficient(p0, 1, -1.0);
  polySetCoefficient(p0, 10, 2.0);
  printf("%g\n", polyEval(p0, 0.0));
  printf("%g\n", polyEval(p0, 1.0));
  printf("%g\n", polyEval(p0, 2.0));
  p0 = polyDelete(p0);
  struct poly *p1 = polyCreate();
  printf("%g\n", polyEval(p1, 3.0));
  p1 = polyDelete(p1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <polyCreate@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
movsd  0xea8(%rip),%xmm0
call   1070 <polySetCoefficient@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
movsd  0xe8a(%rip),%xmm0
call   1070 <polySetCoefficient@plt>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
movsd  0xe64(%rip),%xmm0
call   1070 <polySetCoefficient@plt>
mov    -0x10(%rbp),%rdi
xorps  %xmm0,%xmm0
call   1040 <polyEval@plt>
lea    0xe6c(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
movsd  0xe43(%rip),%xmm0
call   1040 <polyEval@plt>
lea    0xe4f(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
movsd  0xe1e(%rip),%xmm0
call   1040 <polyEval@plt>
lea    0xe32(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <polyDelete@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <polyCreate@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
movsd  0xde1(%rip),%xmm0
call   1040 <polyEval@plt>
lea    0xdfd(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <polyDelete@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <polyCreate@plt>
mov    %rax,%rbx
movsd  0xe9a(%rip),%xmm0
mov    %rax,%rdi
xor    %esi,%esi
call   1070 <polySetCoefficient@plt>
movsd  0xe90(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%esi
call   1070 <polySetCoefficient@plt>
movsd  0xe83(%rip),%xmm0
mov    %rbx,%rdi
mov    $0xa,%esi
call   1070 <polySetCoefficient@plt>
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
call   1040 <polyEval@plt>
lea    0xe7c(%rip),%r14
mov    %r14,%rdi
call   1050 <printf@plt>
movsd  0xe5c(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <polyEval@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
movsd  0xe39(%rip),%xmm0
call   1040 <polyEval@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <polyDelete@plt>
xor    %eax,%eax
call   1060 <polyCreate@plt>
mov    %rax,%rbx
movsd  0xe22(%rip),%xmm0
mov    %rax,%rdi
call   1040 <polyEval@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <polyDelete@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.poly = type { i32 }
@.str = [4 x i8] c"%g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.poly*
%3 = alloca %struct.poly*
store i32 0, i32* %1
%4 = call %struct.poly* (...) @polyCreate()
store %struct.poly* %4, %struct.poly** %2
%5 = load %struct.poly*, %struct.poly** %2
%6 = call i32 @polySetCoefficient(%struct.poly* %5, i32 0, double 4.000000e+00)
%7 = load %struct.poly*, %struct.poly** %2
%8 = call i32 @polySetCoefficient(%struct.poly* %7, i32 1, double -1.000000e+00)
%9 = load %struct.poly*, %struct.poly** %2
%10 = call i32 @polySetCoefficient(%struct.poly* %9, i32 10, double 2.000000e+00)
%11 = load %struct.poly*, %struct.poly** %2
%12 = call double @polyEval(%struct.poly* %11, double 0.000000e+00)
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %12)
%14 = load %struct.poly*, %struct.poly** %2
%15 = call double @polyEval(%struct.poly* %14, double 1.000000e+00)
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %15)
%17 = load %struct.poly*, %struct.poly** %2
%18 = call double @polyEval(%struct.poly* %17, double 2.000000e+00)
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %18)
%20 = load %struct.poly*, %struct.poly** %2
%21 = call %struct.poly* @polyDelete(%struct.poly* %20)
store %struct.poly* %21, %struct.poly** %2
%22 = call %struct.poly* (...) @polyCreate()
store %struct.poly* %22, %struct.poly** %3
%23 = load %struct.poly*, %struct.poly** %3
%24 = call double @polyEval(%struct.poly* %23, double 3.000000e+00)
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %24)
%26 = load %struct.poly*, %struct.poly** %3
%27 = call %struct.poly* @polyDelete(%struct.poly* %26)
store %struct.poly* %27, %struct.poly** %3
ret i32 0
}

LLVM IR (-O2):
%struct.poly = type { i32 }
@.str = [4 x i8] c"%g\0A\00"
define i32 @main() {
%1 = tail call %struct.poly* (...) @polyCreate()
%2 = tail call i32 @polySetCoefficient(%struct.poly* %1, i32 0, double 4.000000e+00)
%3 = tail call i32 @polySetCoefficient(%struct.poly* %1, i32 1, double -1.000000e+00)
%4 = tail call i32 @polySetCoefficient(%struct.poly* %1, i32 10, double 2.000000e+00)
%5 = tail call double @polyEval(%struct.poly* %1, double 0.000000e+00)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %5)
%7 = tail call double @polyEval(%struct.poly* %1, double 1.000000e+00)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %7)
%9 = tail call double @polyEval(%struct.poly* %1, double 2.000000e+00)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %9)
%11 = tail call %struct.poly* @polyDelete(%struct.poly* %1)
%12 = tail call %struct.poly* (...) @polyCreate()
%13 = tail call double @polyEval(%struct.poly* %12, double 3.000000e+00)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %13)
%15 = tail call %struct.poly* @polyDelete(%struct.poly* %12)
ret i32 0
}