#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 */
unsigned int mmx_accum_avgdiff();
int /*<<< orphan*/ mmx_avgdiff(unsigned char *, unsigned char *,
                               unsigned char *);
int /*<<< orphan*/ mmx_start_block();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  unsigned char pixels1[9] = {13, 13, 12, 11, 11, 10, 9, 9, 10};
  unsigned char pixels3[8] = {15, 10, 7, 8, 14, 19, 21, 20};
  unsigned char *p1, *p2, *p3;
  unsigned int result;
  p1 = &pixels1[0];
  p2 = &pixels1[1];
  p3 = &pixels3[0];
  printf("%d %d %d %d %d %d %d %d %d\n", p1[0], p1[1], p1[2], p1[3], p1[4],
         p1[5], p1[6], p1[7], p1[8]);
  printf("%d %d %d %d %d %d %d %d\n", p3[0], p3[1], p3[2], p3[3], p3[4], p3[5],
         p3[6], p3[7]);
  printf("-----------------------\n");
  mmx_start_block();
  mmx_avgdiff(p1, p2, p3);
  result = mmx_accum_avgdiff();
  printf("%d %d %d %d %d %d %d %d %d\n", p1[0], p1[1], p1[2], p1[3], p1[4],
         p1[5], p1[6], p1[7], p1[8]);
  printf("%d %d %d %d %d %d %d %d\n", p3[0], p3[1], p3[2], p3[3], p3[4], p3[5],
         p3[6], p3[7]);
  printf("%d\n", result);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x68,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0xea9(%rip),%rax
