#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*/ Convolution1D(int *, int *, int *, int);
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  int *N, *P, *M;
  int n, i;
  scanf("%d", &n);
  P = (int *)malloc(n * sizeof(int));
  N = (int *)malloc(n * sizeof(int));
  M = (int *)malloc(sizeof(int) * 101);
  for (i = 0; i < n; i++)
    scanf("%d", &N[i]);
  for (i = 0; i < 101; i++)
    M[i] = i;
  Convolution1D(N, P, M, n);
  for (i = 0; i < n; i++)
    printf("%d ", P[i]);
  printf("\n");
  free(P);
  free(N);
  free(M);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe93(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1070 <scanf@plt>
movslq -0x2c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
movslq -0x2c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x194,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    11e6 <main+0x96>
mov    -0x18(%rbp),%rsi
movslq -0x30(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe2d(%rip),%rdi
call   1070 <scanf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11b1 <main+0x61>
movl   $0x0,-0x30(%rbp)
cmpl   $0x65,-0x30(%rbp)
jge    1213 <main+0xc3>
mov    -0x30(%rbp),%edx
mov    -0x28(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11ed <main+0x9d>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
call   1060 <Convolution1D@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1261 <main+0x111>
mov    -0x20(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    122e <main+0xde>
lea    0xd9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0x101e(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x4(%rsp),%edi
shl    $0x2,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
mov    0x4(%rsp),%edi
shl    $0x2,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    $0x194,%edi
call   1060 <malloc@plt>
mov    %rax,%r12
cmpl   $0x0,0x4(%rsp)
jle    11dd <main+0x7d>
xor    %ebp,%ebp
lea    0xfd9(%rip),%r13
mov    %r14,%rbx
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %rbx,%rsi
call   1080 <scanf@plt>
add    $0x1,%rbp
movslq 0x4(%rsp),%rax
add    $0x4,%rbx
cmp    %rax,%rbp
jl     11c0 <main+0x60>
movaps 0xe1c(%rip),%xmm0
movups %xmm0,(%r12)
movaps 0xe20(%rip),%xmm0
movups %xmm0,0x10(%r12)
movaps 0xe23(%rip),%xmm0
movups %xmm0,0x20(%r12)
movaps 0xe26(%rip),%xmm0
movups %xmm0,0x30(%r12)
movaps 0xe29(%rip),%xmm0
movups %xmm0,0x40(%r12)
movaps 0xe2c(%rip),%xmm0
movups %xmm0,0x50(%r12)
movaps 0xe2f(%rip),%xmm0
movups %xmm0,0x60(%r12)
movaps 0xe32(%rip),%xmm0
movups %xmm0,0x70(%r12)
movaps 0xe35(%rip),%xmm0
movups %xmm0,0x80(%r12)
movaps 0xe35(%rip),%xmm0
movups %xmm0,0x90(%r12)
movaps 0xe35(%rip),%xmm0
movups %xmm0,0xa0(%r12)
movaps 0xe35(%rip),%xmm0
movups %xmm0,0xb0(%r12)
movaps 0xe35(%rip),%xmm0
movups %xmm0,0xc0(%r12)
movaps 0xe35(%rip),%xmm0
movups %xmm0,0xd0(%r12)
movaps 0xe35(%rip),%xmm0
movups %xmm0,0xe0(%r12)
movaps 0xe35(%rip),%xmm0
movups %xmm0,0xf0(%r12)
movaps 0xe35(%rip),%xmm0
movups %xmm0,0x100(%r12)
movaps 0xe35(%rip),%xmm0
movups %xmm0,0x110(%r12)
movaps 0xe35(%rip),%xmm0
movups %xmm0,0x120(%r12)
movaps 0xe35(%rip),%xmm0
movups %xmm0,0x130(%r12)
movaps 0xe35(%rip),%xmm0
movups %xmm0,0x140(%r12)
movaps 0xe35(%rip),%xmm0
movups %xmm0,0x150(%r12)
movaps 0xe35(%rip),%xmm0
movups %xmm0,0x160(%r12)
movaps 0xe35(%rip),%xmm0
movups %xmm0,0x170(%r12)
movaps 0xe35(%rip),%xmm0
movups %xmm0,0x180(%r12)
movl   $0x64,0x190(%r12)
mov    0x4(%rsp),%ecx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1070 <Convolution1D@plt>
cmpl   $0x0,0x4(%rsp)
jle    13ac <main+0x24c>
lea    0xe13(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r15,%rbp,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
movslq 0x4(%rsp),%rax
cmp    %rax,%rbp
jl     1390 <main+0x230>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%12 = load i32, i32* %9
%13 = sext i32 %12 to i64
%14 = mul i64 %13, 4
%15 = trunc i64 %14 to i32
%16 = call i64 @malloc(i32 %15)
%17 = inttoptr i64 %16 to i32*
store i32* %17, i32** %7
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = mul i64 %19, 4
%21 = trunc i64 %20 to i32
%22 = call i64 @malloc(i32 %21)
%23 = inttoptr i64 %22 to i32*
store i32* %23, i32** %6
%24 = call i64 @malloc(i32 404)
%25 = inttoptr i64 %24 to i32*
store i32* %25, i32** %8
store i32 0, i32* %10
br label %26
26: ; preds = %36, %2
%27 = load i32, i32* %10
%28 = load i32, i32* %9
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %39
30: ; preds = %26
%31 = load i32*, i32** %6
%32 = load i32, i32* %10
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %31, i64 %33
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %34)
br label %36
36: ; preds = %30
%37 = load i32, i32* %10
%38 = add nsw i32 %37, 1
store i32 %38, i32* %10
br label %26
39: ; preds = %26
store i32 0, i32* %10
br label %40
40: ; preds = %49, %39
%41 = load i32, i32* %10
%42 = icmp slt i32 %41, 101
br i1 %42, label %43, label %52
43: ; preds = %40
%44 = load i32, i32* %10
%45 = load i32*, i32** %8
%46 = load i32, i32* %10
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %45, i64 %47
store i32 %44, i32* %48
br label %49
49: ; preds = %43
%50 = load i32, i32* %10
%51 = add nsw i32 %50, 1
store i32 %51, i32* %10
br label %40
52: ; preds = %40
%53 = load i32*, i32** %6
%54 = load i32*, i32** %7
%55 = load i32*, i32** %8
%56 = load i32, i32* %9
%57 = call i32 @Convolution1D(i32* %53, i32* %54, i32* %55, i32 %56)
store i32 0, i32* %10
br label %58
58: ; preds = %69, %52
%59 = load i32, i32* %10
%60 = load i32, i32* %9
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %72
62: ; preds = %58
%63 = load i32*, i32** %7
%64 = load i32, i32* %10
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i32, i32* %63, i64 %65
%67 = load i32, i32* %66
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %67)
br label %69
69: ; preds = %62
%70 = load i32, i32* %10
%71 = add nsw i32 %70, 1
store i32 %71, i32* %10
br label %58
72: ; preds = %58
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%74 = load i32*, i32** %7
%75 = call i32 @free(i32* %74)
%76 = load i32*, i32** %6
%77 = call i32 @free(i32* %76)
%78 = load i32*, i32** %8
%79 = call i32 @free(i32* %78)
%80 = load i32, i32* %3
ret i32 %80
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = shl i32 %6, 2
%8 = call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to i32*
%10 = load i32, i32* %3
%11 = shl i32 %10, 2
%12 = call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to i32*
%14 = call i64 @malloc(i32 404)
%15 = inttoptr i64 %14 to i32*
%16 = load i32, i32* %3
%17 = icmp sgt i32 %16, 0
br i1 %17, label %73, label %18
18: ; preds = %2, %73
%19 = inttoptr i64 %14 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %19
%20 = getelementptr inbounds i32, i32* %15, i64 4
%21 = bitcast i32* %20 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %21
%22 = getelementptr inbounds i32, i32* %15, i64 8
%23 = bitcast i32* %22 to <4 x i32>*
store <4 x i32> <i32 8, i32 9, i32 10, i32 11>, <4 x i32>* %23
%24 = getelementptr inbounds i32, i32* %15, i64 12
%25 = bitcast i32* %24 to <4 x i32>*
store <4 x i32> <i32 12, i32 13, i32 14, i32 15>, <4 x i32>* %25
%26 = getelementptr inbounds i32, i32* %15, i64 16
%27 = bitcast i32* %26 to <4 x i32>*
store <4 x i32> <i32 16, i32 17, i32 18, i32 19>, <4 x i32>* %27
%28 = getelementptr inbounds i32, i32* %15, i64 20
%29 = bitcast i32* %28 to <4 x i32>*
store <4 x i32> <i32 20, i32 21, i32 22, i32 23>, <4 x i32>* %29
%30 = getelementptr inbounds i32, i32* %15, i64 24
%31 = bitcast i32* %30 to <4 x i32>*
store <4 x i32> <i32 24, i32 25, i32 26, i32 27>, <4 x i32>* %31
%32 = getelementptr inbounds i32, i32* %15, i64 28
%33 = bitcast i32* %32 to <4 x i32>*
store <4 x i32> <i32 28, i32 29, i32 30, i32 31>, <4 x i32>* %33
%34 = getelementptr inbounds i32, i32* %15, i64 32
%35 = bitcast i32* %34 to <4 x i32>*
store <4 x i32> <i32 32, i32 33, i32 34, i32 35>, <4 x i32>* %35
%36 = getelementptr inbounds i32, i32* %15, i64 36
%37 = bitcast i32* %36 to <4 x i32>*
store <4 x i32> <i32 36, i32 37, i32 38, i32 39>, <4 x i32>* %37
%38 = getelementptr inbounds i32, i32* %15, i64 40
%39 = bitcast i32* %38 to <4 x i32>*
store <4 x i32> <i32 40, i32 41, i32 42, i32 43>, <4 x i32>* %39
%40 = getelementptr inbounds i32, i32* %15, i64 44
%41 = bitcast i32* %40 to <4 x i32>*
store <4 x i32> <i32 44, i32 45, i32 46, i32 47>, <4 x i32>* %41
%42 = getelementptr inbounds i32, i32* %15, i64 48
%43 = bitcast i32* %42 to <4 x i32>*
store <4 x i32> <i32 48, i32 49, i32 50, i32 51>, <4 x i32>* %43
%44 = getelementptr inbounds i32, i32* %15, i64 52
%45 = bitcast i32* %44 to <4 x i32>*
store <4 x i32> <i32 52, i32 53, i32 54, i32 55>, <4 x i32>* %45
%46 = getelementptr inbounds i32, i32* %15, i64 56
%47 = bitcast i32* %46 to <4 x i32>*
store <4 x i32> <i32 56, i32 57, i32 58, i32 59>, <4 x i32>* %47
%48 = getelementptr inbounds i32, i32* %15, i64 60
%49 = bitcast i32* %48 to <4 x i32>*
store <4 x i32> <i32 60, i32 61, i32 62, i32 63>, <4 x i32>* %49
%50 = getelementptr inbounds i32, i32* %15, i64 64
%51 = bitcast i32* %50 to <4 x i32>*
store <4 x i32> <i32 64, i32 65, i32 66, i32 67>, <4 x i32>* %51
%52 = getelementptr inbounds i32, i32* %15, i64 68
%53 = bitcast i32* %52 to <4 x i32>*
store <4 x i32> <i32 68, i32 69, i32 70, i32 71>, <4 x i32>* %53
%54 = getelementptr inbounds i32, i32* %15, i64 72
%55 = bitcast i32* %54 to <4 x i32>*
store <4 x i32> <i32 72, i32 73, i32 74, i32 75>, <4 x i32>* %55
%56 = getelementptr inbounds i32, i32* %15, i64 76
%57 = bitcast i32* %56 to <4 x i32>*
store <4 x i32> <i32 76, i32 77, i32 78, i32 79>, <4 x i32>* %57
%58 = getelementptr inbounds i32, i32* %15, i64 80
%59 = bitcast i32* %58 to <4 x i32>*
store <4 x i32> <i32 80, i32 81, i32 82, i32 83>, <4 x i32>* %59
%60 = getelementptr inbounds i32, i32* %15, i64 84
%61 = bitcast i32* %60 to <4 x i32>*
store <4 x i32> <i32 84, i32 85, i32 86, i32 87>, <4 x i32>* %61
%62 = getelementptr inbounds i32, i32* %15, i64 88
%63 = bitcast i32* %62 to <4 x i32>*
store <4 x i32> <i32 88, i32 89, i32 90, i32 91>, <4 x i32>* %63
%64 = getelementptr inbounds i32, i32* %15, i64 92
%65 = bitcast i32* %64 to <4 x i32>*
store <4 x i32> <i32 92, i32 93, i32 94, i32 95>, <4 x i32>* %65
%66 = getelementptr inbounds i32, i32* %15, i64 96
%67 = bitcast i32* %66 to <4 x i32>*
store <4 x i32> <i32 96, i32 97, i32 98, i32 99>, <4 x i32>* %67
%68 = getelementptr inbounds i32, i32* %15, i64 100
store i32 100, i32* %68
%69 = load i32, i32* %3
%70 = call i32 @Convolution1D(i32* %13, i32* %9, i32* %15, i32 %69)
%71 = load i32, i32* %3
%72 = icmp sgt i32 %71, 0
br i1 %72, label %81, label %90
73: ; preds = %2, %73
%74 = phi i64 [ %77, %73 ], [ 0, %2 ]
%75 = getelementptr inbounds i32, i32* %13, i64 %74
%76 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %75)
%77 = add nuw nsw i64 %74, 1
%78 = load i32, i32* %3
%79 = sext i32 %78 to i64
%80 = icmp slt i64 %77, %79
br i1 %80, label %73, label %18
81: ; preds = %18, %81
%82 = phi i64 [ %86, %81 ], [ 0, %18 ]
%83 = getelementptr inbounds i32, i32* %9, i64 %82
%84 = load i32, i32* %83
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %84)
%86 = add nuw nsw i64 %82, 1
%87 = load i32, i32* %3
%88 = sext i32 %87 to i64
%89 = icmp slt i64 %86, %88
br i1 %89, label %81, label %90
90: ; preds = %81, %18
%91 = call i32 @putchar(i32 10)
%92 = call i32 @free(i32* %9)
%93 = call i32 @free(i32* %13)
%94 = call i32 @free(i32* %15)
ret i32 0
}