#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 */
typedef int /*<<< orphan*/ q;
typedef int /*<<< orphan*/ p;

/* Variables and functions */
int /*<<< orphan*/ getch();
double *polymul(double *, int, double *, int);
int /*<<< orphan*/ printf(char *, ...);
main() {
  double p[3] = {3.0, -6.7, 2.1};
  double q[2] = {2.4, 3.5};
  double *valpq;
  int m, n, i;
  m = sizeof(p) / sizeof(double);
  n = sizeof(q) / sizeof(double);
  valpq = polymul(p, m, q, n);
  printf("\n valpq[%d]={", m + n - 1);
  for (i = 0; i < m + n - 1; i++)
    printf("%5.2lf", *(valpq + i));
  printf("}");
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeb9(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeb6(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x3,-0x3c(%rbp)
movl   $0x2,-0x40(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x3c(%rbp),%esi
lea    -0x30(%rbp),%rdx
mov    -0x40(%rbp),%ecx
call   1040 <polymul@plt>
mov    %rax,-0x38(%rbp)
mov    -0x3c(%rbp),%esi
add    -0x40(%rbp),%esi
sub    $0x1,%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    -0x3c(%rbp),%ecx
add    -0x40(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11f6 <main+0xc6>
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe5d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11b9 <main+0x89>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getch@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    0xec2(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xea6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeba(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x10(%rsp),%rdi
mov    %rsp,%rdx
mov    $0x3,%esi
mov    $0x2,%ecx
call   1050 <polymul@plt>
mov    %rax,%rbx
lea    0xea5(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  (%rbx),%xmm0
lea    0xe9c(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x8(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x10(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x18(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x7d,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1060 <getch@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.p = [3 x double] [double 3.000000e+00, double -6.700000e+00, double 2.100000e+00]
@__const.main.q = [2 x double] [double 2.400000e+00, double 3.500000e+00]
@.str = [14 x i8] c"\0A valpq[%d]={\00"
@.str.1 = [7 x i8] c"%5.2lf\00"
@.str.2 = [2 x i8] c"}\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x double]
%3 = alloca [2 x double]
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [3 x double]* %2 to i8*
%9 = bitcast [2 x double]* %3 to i8*
store i32 3, i32* %5
store i32 2, i32* %6
%10 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%11 = load i32, i32* %5
%12 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%13 = load i32, i32* %6
%14 = call double* @polymul(double* %10, i32 %11, double* %12, i32 %13)
store double* %14, double** %4
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = add nsw i32 %15, %16
%18 = sub nsw i32 %17, 1
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %18)
store i32 0, i32* %7
br label %20
20: ; preds = %34, %0
%21 = load i32, i32* %7
%22 = load i32, i32* %5
%23 = load i32, i32* %6
%24 = add nsw i32 %22, %23
%25 = sub nsw i32 %24, 1
%26 = icmp slt i32 %21, %25
br i1 %26, label %27, label %37
27: ; preds = %20
%28 = load double*, double** %4
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %28, i64 %30
%32 = load double, double* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %32)
br label %34
34: ; preds = %27
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
br label %20
37: ; preds = %20
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%39 = call i32 (...) @getch()
%40 = load i32, i32* %1
ret i32 %40
}

LLVM IR (-O2):
@__const.main.p = [3 x double] [double 3.000000e+00, double -6.700000e+00, double 2.100000e+00]
@__const.main.q = [2 x double] [double 2.400000e+00, double 3.500000e+00]
@.str = [14 x i8] c"\0A valpq[%d]={\00"
@.str.1 = [7 x i8] c"%5.2lf\00"
define i32 @main() {
%1 = alloca [3 x double]
%2 = alloca [2 x double]
%3 = bitcast [3 x double]* %1 to i8*
%4 = bitcast [2 x double]* %2 to i8*
%5 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
%6 = getelementptr inbounds [2 x double], [2 x double]* %2, i64 0, i64 0
%7 = call double* @polymul(double* %5, i32 3, double* %6, i32 2)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 4)
%9 = load double, double* %7
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %9)
%11 = getelementptr inbounds double, double* %7, i64 1
%12 = load double, double* %11
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %12)
%14 = getelementptr inbounds double, double* %7, i64 2
%15 = load double, double* %14
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %15)
%17 = getelementptr inbounds double, double* %7, i64 3
%18 = load double, double* %17
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %18)
%20 = call i32 @putchar(i32 125)
%21 = call i32 (...) @getch()
ret i32 0
}