mov    %rax,-0x21(%rbp)
mov    0xea7(%rip),%al
mov    %al,-0x19(%rbp)
mov    0xe9e(%rip),%rax
mov    %rax,-0x29(%rbp)
lea    -0x21(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x21(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
lea    -0x29(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rax
movzbl (%rax),%esi
mov    -0x38(%rbp),%rax
movzbl 0x1(%rax),%edx
mov    -0x38(%rbp),%rax
movzbl 0x2(%rax),%ecx
mov    -0x38(%rbp),%rax
movzbl 0x3(%rax),%r8d
mov    -0x38(%rbp),%rax
movzbl 0x4(%rax),%r9d
mov    -0x38(%rbp),%rax
movzbl 0x5(%rax),%ebx
mov    -0x38(%rbp),%rax
movzbl 0x6(%rax),%r11d
mov    -0x38(%rbp),%rax
movzbl 0x7(%rax),%r10d
mov    -0x38(%rbp),%rax
movzbl 0x8(%rax),%eax
lea    0xe34(%rip),%rdi
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%rax
movzbl (%rax),%esi
mov    -0x48(%rbp),%rax
movzbl 0x1(%rax),%edx
mov    -0x48(%rbp),%rax
movzbl 0x2(%rax),%ecx
mov    -0x48(%rbp),%rax
movzbl 0x3(%rax),%r8d
mov    -0x48(%rbp),%rax
movzbl 0x4(%rax),%r9d
mov    -0x48(%rbp),%rax
movzbl 0x5(%rax),%r11d
mov    -0x48(%rbp),%rax
movzbl 0x6(%rax),%r10d
mov    -0x48(%rbp),%rax
movzbl 0x7(%rax),%eax
lea    0xdd5(%rip),%rdi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdd3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <mmx_start_block@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%rdx
call   1060 <mmx_avgdiff@plt>
mov    $0x0,%al
call   1050 <mmx_accum_avgdiff@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x38(%rbp),%rax
movzbl (%rax),%esi
mov    -0x38(%rbp),%rax
movzbl 0x1(%rax),%edx
mov    -0x38(%rbp),%rax
movzbl 0x2(%rax),%ecx
mov    -0x38(%rbp),%rax
movzbl 0x3(%rax),%r8d
mov    -0x38(%rbp),%rax
movzbl 0x4(%rax),%r9d
mov    -0x38(%rbp),%rax
movzbl 0x5(%rax),%ebx
mov    -0x38(%rbp),%rax
movzbl 0x6(%rax),%r11d
mov    -0x38(%rbp),%rax
movzbl 0x7(%rax),%r10d
mov    -0x38(%rbp),%rax
movzbl 0x8(%rax),%eax
lea    0xd3c(%rip),%rdi
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%rax
movzbl (%rax),%esi
mov    -0x48(%rbp),%rax
movzbl 0x1(%rax),%edx
mov    -0x48(%rbp),%rax
movzbl 0x2(%rax),%ecx
mov    -0x48(%rbp),%rax
movzbl 0x3(%rax),%r8d
mov    -0x48(%rbp),%rax
movzbl 0x4(%rax),%r9d
mov    -0x48(%rbp),%rax
movzbl 0x5(%rax),%r11d
mov    -0x48(%rbp),%rax
movzbl 0x6(%rax),%r10d
mov    -0x48(%rbp),%rax
movzbl 0x7(%rax),%eax
lea    0xcdd(%rip),%rdi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4c(%rbp),%esi
lea    0xcd4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
movabs $0x9090a0b0b0c0d0d,%rax
0a 09 09
mov    %rax,0x8(%rsp)
movb   $0xa,0x10(%rsp)
movabs $0x1415130e08070a0f,%rax
13 15 14
mov    %rax,0x18(%rsp)
lea    0x9(%rsp),%rbp
lea    0xe7e(%rip),%r15
mov    %r15,%rdi
mov    $0xd,%esi
mov    $0xd,%edx
mov    $0xc,%ecx
mov    $0xb,%r8d
mov    $0xb,%r9d
xor    %eax,%eax
push   $0xa
push   $0x9
push   $0x9
push   $0xa
call   1040 <printf@plt>
add    $0x18,%rsp
lea    0xe49(%rip),%r14
mov    %r14,%rdi
mov    $0xf,%esi
mov    $0xa,%edx
mov    $0x7,%ecx
mov    $0x8,%r8d
mov    $0xe,%r9d
xor    %eax,%eax
push   $0x14
push   $0x15
push   $0x13
call   1040 <printf@plt>
add    $0x20,%rsp
lea    0xe2c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <mmx_start_block@plt>
lea    0x8(%rsp),%rdi
lea    0x18(%rsp),%rdx
mov    %rbp,%rsi
call   1070 <mmx_avgdiff@plt>
xor    %eax,%eax
call   1060 <mmx_accum_avgdiff@plt>
mov    %eax,%r12d
movzbl 0x8(%rsp),%esi
movzbl 0x9(%rsp),%edx
movzbl 0xa(%rsp),%ecx
movzbl 0xb(%rsp),%r8d
movzbl 0xc(%rsp),%r9d
movzbl 0xd(%rsp),%r10d
movzbl 0xe(%rsp),%r11d
movzbl 0xf(%rsp),%ebx
movzbl 0x10(%rsp),%ebp
mov    %r15,%rdi
xor    %eax,%eax
push   %rbp
push   %rbx
push   %r11
push   %r10
call   1040 <printf@plt>
add    $0x20,%rsp
movzbl 0x18(%rsp),%esi
movzbl 0x19(%rsp),%edx
movzbl 0x1a(%rsp),%ecx
movzbl 0x1b(%rsp),%r8d
movzbl 0x1c(%rsp),%r9d
movzbl 0x1d(%rsp),%r10d
movzbl 0x1e(%rsp),%ebx
movzbl 0x1f(%rsp),%ebp
sub    $0x8,%rsp
mov    %r14,%rdi
xor    %eax,%eax
push   %rbp
push   %rbx
push   %r10
call   1040 <printf@plt>
add    $0x20,%rsp
lea    0xd73(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.pixels1 = [9 x i8] c"\0D\0D\0C\0B\0B\0A\09\09\0A"
@__const.main.pixels3 = [8 x i8] c"\0F\0A\07\08\0E\13\15\14"
@.str = [28 x i8] c"%d %d %d %d %d %d %d %d %d\0A\00"
@.str.1 = [25 x i8] c"%d %d %d %d %d %d %d %d\0A\00"
@.str.2 = [25 x i8] c"-----------------------\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [9 x i8]
%6 = alloca [8 x i8]
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%11 = bitcast [9 x i8]* %5 to i8*
%12 = bitcast [8 x i8]* %6 to i8*
%13 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
store i8* %13, i8** %7
%14 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 1
store i8* %14, i8** %8
%15 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
store i8* %15, i8** %9
%16 = load i8*, i8** %7
%17 = getelementptr inbounds i8, i8* %16, i64 0
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = load i8*, i8** %7
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = load i8*, i8** %7
%25 = getelementptr inbounds i8, i8* %24, i64 2
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = load i8*, i8** %7
%29 = getelementptr inbounds i8, i8* %28, i64 3
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = load i8*, i8** %7
%33 = getelementptr inbounds i8, i8* %32, i64 4
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = load i8*, i8** %7
%37 = getelementptr inbounds i8, i8* %36, i64 5
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = load i8*, i8** %7
%41 = getelementptr inbounds i8, i8* %40, i64 6
%42 = load i8, i8* %41
%43 = zext i8 %42 to i32
%44 = load i8*, i8** %7
%45 = getelementptr inbounds i8, i8* %44, i64 7
%46 = load i8, i8* %45
%47 = zext i8 %46 to i32
%48 = load i8*, i8** %7
%49 = getelementptr inbounds i8, i8* %48, i64 8
%50 = load i8, i8* %49
%51 = zext i8 %50 to i32
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %23, i32 %27, i32 %31, i32 %35, i32 %39, i32 %43, i32 %47, i32 %51)
%53 = load i8*, i8** %9
%54 = getelementptr inbounds i8, i8* %53, i64 0
%55 = load i8, i8* %54
%56 = zext i8 %55 to i32
%57 = load i8*, i8** %9
%58 = getelementptr inbounds i8, i8* %57, i64 1
%59 = load i8, i8* %58
%60 = zext i8 %59 to i32
%61 = load i8*, i8** %9
%62 = getelementptr inbounds i8, i8* %61, i64 2
%63 = load i8, i8* %62
%64 = zext i8 %63 to i32
%65 = load i8*, i8** %9
%66 = getelementptr inbounds i8, i8* %65, i64 3
%67 = load i8, i8* %66
%68 = zext i8 %67 to i32
%69 = load i8*, i8** %9
%70 = getelementptr inbounds i8, i8* %69, i64 4
%71 = load i8, i8* %70
%72 = zext i8 %71 to i32
%73 = load i8*, i8** %9
%74 = getelementptr inbounds i8, i8* %73, i64 5
%75 = load i8, i8* %74
%76 = zext i8 %75 to i32
%77 = load i8*, i8** %9
%78 = getelementptr inbounds i8, i8* %77, i64 6
%79 = load i8, i8* %78
%80 = zext i8 %79 to i32
%81 = load i8*, i8** %9
%82 = getelementptr inbounds i8, i8* %81, i64 7
%83 = load i8, i8* %82
%84 = zext i8 %83 to i32
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %56, i32 %60, i32 %64, i32 %68, i32 %72, i32 %76, i32 %80, i32 %84)
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%87 = call i32 (...) @mmx_start_block()
%88 = load i8*, i8** %7
%89 = load i8*, i8** %8
%90 = load i8*, i8** %9
%91 = call i32 @mmx_avgdiff(i8* %88, i8* %89, i8* %90)
%92 = call i32 (...) @mmx_accum_avgdiff()
store i32 %92, i32* %10
%93 = load i8*, i8** %7
%94 = getelementptr inbounds i8, i8* %93, i64 0
%95 = load i8, i8* %94
%96 = zext i8 %95 to i32
%97 = load i8*, i8** %7
%98 = getelementptr inbounds i8, i8* %97, i64 1
%99 = load i8, i8* %98
%100 = zext i8 %99 to i32
%101 = load i8*, i8** %7
%102 = getelementptr inbounds i8, i8* %101, i64 2
%103 = load i8, i8* %102
%104 = zext i8 %103 to i32
%105 = load i8*, i8** %7
%106 = getelementptr inbounds i8, i8* %105, i64 3
%107 = load i8, i8* %106
%108 = zext i8 %107 to i32
%109 = load i8*, i8** %7
%110 = getelementptr inbounds i8, i8* %109, i64 4
%111 = load i8, i8* %110
%112 = zext i8 %111 to i32
%113 = load i8*, i8** %7
%114 = getelementptr inbounds i8, i8* %113, i64 5
%115 = load i8, i8* %114
%116 = zext i8 %115 to i32
%117 = load i8*, i8** %7
%118 = getelementptr inbounds i8, i8* %117, i64 6
%119 = load i8, i8* %118
%120 = zext i8 %119 to i32
%121 = load i8*, i8** %7
%122 = getelementptr inbounds i8, i8* %121, i64 7
%123 = load i8, i8* %122
%124 = zext i8 %123 to i32
%125 = load i8*, i8** %7
%126 = getelementptr inbounds i8, i8* %125, i64 8
%127 = load i8, i8* %126
%128 = zext i8 %127 to i32
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %96, i32 %100, i32 %104, i32 %108, i32 %112, i32 %116, i32 %120, i32 %124, i32 %128)
%130 = load i8*, i8** %9
%131 = getelementptr inbounds i8, i8* %130, i64 0
%132 = load i8, i8* %131
%133 = zext i8 %132 to i32
%134 = load i8*, i8** %9
%135 = getelementptr inbounds i8, i8* %134, i64 1
%136 = load i8, i8* %135
%137 = zext i8 %136 to i32
%138 = load i8*, i8** %9
%139 = getelementptr inbounds i8, i8* %138, i64 2
%140 = load i8, i8* %139
%141 = zext i8 %140 to i32
%142 = load i8*, i8** %9
%143 = getelementptr inbounds i8, i8* %142, i64 3
%144 = load i8, i8* %143
%145 = zext i8 %144 to i32
%146 = load i8*, i8** %9
%147 = getelementptr inbounds i8, i8* %146, i64 4
%148 = load i8, i8* %147
%149 = zext i8 %148 to i32
%150 = load i8*, i8** %9
%151 = getelementptr inbounds i8, i8* %150, i64 5
%152 = load i8, i8* %151
%153 = zext i8 %152 to i32
%154 = load i8*, i8** %9
%155 = getelementptr inbounds i8, i8* %154, i64 6
%156 = load i8, i8* %155
%157 = zext i8 %156 to i32
%158 = load i8*, i8** %9
%159 = getelementptr inbounds i8, i8* %158, i64 7
%160 = load i8, i8* %159
%161 = zext i8 %160 to i32
%162 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %133, i32 %137, i32 %141, i32 %145, i32 %149, i32 %153, i32 %157, i32 %161)
%163 = load i32, i32* %10
%164 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %163)
ret i32 0
}

