#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*/ printf(char *, ...);
void imprime_polinomio(double **P, int grau, char *identificador) {
  int i;
  printf("\n--- %s ---\n", identificador);
  for (i = grau - 1; i >= 0; i--)
    printf("%+.2f * x^%d ", P[i][0], i);
  printf("\n");
}


x86 assembly (clang, -O0):
<imprime_polinomio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     1177 <imprime_polinomio+0x67>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  (%rax),%xmm0
mov    -0x1c(%rbp),%esi
lea    0xeab(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    113e <imprime_polinomio+0x2e>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imprime_polinomio>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%r15
lea    0xecd(%rip),%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
jle    1173 <imprime_polinomio+0x53>
mov    %ebp,%ebp
lea    0xec3(%rip),%r14
nopw   0x0(%rax,%rax,1)
lea    -0x1(%rbp),%rbx
mov    %ebx,%eax
mov    (%r15,%rax,8),%rax
movsd  (%rax),%xmm0
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1040 <printf@plt>
cmp    $0x1,%rbp
mov    %rbx,%rbp
ja     1150 <imprime_polinomio+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"\0A--- %s ---\0A\00"
@.str.1 = [14 x i8] c"%+.2f * x^%d \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @imprime_polinomio(double** %0, i32 %1, i8* %2) {
%4 = alloca double**
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
store double** %0, double*** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32, i32* %5
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %7
br label %12
12: ; preds = %25, %3
%13 = load i32, i32* %7
%14 = icmp sge i32 %13, 0
br i1 %14, label %15, label %28
15: ; preds = %12
%16 = load double**, double*** %4
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double*, double** %16, i64 %18
%20 = load double*, double** %19
%21 = getelementptr inbounds double, double* %20, i64 0
%22 = load double, double* %21
%23 = load i32, i32* %7
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %22, i32 %23)
br label %25
25: ; preds = %15
%26 = load i32, i32* %7
%27 = add nsw i32 %26, -1
store i32 %27, i32* %7
br label %12
28: ; preds = %12
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"\0A--- %s ---\0A\00"
@.str.1 = [14 x i8] c"%+.2f * x^%d \00"
define void @imprime_polinomio(double** nocapture %0, i32 %1, i8* %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %18
6: ; preds = %3
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ %7, %6 ], [ %10, %8 ]
%10 = add nsw i64 %9, -1
%11 = trunc i64 %10 to i32
%12 = and i64 %10, 4294967295
%13 = getelementptr inbounds double*, double** %0, i64 %12
%14 = load double*, double** %13
%15 = load double, double* %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %15, i32 %11)
%17 = icmp ugt i64 %9, 1
br i1 %17, label %8, label %18
18: ; preds = %8, %3
%19 = tail call i32 @putchar(i32 10)
ret void
}