#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*/ lagrange(int *, int, int *, int);
scalar_t__ pow(int, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int secret;
  int w;
  int t;
  int i;
  int j;
  int k;
  int sum = 0;
  int a[] = {14, 15};
  int congu;
  int ss[6] = {0};
  int arr[] = {1, 3, 5};
  secret = 3;
  w = 5;
  t = 3;
  for (i = 1; i <= w; i++) {
    sum = 0;
    for (j = 1; j < t; j++) {
      sum += (a[j - 1] * (int)pow(i, j));
    }
    congu = secret + sum;
    if (congu >= 17) {
      congu = congu % 17;
    }
    ss[i] = congu;
  }
  printf("\nShares are : ");
  for (i = 1; i <= w; i++) {
    printf("%d ", ss[i]);
  }
  lagrange(ss, w, arr, 3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x20(%rbp)
mov    0xea3(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
mov    0xe90(%rip),%rax
mov    %rax,-0x5c(%rbp)
mov    0xe8e(%rip),%eax
mov    %eax,-0x54(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1238 <main+0xf8>
movl   $0x0,-0x20(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11fe <main+0xbe>
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x28(%rbp,%rax,4),%eax
mov    %eax,-0x60(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    -0x60(%rbp),%eax
imul   %ecx,%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11bb <main+0x7b>
mov    -0x8(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x11,-0x2c(%rbp)
jl     121f <main+0xdf>
mov    -0x2c(%rbp),%eax
mov    $0x11,%ecx
cltd
idiv   %ecx
mov    %edx,-0x2c(%rbp)
mov    -0x2c(%rbp),%ecx
movslq -0x14(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a1 <main+0x61>
lea    0xdd5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     127d <main+0x13d>
movslq -0x14(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%esi
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    124d <main+0x10d>
lea    -0x50(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x5c(%rbp),%rdx
mov    $0x3,%ecx
call   1060 <lagrange@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
mov    0xebd(%rip),%eax
mov    %eax,0x20(%rsp)
mov    0xeaa(%rip),%rax
mov    %rax,0x18(%rsp)
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <pow@plt>
mov    %eax,%ebx
shl    $0x4,%ebx
sub    %eax,%ebx
sub    %eax,%ebx
mov    $0x1,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,2),%eax
lea    (%rax,%rbx,1),%ecx
lea    (%rbx,%rax,1),%r14d
add    $0x3,%r14d
cmp    $0xe,%ecx
jl     11b9 <main+0x89>
movslq %r14d,%r14
imul   $0x78787879,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rax
add    %ecx,%eax
mov    %eax,%ecx
shl    $0x4,%ecx
add    %eax,%ecx
sub    %ecx,%r14d
mov    %r14d,0x4(%rsp)
mov    $0x2,%edi
mov    $0x1,%esi
call   1040 <pow@plt>
mov    %eax,%ebx
shl    $0x4,%ebx
sub    %eax,%ebx
sub    %eax,%ebx
mov    $0x2,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,2),%eax
lea    (%rax,%rbx,1),%ecx
lea    (%rbx,%rax,1),%r15d
add    $0x3,%r15d
cmp    $0xe,%ecx
jl     121c <main+0xec>
movslq %r15d,%r15
imul   $0x78787879,%r15,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rax
add    %ecx,%eax
mov    %eax,%ecx
shl    $0x4,%ecx
add    %eax,%ecx
sub    %ecx,%r15d
mov    %r15d,0x8(%rsp)
mov    $0x3,%edi
mov    $0x1,%esi
call   1040 <pow@plt>
mov    %eax,%ebx
shl    $0x4,%ebx
sub    %eax,%ebx
sub    %eax,%ebx
mov    $0x3,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,2),%eax
lea    (%rax,%rbx,1),%ecx
lea    (%rbx,%rax,1),%r12d
add    $0x3,%r12d
cmp    $0xe,%ecx
jl     127f <main+0x14f>
movslq %r12d,%r12
imul   $0x78787879,%r12,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rax
add    %ecx,%eax
mov    %eax,%ecx
shl    $0x4,%ecx
add    %eax,%ecx
sub    %ecx,%r12d
mov    %r12d,0xc(%rsp)
mov    $0x4,%edi
mov    $0x1,%esi
call   1040 <pow@plt>
mov    %eax,%ebx
shl    $0x4,%ebx
sub    %eax,%ebx
sub    %eax,%ebx
mov    $0x4,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,2),%eax
lea    (%rax,%rbx,1),%ecx
lea    (%rbx,%rax,1),%r13d
add    $0x3,%r13d
cmp    $0xe,%ecx
jl     12e2 <main+0x1b2>
movslq %r13d,%r13
imul   $0x78787879,%r13,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rax
add    %ecx,%eax
mov    %eax,%ecx
shl    $0x4,%ecx
add    %eax,%ecx
sub    %ecx,%r13d
mov    %r13d,0x10(%rsp)
mov    $0x5,%edi
mov    $0x1,%esi
call   1040 <pow@plt>
mov    %eax,%ebx
shl    $0x4,%ebx
sub    %eax,%ebx
sub    %eax,%ebx
mov    $0x5,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,2),%eax
lea    (%rax,%rbx,1),%ecx
add    %eax,%ebx
add    $0x3,%ebx
cmp    $0xe,%ecx
jl     1341 <main+0x211>
movslq %ebx,%rbx
imul   $0x78787879,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rax
add    %ecx,%eax
mov    %eax,%ecx
shl    $0x4,%ecx
add    %eax,%ecx
sub    %ecx,%ebx
mov    %ebx,0x14(%rsp)
lea    0xcc0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xcc1(%rip),%rbp
mov    %rbp,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rdi
lea    0x18(%rsp),%rdx
mov    $0x5,%esi
mov    $0x3,%ecx
call   1050 <lagrange@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@__const.main.arr = [3 x i32] [i32 1, i32 3, i32 5]
@.str = [15 x i8] c"\0AShares are : \00"
@.str.1 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca [6 x i32]
%2 = alloca [3 x i32]
%3 = bitcast [6 x i32]* %1 to i8*
%4 = bitcast [3 x i32]* %2 to i8*
%5 = tail call i64 @pow(i32 1, i32 1)
%6 = trunc i64 %5 to i32
%7 = mul nsw i32 %6, 14
%8 = tail call i64 @pow(i32 1, i32 2)
%9 = trunc i64 %8 to i32
%10 = mul nsw i32 %9, 15
%11 = add nsw i32 %10, %7
%12 = add nsw i32 %11, 3
%13 = icmp sgt i32 %11, 13
%14 = srem i32 %12, 17
%15 = select i1 %13, i32 %14, i32 %12
%16 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 1
store i32 %15, i32* %16
%17 = tail call i64 @pow(i32 2, i32 1)
%18 = trunc i64 %17 to i32
%19 = mul nsw i32 %18, 14
%20 = tail call i64 @pow(i32 2, i32 2)
%21 = trunc i64 %20 to i32
%22 = mul nsw i32 %21, 15
%23 = add nsw i32 %22, %19
%24 = add nsw i32 %23, 3
%25 = icmp sgt i32 %23, 13
%26 = srem i32 %24, 17
%27 = select i1 %25, i32 %26, i32 %24
%28 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 2
store i32 %27, i32* %28
%29 = tail call i64 @pow(i32 3, i32 1)
%30 = trunc i64 %29 to i32
%31 = mul nsw i32 %30, 14
%32 = tail call i64 @pow(i32 3, i32 2)
%33 = trunc i64 %32 to i32
%34 = mul nsw i32 %33, 15
%35 = add nsw i32 %34, %31
%36 = add nsw i32 %35, 3
%37 = icmp sgt i32 %35, 13
%38 = srem i32 %36, 17
%39 = select i1 %37, i32 %38, i32 %36
%40 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 3
store i32 %39, i32* %40
%41 = tail call i64 @pow(i32 4, i32 1)
%42 = trunc i64 %41 to i32
%43 = mul nsw i32 %42, 14
%44 = tail call i64 @pow(i32 4, i32 2)
%45 = trunc i64 %44 to i32
%46 = mul nsw i32 %45, 15
%47 = add nsw i32 %46, %43
%48 = add nsw i32 %47, 3
%49 = icmp sgt i32 %47, 13
%50 = srem i32 %48, 17
%51 = select i1 %49, i32 %50, i32 %48
%52 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 4
store i32 %51, i32* %52
%53 = tail call i64 @pow(i32 5, i32 1)
%54 = trunc i64 %53 to i32
%55 = mul nsw i32 %54, 14
%56 = tail call i64 @pow(i32 5, i32 2)
%57 = trunc i64 %56 to i32
%58 = mul nsw i32 %57, 15
%59 = add nsw i32 %58, %55
%60 = add nsw i32 %59, 3
%61 = icmp sgt i32 %59, 13
%62 = srem i32 %60, 17
%63 = select i1 %61, i32 %62, i32 %60
%64 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 5
store i32 %63, i32* %64
%65 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %39)
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %51)
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %63)
%71 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%72 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%73 = call i32 @lagrange(i32* %71, i32 5, i32* %72, i32 3)
ret i32 0
}