LLVM IR (-O2):
@__const.main.pixels1 = [9 x i8] c"\0D\0D\0C\0B\0B\0A\09\09\0A"
@.str = [28 x i8] c"%d %d %d %d %d %d %d %d %d\0A\00"
@.str.1 = [25 x i8] c"%d %d %d %d %d %d %d %d\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@str = [24 x i8] c"-----------------------\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [9 x i8]
%4 = alloca i64
%5 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%6 = bitcast i64* %4 to i8*
store i64 1447083806254631439, i64* %4
%7 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 1
%8 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 2
%9 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 3
%10 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 4
%11 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 5
%12 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 6
%13 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 7
%14 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 8
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 13, i32 13, i32 12, i32 11, i32 11, i32 10, i32 9, i32 9, i32 10)
%16 = getelementptr inbounds i8, i8* %6, i64 1
%17 = getelementptr inbounds i8, i8* %6, i64 2
%18 = getelementptr inbounds i8, i8* %6, i64 3
%19 = getelementptr inbounds i8, i8* %6, i64 4
%20 = getelementptr inbounds i8, i8* %6, i64 5
%21 = getelementptr inbounds i8, i8* %6, i64 6
%22 = getelementptr inbounds i8, i8* %6, i64 7
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 15, i32 10, i32 7, i32 8, i32 14, i32 19, i32 21, i32 20)
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%25 = tail call i32 (...) @mmx_start_block()
%26 = call i32 @mmx_avgdiff(i8* %5, i8* %7, i8* %6)
%27 = call i32 (...) @mmx_accum_avgdiff()
%28 = load i8, i8* %5
%29 = zext i8 %28 to i32
%30 = load i8, i8* %7
%31 = zext i8 %30 to i32
%32 = load i8, i8* %8
%33 = zext i8 %32 to i32
%34 = load i8, i8* %9
%35 = zext i8 %34 to i32
%36 = load i8, i8* %10
%37 = zext i8 %36 to i32
%38 = load i8, i8* %11
%39 = zext i8 %38 to i32
%40 = load i8, i8* %12
%41 = zext i8 %40 to i32
%42 = load i8, i8* %13
%43 = zext i8 %42 to i32
%44 = load i8, i8* %14
%45 = zext i8 %44 to i32
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %29, i32 %31, i32 %33, i32 %35, i32 %37, i32 %39, i32 %41, i32 %43, i32 %45)
%47 = load i8, i8* %6
%48 = zext i8 %47 to i32
%49 = load i8, i8* %16
%50 = zext i8 %49 to i32
%51 = load i8, i8* %17
%52 = zext i8 %51 to i32
%53 = load i8, i8* %18
%54 = zext i8 %53 to i32
%55 = load i8, i8* %19
%56 = zext i8 %55 to i32
%57 = load i8, i8* %20
%58 = zext i8 %57 to i32
%59 = load i8, i8* %21
%60 = zext i8 %59 to i32
%61 = load i8, i8* %22
%62 = zext i8 %61 to i32
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %48, i32 %50, i32 %52, i32 %54, i32 %56, i32 %58, i32 %60, i32 %62)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %27)
ret i32 0
}