#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 uint8_t;

/* Variables and functions */
int checkSum(int *);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  uint8_t msg[64] = {0xFA, 0x03, 0x00, 0x39, 0x01, 0x00, 0x06, 0xC0, 0X00,
                     0X00, 0X00, 0X00, 0X00, 0x00, 0X00, 0X00, 0X00, 0X00,
                     0X00, 0x00, 0X00, 0X00, 0X00, 0X00, 0X00, 0x00, 0X00,
                     0X00, 0X00, 0X00, 0X00, 0x00, 0X00, 0X00, 0X00, 0X00,
                     0X00, 0x00, 0X00, 0X00, 0X00, 0X00, 0X00, 0x00, 0X00,
                     0X00, 0X00, 0X00, 0X00, 0x00, 0X00, 0X00, 0X00, 0X00,
                     0X00, 0x00, 0X00, 0X00, 0X00, 0X00, 0X00};
  msg[62] = checkSum(msg);
  msg[63] = 0x55;
  msg[64] = 0xa9;
  int i;
  for (i = 0; i <= 64; i++) {
    printf("Msg %i: %i\n", i, msg[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
movl   $0xfa,-0x110(%rbp)
movl   $0x3,-0x10c(%rbp)
movl   $0x39,-0x104(%rbp)
movl   $0x1,-0x100(%rbp)
movl   $0x6,-0xf8(%rbp)
movl   $0xc0,-0xf4(%rbp)
lea    -0x110(%rbp),%rdi
call   1030 <checkSum@plt>
mov    %eax,-0x18(%rbp)
movl   $0x55,-0x14(%rbp)
movl   $0xa9,-0x10(%rbp)
movl   $0x0,-0x114(%rbp)
cmpl   $0x40,-0x114(%rbp)
jg     11f9 <main+0xc9>
mov    -0x114(%rbp),%esi
movslq -0x114(%rbp),%rax
mov    -0x110(%rbp,%rax,4),%edx
lea    0xe20(%rip),%rdi
call   1040 <printf@plt>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    11b8 <main+0x88>
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x108,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movabs $0x3000000fa,%rax
mov    %rax,(%rsp)
movl   $0x39,0xc(%rsp)
movl   $0x1,0x10(%rsp)
movabs $0xc000000006,%rax
mov    %rax,0x18(%rsp)
mov    %rsp,%rdi
call   1030 <checkSum@plt>
mov    %eax,0xf8(%rsp)
movabs $0xa900000055,%rax
mov    %rax,0xfc(%rsp)
xor    %ebx,%ebx
lea    0xe15(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%rsp,%rbx,4),%edx
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x41,%rbx
jne    11f0 <main+0xd0>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Msg %i: %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [64 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [64 x i32]* %2 to i8*
%5 = bitcast i8* %4 to <{ [8 x i32], [56 x i32] }>*
%6 = getelementptr inbounds <{ [8 x i32], [56 x i32] }>, <{ [8 x i32], [56 x i32] }>* %5, i32 0, i32 0
%7 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i32 0, i32 0
store i32 250, i32* %7
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i32 0, i32 1
store i32 3, i32* %8
%9 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i32 0, i32 3
store i32 57, i32* %9
%10 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i32 0, i32 4
store i32 1, i32* %10
%11 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i32 0, i32 6
store i32 6, i32* %11
%12 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i32 0, i32 7
store i32 192, i32* %12
%13 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 0
%14 = call i32 @checkSum(i32* %13)
%15 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 62
store i32 %14, i32* %15
%16 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 63
store i32 85, i32* %16
%17 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 64
store i32 169, i32* %17
store i32 0, i32* %3
br label %18
18: ; preds = %28, %0
%19 = load i32, i32* %3
%20 = icmp sle i32 %19, 64
br i1 %20, label %21, label %31
21: ; preds = %18
%22 = load i32, i32* %3
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %22, i32 %26)
br label %28
28: ; preds = %21
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %18
31: ; preds = %18
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
@.str = [12 x i8] c"Msg %i: %i\0A\00"
define i32 @main() {
%1 = alloca [64 x i32]
%2 = bitcast [64 x i32]* %1 to i8*
%3 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 0
store i32 250, i32* %3
%4 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 1
store i32 3, i32* %4
%5 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 3
store i32 57, i32* %5
%6 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 4
store i32 1, i32* %6
%7 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 6
store i32 6, i32* %7
%8 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 7
store i32 192, i32* %8
%9 = call i32 @checkSum(i32* %3)
%10 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 62
store i32 %9, i32* %10
%11 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 63
store i32 85, i32* %11
%12 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 64
store i32 169, i32* %12
br label %13
13: ; preds = %0, %13
%14 = phi i64 [ 0, %0 ], [ %19, %13 ]
%15 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = trunc i64 %14 to i32
%18 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %16)
%19 = add nuw nsw i64 %14, 1
%20 = icmp eq i64 %19, 65
br i1 %20, label %21, label %13
21: ; preds = %13
ret i32 0
}