#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 polinomio(int *seq, int a, int b) {
  printf("p_%d,%d(x)= ", a, b);
  for (int x = a; x <= b; x++) {
    if (x != b)
      printf("%d"
             "\x1b[31m"
             "x"
             "\x1b[33m"
             "^"
             "\x1b[35m"
             "%d"
             "\x1b[0m"
             " + ",
             seq[x], (x - a));
    else
      printf("%d"
             "\x1b[31m"
             "x"
             "\x1b[33m"
             "^"
             "\x1b[35m"
             "%d"
             "\x1b[0m",
             seq[x], (x - a));
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<polinomio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11aa <polinomio+0x9a>
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     1178 <polinomio+0x68>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x14(%rbp),%edx
sub    -0xc(%rbp),%edx
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1197 <polinomio+0x87>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x14(%rbp),%edx
sub    -0xc(%rbp),%edx
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119c <polinomio+0x8c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113c <polinomio+0x2c>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<polinomio>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,(%rsp)
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%r13d
sub    %ebp,%r13d
jge    1161 <polinomio+0x41>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>
movslq %ebp,%rax
movslq %ebx,%r15
mov    %r15,%rbp
sub    %rax,%rbp
mov    (%rsp),%rcx
lea    (%rcx,%rax,4),%r12
lea    0x1(%r13),%r14d
xor    %ebx,%ebx
jmp    11a2 <polinomio+0x82>
nopl   (%rax)
mov    (%rsp),%rax
mov    (%rax,%r15,4),%esi
lea    0xe9b(%rip),%rdi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %ebx,%r14d
je     1149 <polinomio+0x29>
cmp    %rbx,%rbp
je     1180 <polinomio+0x60>
mov    (%r12,%rbx,4),%esi
lea    0xe5b(%rip),%rdi
mov    %ebx,%edx
jmp    1192 <polinomio+0x72>

LLVM IR (-O0):
@.str = [13 x i8] c"p_%d,%d(x)= \00"
@.str.1 = [29 x i8] c"%d\1B[31mx\1B[33m^\1B[35m%d\1B[0m + \00"
@.str.2 = [26 x i8] c"%d\1B[31mx\1B[33m^\1B[35m%d\1B[0m\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @polinomio(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
%11 = load i32, i32* %5
store i32 %11, i32* %7
br label %12
12: ; preds = %41, %3
%13 = load i32, i32* %7
%14 = load i32, i32* %6
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %44
16: ; preds = %12
%17 = load i32, i32* %7
%18 = load i32, i32* %6
%19 = icmp ne i32 %17, %18
br i1 %19, label %20, label %30
20: ; preds = %16
%21 = load i32*, i32** %4
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
%25 = load i32, i32* %24
%26 = load i32, i32* %7
%27 = load i32, i32* %5
%28 = sub nsw i32 %26, %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %25, i32 %28)
br label %40
30: ; preds = %16
%31 = load i32*, i32** %4
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %31, i64 %33
%35 = load i32, i32* %34
%36 = load i32, i32* %7
%37 = load i32, i32* %5
%38 = sub nsw i32 %36, %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %35, i32 %38)
br label %40
40: ; preds = %30, %20
br label %41
41: ; preds = %40
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
store i32 %43, i32* %7
br label %12
44: ; preds = %12
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"p_%d,%d(x)= \00"
@.str.1 = [29 x i8] c"%d\1B[31mx\1B[33m^\1B[35m%d\1B[0m + \00"
@.str.2 = [26 x i8] c"%d\1B[31mx\1B[33m^\1B[35m%d\1B[0m\00"
define void @polinomio(i32* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
%5 = icmp slt i32 %2, %1
br i1 %5, label %12, label %6
6: ; preds = %3
%7 = sext i32 %1 to i64
%8 = sext i32 %2 to i64
%9 = add i32 %2, 1
%10 = getelementptr inbounds i32, i32* %0, i64 %8
%11 = sub i32 %2, %1
br label %14
12: ; preds = %26, %3
%13 = tail call i32 @putchar(i32 10)
ret void
14: ; preds = %6, %26
%15 = phi i64 [ %7, %6 ], [ %27, %26 ]
%16 = icmp eq i64 %15, %8
br i1 %16, label %23, label %17
17: ; preds = %14
%18 = getelementptr inbounds i32, i32* %0, i64 %15
%19 = load i32, i32* %18
%20 = trunc i64 %15 to i32
%21 = sub i32 %20, %1
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %21)
br label %26
23: ; preds = %14
%24 = load i32, i32* %10
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %24, i32 %11)
br label %26
26: ; preds = %17, %23
%27 = add nsw i64 %15, 1
%28 = trunc i64 %27 to i32
%29 = icmp eq i32 %9, %28
br i1 %29, label %12, label %14
}