#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*/ D;

/* Variables and functions */
int getmax(int *, int, int, int /*<<< orphan*/, int /*<<< orphan*/, int **);
int /*<<< orphan*/ printf(char *, int);
void main() {
  int D[] = {34, 64, 43, 14, 58, 30, 2,  16, 90, 58, 35, 55, 46, 24, 14, 73, 96,
             13, 9,  42, 64, 36, 89, 42, 42, 64, 52, 68, 53, 76, 52, 54, 23, 88,
             32, 52, 28, 96, 70, 32, 26, 3,  23, 78, 47, 23, 54, 30, 86, 32};
  int len = sizeof(D) / sizeof(D[0]);
  int X = 1328;
  int table[len][2200];
  for (int i = 0; i < len; i++) {
    for (int j = 0; j < 2200; j++) {
      table[i][j] = 0;
    }
  }
  int res = getmax(D, len, X, 0, 0, table);
  printf("max colr chnages is %d", res);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    0xebe(%rip),%rsi
lea    -0xd0(%rbp),%rdi
mov    $0xc8,%edx
call   1050 <memcpy@plt>
movl   $0x32,-0xd4(%rbp)
movl   $0x530,-0xd8(%rbp)
mov    -0xd4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0xe0(%rbp)
imul   $0x2260,%rax,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x100(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xe8(%rbp)
movl   $0x0,-0xec(%rbp)
mov    -0xec(%rbp),%eax
cmp    -0xd4(%rbp),%eax
jge    121e <main+0xee>
movl   $0x0,-0xf0(%rbp)
cmpl   $0x898,-0xf0(%rbp)
jge    1205 <main+0xd5>
mov    -0x100(%rbp),%rax
movslq -0xec(%rbp),%rcx
imul   $0x2260,%rcx,%rcx
add    %rcx,%rax
movslq -0xf0(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0xf0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf0(%rbp)
jmp    11bb <main+0x8b>
jmp    120a <main+0xda>
mov    -0xec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xec(%rbp)
jmp    119f <main+0x6f>
mov    -0x100(%rbp),%r9
lea    -0xd0(%rbp),%rdi
mov    -0xd4(%rbp),%esi
mov    -0xd8(%rbp),%edx
xor    %r8d,%r8d
mov    %r8d,%ecx
call   1030 <getmax@plt>
mov    %eax,-0xf4(%rbp)
mov    -0xf4(%rbp),%esi
lea    0xe72(%rip),%rdi
call   1040 <printf@plt>
mov    -0xe0(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x6b790,%rsp
lea    0xead(%rip),%rsi
mov    %rsp,%r14
mov    $0xc8,%edx
mov    %r14,%rdi
call   1060 <memcpy@plt>
mov    %rsp,%rbx
lea    0xd0(%rsp),%r15
mov    $0x6b6c0,%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
mov    %r14,%rdi
mov    $0x32,%esi
mov    $0x530,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %r15,%r9
call   1030 <getmax@plt>
lea    0xf2a(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rsp
add    $0x6b790,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.D = [50 x i32] [i32 34, i32 64, i32 43, i32 14, i32 58, i32 30, i32 2, i32 16, i32 90, i32 58, i32 35, i32 55, i32 46, i32 24, i32 14, i32 73, i32 96, i32 13, i32 9, i32 42, i32 64, i32 36, i32 89, i32 42, i32 42, i32 64, i32 52, i32 68, i32 53, i32 76, i32 52, i32 54, i32 23, i32 88, i32 32, i32 52, i32 28, i32 96, i32 70, i32 32, i32 26, i32 3, i32 23, i32 78, i32 47, i32 23, i32 54, i32 30, i32 86, i32 32]
@.str = [23 x i8] c"max colr chnages is %d\00"
define void @main() {
%1 = alloca [50 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = bitcast [50 x i32]* %1 to i8*
store i32 50, i32* %2
store i32 1328, i32* %3
%10 = load i32, i32* %2
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %4
%13 = alloca [2200 x i32], i64 %11
store i64 %11, i64* %5
store i32 0, i32* %6
br label %14
14: ; preds = %33, %0
%15 = load i32, i32* %6
%16 = load i32, i32* %2
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %36
18: ; preds = %14
store i32 0, i32* %7
br label %19
19: ; preds = %29, %18
%20 = load i32, i32* %7
%21 = icmp slt i32 %20, 2200
br i1 %21, label %22, label %32
22: ; preds = %19
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [2200 x i32], [2200 x i32]* %13, i64 %24
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [2200 x i32], [2200 x i32]* %25, i64 0, i64 %27
store i32 0, i32* %28
br label %29
29: ; preds = %22
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
store i32 %31, i32* %7
br label %19
32: ; preds = %19
br label %33
33: ; preds = %32
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %14
36: ; preds = %14
%37 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 0
%38 = load i32, i32* %2
%39 = load i32, i32* %3
%40 = bitcast [2200 x i32]* %13 to i32**
%41 = call i32 @getmax(i32* %37, i32 %38, i32 %39, i32 0, i32 0, i32** %40)
store i32 %41, i32* %8
%42 = load i32, i32* %8
%43 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %42)
%44 = load i8*, i8** %4
ret void
}

LLVM IR (-O2):
@__const.main.D = [50 x i32] [i32 34, i32 64, i32 43, i32 14, i32 58, i32 30, i32 2, i32 16, i32 90, i32 58, i32 35, i32 55, i32 46, i32 24, i32 14, i32 73, i32 96, i32 13, i32 9, i32 42, i32 64, i32 36, i32 89, i32 42, i32 42, i32 64, i32 52, i32 68, i32 53, i32 76, i32 52, i32 54, i32 23, i32 88, i32 32, i32 52, i32 28, i32 96, i32 70, i32 32, i32 26, i32 3, i32 23, i32 78, i32 47, i32 23, i32 54, i32 30, i32 86, i32 32]
@.str = [23 x i8] c"max colr chnages is %d\00"
define void @main() {
%1 = alloca [50 x i32]
%2 = bitcast [50 x i32]* %1 to i8*
%3 = tail call i8* @llvm.stacksave()
%4 = alloca [50 x [2200 x i32]]
%5 = bitcast [50 x [2200 x i32]]* %4 to i8*
%6 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 0
%7 = bitcast [50 x [2200 x i32]]* %4 to i32**
%8 = call i32 @getmax(i32* %6, i32 50, i32 1328, i32 0, i32 0, i32** %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %8)
ret void
}