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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(unsigned char **, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(unsigned char **, int, int, int /*<<< orphan*/ *);
unsigned char smoothing(unsigned char, unsigned char, unsigned char,
                        unsigned char, unsigned char, unsigned char,
                        unsigned char, unsigned char, unsigned char);
int /*<<< orphan*/ system(char *);
int main() {
  unsigned char image[256][256];
  unsigned char image_smooth[256][256];
  unsigned char image_w[256 / 2][256 / 2] = {0};
  FILE *fp;
  fp = fopen("czp.dat", "rb");
  fread(image, sizeof(unsigned char), 256 * 256, fp);
  fclose(fp);
  for (int i = 1; i < 256 - 1; i++) {
    for (int j = 1; j < 256 - 1; j++) {
      image_smooth[i][j] =
          smoothing(image[i - 1][j - 1], image[i - 1][j], image[i - 1][j + 1],
                    image[i][j - 1], image[i][j], image[i][j + 1],
                    image[i + 1][j - 1], image[i + 1][j], image[i + 1][j + 1]);
    }
  }
  for (int i = 0; i < 256 / 2; i++) {
    for (int j = 0; j < 256 / 2; j++) {
      image_w[i][j] = image_smooth[2 * i][2 * j];
    }
  }
  fp = fopen("czp_smoothing.dat", "wb");
  fwrite(image_w, sizeof(unsigned char), 256 * 256, fp);
  fclose(fp);
  system("zsh plot_ex3.sh");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x24038,%rsp
movl   $0x0,-0xc(%rbp)
lea    -0x24010(%rbp),%rdi
xor    %esi,%esi
mov    $0x4000,%edx
call   1060 <memset@plt>
lea    0xe63(%rip),%rdi
lea    0xe64(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x24018(%rbp)
lea    -0x10010(%rbp),%rdi
mov    -0x24018(%rbp),%rcx
mov    $0x1,%esi
mov    $0x10000,%edx
call   1030 <fread@plt>
mov    -0x24018(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x1,-0x2401c(%rbp)
cmpl   $0xff,-0x2401c(%rbp)
jge    13ea <main+0x27a>
movl   $0x1,-0x24020(%rbp)
cmpl   $0xff,-0x24020(%rbp)
jge    13d1 <main+0x261>
mov    -0x2401c(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x10010(%rbp),%rax
shl    $0x8,%rcx
add    %rcx,%rax
mov    -0x24020(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dil
mov    -0x2401c(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x10010(%rbp),%rax
shl    $0x8,%rcx
add    %rcx,%rax
movslq -0x24020(%rbp),%rcx
mov    (%rax,%rcx,1),%sil
mov    -0x2401c(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x10010(%rbp),%rax
shl    $0x8,%rcx
add    %rcx,%rax
mov    -0x24020(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
movslq -0x2401c(%rbp),%rcx
lea    -0x10010(%rbp),%rax
shl    $0x8,%rcx
add    %rcx,%rax
mov    -0x24020(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x2401c(%rbp),%r8
lea    -0x10010(%rbp),%rax
shl    $0x8,%r8
add    %r8,%rax
movslq -0x24020(%rbp),%r8
mov    (%rax,%r8,1),%r8b
movslq -0x2401c(%rbp),%r9
lea    -0x10010(%rbp),%rax
shl    $0x8,%r9
add    %r9,%rax
mov    -0x24020(%rbp),%r9d
add    $0x1,%r9d
movslq %r9d,%r9
mov    (%rax,%r9,1),%r9b
mov    -0x2401c(%rbp),%eax
add    $0x1,%eax
movslq %eax,%r10
lea    -0x10010(%rbp),%rax
shl    $0x8,%r10
add    %r10,%rax
mov    -0x24020(%rbp),%r10d
sub    $0x1,%r10d
movslq %r10d,%r10
mov    (%rax,%r10,1),%bl
mov    -0x2401c(%rbp),%eax
add    $0x1,%eax
movslq %eax,%r10
lea    -0x10010(%rbp),%rax
shl    $0x8,%r10
add    %r10,%rax
movslq -0x24020(%rbp),%r10
mov    (%rax,%r10,1),%r11b
mov    -0x2401c(%rbp),%eax
add    $0x1,%eax
movslq %eax,%r10
lea    -0x10010(%rbp),%rax
shl    $0x8,%r10
add    %r10,%rax
mov    -0x24020(%rbp),%r10d
add    $0x1,%r10d
movslq %r10d,%r10
movzbl %dil,%edi
movzbl %sil,%esi
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl %r9b,%r9d
movzbl %bl,%ebx
mov    %ebx,(%rsp)
movzbl %r11b,%r11d
mov    %r11d,0x8(%rsp)
movzbl (%rax,%r10,1),%eax
mov    %eax,0x10(%rsp)
call   1090 <smoothing@plt>
mov    %al,%dl
movslq -0x2401c(%rbp),%rcx
lea    -0x20010(%rbp),%rax
shl    $0x8,%rcx
add    %rcx,%rax
movslq -0x24020(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x24020(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24020(%rbp)
jmp    11fd <main+0x8d>
jmp    13d6 <main+0x266>
mov    -0x2401c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2401c(%rbp)
jmp    11e3 <main+0x73>
movl   $0x0,-0x24024(%rbp)
cmpl   $0x80,-0x24024(%rbp)
jge    1493 <main+0x323>
movl   $0x0,-0x24028(%rbp)
cmpl   $0x80,-0x24028(%rbp)
jge    147a <main+0x30a>
mov    -0x24024(%rbp),%eax
shl    $0x1,%eax
movslq %eax,%rcx
lea    -0x20010(%rbp),%rax
shl    $0x8,%rcx
add    %rcx,%rax
mov    -0x24028(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
movslq -0x24024(%rbp),%rcx
lea    -0x24010(%rbp),%rax
shl    $0x7,%rcx
add    %rcx,%rax
movslq -0x24028(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x24028(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24028(%rbp)
jmp    140e <main+0x29e>
jmp    147f <main+0x30f>
mov    -0x24024(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24024(%rbp)
jmp    13f4 <main+0x284>
lea    0xb71(%rip),%rdi
lea    0xb7c(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x24018(%rbp)
lea    -0x24010(%rbp),%rdi
mov    -0x24018(%rbp),%rcx
mov    $0x1,%esi
mov    $0x10000,%edx
call   1080 <fwrite@plt>
mov    -0x24018(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xb43(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x24038,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x24028,%rsp
lea    0x20(%rsp),%rdi
mov    $0x4000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0xe77(%rip),%rdi
lea    0xe78(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
lea    0x14020(%rsp),%rdi
mov    $0x1,%esi
mov    $0x10000,%edx
mov    %rax,%rcx
call   1030 <fread@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0x14020(%rsp),%al
mov    0x14021(%rsp),%r14b
mov    0x14120(%rsp),%bl
mov    0x14121(%rsp),%bpl
lea    0x4121(%rsp),%rsi
lea    0x14222(%rsp),%rdi
mov    $0x1,%ecx
nopl   (%rax)
mov    %eax,%r8d
add    $0x1,%rcx
mov    %rcx,0x8(%rsp)
shl    $0x8,%rcx
mov    0x14020(%rsp,%rcx,1),%dl
mov    0x14021(%rsp,%rcx,1),%cl
xor    %r13d,%r13d
mov    %cl,0x3(%rsp)
mov    %ecx,%r15d
mov    %dl,0x4(%rsp)
mov    %bpl,0x5(%rsp)
mov    %bl,0x6(%rsp)
mov    %ebx,%ecx
mov    %rsi,0x18(%rsp)
mov    %rdi,0x10(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14d,%ebx
mov    %ebp,%r12d
mov    %r15d,%eax
mov    %r15b,0x7(%rsp)
movzbl -0x200(%rdi,%r13,1),%r14d
ff ff
movzbl -0x100(%rdi,%r13,1),%ebp
ff ff
movzbl (%rdi,%r13,1),%r15d
sub    $0x8,%rsp
movzbl %al,%r11d
movzbl %dl,%r10d
movzbl %r14b,%edx
movzbl %bpl,%r9d
movzbl %r8b,%edi
movzbl %bl,%esi
movzbl %cl,%ecx
movzbl %r12b,%r8d
push   %r15
push   %r11
push   %r10
call   1090 <smoothing@plt>
mov    0x30(%rsp),%rdi
mov    0x38(%rsp),%rsi
add    $0x20,%rsp
mov    %al,(%rsi,%r13,1)
add    $0x1,%r13
movzbl 0x7(%rsp),%edx
mov    %r12d,%ecx
mov    %ebx,%r8d
cmp    $0xfe,%r13
jne    1250 <main+0xe0>
add    $0x100,%rsi
add    $0x100,%rdi
mov    0x8(%rsp),%rcx
cmp    $0xff,%rcx
mov    0x6(%rsp),%al
mov    0x5(%rsp),%r14b
mov    0x4(%rsp),%bl
mov    0x3(%rsp),%bpl
jne    1200 <main+0x90>
xor    %eax,%eax
movdqa 0xcf8(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movdqa 0x4030(%rsp,%rax,4),%xmm1
pand   %xmm0,%xmm1
movdqa 0x4020(%rsp,%rax,4),%xmm2
pand   %xmm0,%xmm2
packuswb %xmm1,%xmm2
movdqa %xmm2,0x20(%rsp,%rax,1)
movdqa 0x4050(%rsp,%rax,4),%xmm1
pand   %xmm0,%xmm1
movdqa 0x4040(%rsp,%rax,4),%xmm2
pand   %xmm0,%xmm2
packuswb %xmm1,%xmm2
movdqa %xmm2,0x30(%rsp,%rax,1)
movdqa 0x4070(%rsp,%rax,4),%xmm1
pand   %xmm0,%xmm1
movdqa 0x4060(%rsp,%rax,4),%xmm2
pand   %xmm0,%xmm2
packuswb %xmm1,%xmm2
movdqa %xmm2,0x40(%rsp,%rax,1)
movdqa 0x4090(%rsp,%rax,4),%xmm1
pand   %xmm0,%xmm1
movdqa 0x4080(%rsp,%rax,4),%xmm2
pand   %xmm0,%xmm2
packuswb %xmm1,%xmm2
movdqa %xmm2,0x50(%rsp,%rax,1)
movdqa 0x40b0(%rsp,%rax,4),%xmm1
pand   %xmm0,%xmm1
movdqa 0x40a0(%rsp,%rax,4),%xmm2
pand   %xmm0,%xmm2
packuswb %xmm1,%xmm2
movdqa %xmm2,0x60(%rsp,%rax,1)
movdqa 0x40d0(%rsp,%rax,4),%xmm1
pand   %xmm0,%xmm1
movdqa 0x40c0(%rsp,%rax,4),%xmm2
pand   %xmm0,%xmm2
packuswb %xmm1,%xmm2
movdqa %xmm2,0x70(%rsp,%rax,1)
movdqa 0x40f0(%rsp,%rax,4),%xmm1
pand   %xmm0,%xmm1
movdqa 0x40e0(%rsp,%rax,4),%xmm2
pand   %xmm0,%xmm2
packuswb %xmm1,%xmm2
movdqa %xmm2,0x80(%rsp,%rax,1)
movdqa 0x4100(%rsp,%rax,4),%xmm1
pand   %xmm0,%xmm1
packuswb %xmm1,%xmm1
movq   %xmm1,0x90(%rsp,%rax,1)
movzbl 0x4110(%rsp,%rax,4),%ecx
movzbl 0x4112(%rsp,%rax,4),%edx
mov    %cl,0x98(%rsp,%rax,1)
mov    %dl,0x99(%rsp,%rax,1)
movzbl 0x4114(%rsp,%rax,4),%ecx
mov    %cl,0x9a(%rsp,%rax,1)
movzbl 0x4116(%rsp,%rax,4),%ecx
mov    %cl,0x9b(%rsp,%rax,1)
movzbl 0x4118(%rsp,%rax,4),%ecx
mov    %cl,0x9c(%rsp,%rax,1)
movzbl 0x411a(%rsp,%rax,4),%ecx
mov    %cl,0x9d(%rsp,%rax,1)
movzbl 0x411c(%rsp,%rax,4),%ecx
mov    %cl,0x9e(%rsp,%rax,1)
movzbl 0x411e(%rsp,%rax,4),%ecx
mov    %cl,0x9f(%rsp,%rax,1)
sub    $0xffffffffffffff80,%rax
cmp    $0x4000,%rax
jne    1310 <main+0x1a0>
lea    0xb63(%rip),%rdi
lea    0xb6e(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
lea    0x20(%rsp),%rdi
mov    $0x1,%esi
mov    $0x10000,%edx
mov    %rax,%rcx
call   1080 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xb43(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x24028,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"czp.dat\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [18 x i8] c"czp_smoothing.dat\00"
@.str.3 = [3 x i8] c"wb\00"
@.str.4 = [16 x i8] c"zsh plot_ex3.sh\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x [256 x i8]]
%3 = alloca [256 x [256 x i8]]
%4 = alloca [128 x [128 x i8]]
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = bitcast [128 x [128 x i8]]* %4 to i8*
%11 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %5
%12 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 0
%13 = bitcast [256 x i8]* %12 to i8**
%14 = load i32*, i32** %5
%15 = call i32 @fread(i8** %13, i32 1, i32 65536, i32* %14)
%16 = load i32*, i32** %5
%17 = call i32 @fclose(i32* %16)
store i32 1, i32* %6
br label %18
18: ; preds = %112, %0
%19 = load i32, i32* %6
%20 = icmp slt i32 %19, 255
br i1 %20, label %21, label %115
21: ; preds = %18
store i32 1, i32* %7
br label %22
22: ; preds = %108, %21
%23 = load i32, i32* %7
%24 = icmp slt i32 %23, 255
br i1 %24, label %25, label %111
25: ; preds = %22
%26 = load i32, i32* %6
%27 = sub nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %28
%30 = load i32, i32* %7
%31 = sub nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [256 x i8], [256 x i8]* %29, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = load i32, i32* %6
%36 = sub nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %37
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [256 x i8], [256 x i8]* %38, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = load i32, i32* %6
%44 = sub nsw i32 %43, 1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %45
%47 = load i32, i32* %7
%48 = add nsw i32 %47, 1
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [256 x i8], [256 x i8]* %46, i64 0, i64 %49
%51 = load i8, i8* %50
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %53
%55 = load i32, i32* %7
%56 = sub nsw i32 %55, 1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [256 x i8], [256 x i8]* %54, i64 0, i64 %57
%59 = load i8, i8* %58
%60 = load i32, i32* %6
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %61
%63 = load i32, i32* %7
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [256 x i8], [256 x i8]* %62, i64 0, i64 %64
%66 = load i8, i8* %65
%67 = load i32, i32* %6
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %68
%70 = load i32, i32* %7
%71 = add nsw i32 %70, 1
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [256 x i8], [256 x i8]* %69, i64 0, i64 %72
%74 = load i8, i8* %73
%75 = load i32, i32* %6
%76 = add nsw i32 %75, 1
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %77
%79 = load i32, i32* %7
%80 = sub nsw i32 %79, 1
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [256 x i8], [256 x i8]* %78, i64 0, i64 %81
%83 = load i8, i8* %82
%84 = load i32, i32* %6
%85 = add nsw i32 %84, 1
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %86
%88 = load i32, i32* %7
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [256 x i8], [256 x i8]* %87, i64 0, i64 %89
%91 = load i8, i8* %90
%92 = load i32, i32* %6
%93 = add nsw i32 %92, 1
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %94
%96 = load i32, i32* %7
%97 = add nsw i32 %96, 1
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [256 x i8], [256 x i8]* %95, i64 0, i64 %98
%100 = load i8, i8* %99
%101 = call zeroext i8 @smoothing(i8 zeroext %34, i8 zeroext %42, i8 zeroext %51, i8 zeroext %59, i8 zeroext %66, i8 zeroext %74, i8 zeroext %83, i8 zeroext %91, i8 zeroext %100)
%102 = load i32, i32* %6
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %3, i64 0, i64 %103
%105 = load i32, i32* %7
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds [256 x i8], [256 x i8]* %104, i64 0, i64 %106
store i8 %101, i8* %107
br label %108
108: ; preds = %25
%109 = load i32, i32* %7
%110 = add nsw i32 %109, 1
store i32 %110, i32* %7
br label %22
111: ; preds = %22
br label %112
112: ; preds = %111
%113 = load i32, i32* %6
%114 = add nsw i32 %113, 1
store i32 %114, i32* %6
br label %18
115: ; preds = %18
store i32 0, i32* %8
br label %116
116: ; preds = %143, %115
%117 = load i32, i32* %8
%118 = icmp slt i32 %117, 128
br i1 %118, label %119, label %146
119: ; preds = %116
store i32 0, i32* %9
br label %120
120: ; preds = %139, %119
%121 = load i32, i32* %9
%122 = icmp slt i32 %121, 128
br i1 %122, label %123, label %142
123: ; preds = %120
%124 = load i32, i32* %8
%125 = mul nsw i32 2, %124
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %3, i64 0, i64 %126
%128 = load i32, i32* %9
%129 = mul nsw i32 2, %128
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds [256 x i8], [256 x i8]* %127, i64 0, i64 %130
%132 = load i8, i8* %131
%133 = load i32, i32* %8
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %4, i64 0, i64 %134
%136 = load i32, i32* %9
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds [128 x i8], [128 x i8]* %135, i64 0, i64 %137
store i8 %132, i8* %138
br label %139
139: ; preds = %123
%140 = load i32, i32* %9
%141 = add nsw i32 %140, 1
store i32 %141, i32* %9
br label %120
142: ; preds = %120
br label %143
143: ; preds = %142
%144 = load i32, i32* %8
%145 = add nsw i32 %144, 1
store i32 %145, i32* %8
br label %116
146: ; preds = %116
%147 = call i32* @fopen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %147, i32** %5
%148 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %4, i64 0, i64 0
%149 = bitcast [128 x i8]* %148 to i8**
%150 = load i32*, i32** %5
%151 = call i32 @fwrite(i8** %149, i32 1, i32 65536, i32* %150)
%152 = load i32*, i32** %5
%153 = call i32 @fclose(i32* %152)
%154 = call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"czp.dat\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [18 x i8] c"czp_smoothing.dat\00"
@.str.3 = [3 x i8] c"wb\00"
@.str.4 = [16 x i8] c"zsh plot_ex3.sh\00"
define i32 @main() {
%1 = alloca [256 x [256 x i8]]
%2 = alloca [256 x [256 x i8]]
%3 = alloca [128 x [128 x i8]]
%4 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %1, i64 0, i64 0, i64 0
%5 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 0, i64 0
%6 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %3, i64 0, i64 0, i64 0
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = bitcast [256 x [256 x i8]]* %1 to i8**
%9 = call i32 @fread(i8** %8, i32 1, i32 65536, i32* %7)
%10 = tail call i32 @fclose(i32* %7)
%11 = load i8, i8* %4
%12 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %1, i64 0, i64 0, i64 1
%13 = load i8, i8* %12
%14 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %1, i64 0, i64 1, i64 0
%15 = load i8, i8* %14
%16 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %1, i64 0, i64 1, i64 1
%17 = load i8, i8* %16
br label %18
18: ; preds = %0, %30
%19 = phi i8 [ %17, %0 ], [ %29, %30 ]
%20 = phi i8 [ %15, %0 ], [ %27, %30 ]
%21 = phi i8 [ %13, %0 ], [ %19, %30 ]
%22 = phi i8 [ %11, %0 ], [ %20, %30 ]
%23 = phi i64 [ 1, %0 ], [ %25, %30 ]
%24 = add nsw i64 %23, -1
%25 = add nuw nsw i64 %23, 1
%26 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %1, i64 0, i64 %25, i64 0
%27 = load i8, i8* %26
%28 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %1, i64 0, i64 %25, i64 1
%29 = load i8, i8* %28
br label %32
30: ; preds = %32
%31 = icmp eq i64 %25, 255
br i1 %31, label %50, label %18
32: ; preds = %18, %32
%33 = phi i8 [ %29, %18 ], [ %46, %32 ]
%34 = phi i8 [ %27, %18 ], [ %33, %32 ]
%35 = phi i8 [ %19, %18 ], [ %44, %32 ]
%36 = phi i8 [ %20, %18 ], [ %35, %32 ]
%37 = phi i8 [ %21, %18 ], [ %42, %32 ]
%38 = phi i8 [ %22, %18 ], [ %37, %32 ]
%39 = phi i64 [ 1, %18 ], [ %40, %32 ]
%40 = add nuw nsw i64 %39, 1
%41 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %1, i64 0, i64 %24, i64 %40
%42 = load i8, i8* %41
%43 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %1, i64 0, i64 %23, i64 %40
%44 = load i8, i8* %43
%45 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %1, i64 0, i64 %25, i64 %40
%46 = load i8, i8* %45
%47 = tail call zeroext i8 @smoothing(i8 zeroext %38, i8 zeroext %37, i8 zeroext %42, i8 zeroext %36, i8 zeroext %35, i8 zeroext %44, i8 zeroext %34, i8 zeroext %33, i8 zeroext %46)
%48 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %23, i64 %39
store i8 %47, i8* %48
%49 = icmp eq i64 %40, 255
br i1 %49, label %30, label %32
50: ; preds = %30, %50
%51 = phi i64 [ %125, %50 ], [ 0, %30 ]
%52 = shl nuw nsw i64 %51, 1
%53 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %52, i64 0
%54 = bitcast i8* %53 to <32 x i8>*
%55 = load <32 x i8>, <32 x i8>* %54
%56 = shufflevector <32 x i8> %55, <32 x i8> poison, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 16, i32 18, i32 20, i32 22, i32 24, i32 26, i32 28, i32 30>
%57 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %3, i64 0, i64 %51, i64 0
%58 = bitcast i8* %57 to <16 x i8>*
store <16 x i8> %56, <16 x i8>* %58
%59 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %52, i64 32
%60 = bitcast i8* %59 to <32 x i8>*
%61 = load <32 x i8>, <32 x i8>* %60
%62 = shufflevector <32 x i8> %61, <32 x i8> poison, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 16, i32 18, i32 20, i32 22, i32 24, i32 26, i32 28, i32 30>
%63 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %3, i64 0, i64 %51, i64 16
%64 = bitcast i8* %63 to <16 x i8>*
store <16 x i8> %62, <16 x i8>* %64
%65 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %52, i64 64
%66 = bitcast i8* %65 to <32 x i8>*
%67 = load <32 x i8>, <32 x i8>* %66
%68 = shufflevector <32 x i8> %67, <32 x i8> poison, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 16, i32 18, i32 20, i32 22, i32 24, i32 26, i32 28, i32 30>
%69 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %3, i64 0, i64 %51, i64 32
%70 = bitcast i8* %69 to <16 x i8>*
store <16 x i8> %68, <16 x i8>* %70
%71 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %52, i64 96
%72 = bitcast i8* %71 to <32 x i8>*
%73 = load <32 x i8>, <32 x i8>* %72
%74 = shufflevector <32 x i8> %73, <32 x i8> poison, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 16, i32 18, i32 20, i32 22, i32 24, i32 26, i32 28, i32 30>
%75 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %3, i64 0, i64 %51, i64 48
%76 = bitcast i8* %75 to <16 x i8>*
store <16 x i8> %74, <16 x i8>* %76
%77 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %52, i64 128
%78 = bitcast i8* %77 to <32 x i8>*
%79 = load <32 x i8>, <32 x i8>* %78
%80 = shufflevector <32 x i8> %79, <32 x i8> poison, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 16, i32 18, i32 20, i32 22, i32 24, i32 26, i32 28, i32 30>
%81 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %3, i64 0, i64 %51, i64 64
%82 = bitcast i8* %81 to <16 x i8>*
store <16 x i8> %80, <16 x i8>* %82
%83 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %52, i64 160
%84 = bitcast i8* %83 to <32 x i8>*
%85 = load <32 x i8>, <32 x i8>* %84
%86 = shufflevector <32 x i8> %85, <32 x i8> poison, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 16, i32 18, i32 20, i32 22, i32 24, i32 26, i32 28, i32 30>
%87 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %3, i64 0, i64 %51, i64 80
%88 = bitcast i8* %87 to <16 x i8>*
store <16 x i8> %86, <16 x i8>* %88
%89 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %52, i64 192
%90 = bitcast i8* %89 to <32 x i8>*
%91 = load <32 x i8>, <32 x i8>* %90
%92 = shufflevector <32 x i8> %91, <32 x i8> poison, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 16, i32 18, i32 20, i32 22, i32 24, i32 26, i32 28, i32 30>
%93 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %3, i64 0, i64 %51, i64 96
%94 = bitcast i8* %93 to <16 x i8>*
store <16 x i8> %92, <16 x i8>* %94
%95 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %52, i64 224
%96 = bitcast i8* %95 to <16 x i8>*
%97 = load <16 x i8>, <16 x i8>* %96
%98 = shufflevector <16 x i8> %97, <16 x i8> poison, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14>
%99 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %3, i64 0, i64 %51, i64 112
%100 = bitcast i8* %99 to <8 x i8>*
store <8 x i8> %98, <8 x i8>* %100
%101 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %52, i64 240
%102 = load i8, i8* %101
%103 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %3, i64 0, i64 %51, i64 120
store i8 %102, i8* %103
%104 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %52, i64 242
%105 = load i8, i8* %104
%106 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %3, i64 0, i64 %51, i64 121
store i8 %105, i8* %106
%107 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %52, i64 244
%108 = load i8, i8* %107
%109 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %3, i64 0, i64 %51, i64 122
store i8 %108, i8* %109
%110 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %52, i64 246
%111 = load i8, i8* %110
%112 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %3, i64 0, i64 %51, i64 123
store i8 %111, i8* %112
%113 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %52, i64 248
%114 = load i8, i8* %113
%115 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %3, i64 0, i64 %51, i64 124
store i8 %114, i8* %115
%116 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %52, i64 250
%117 = load i8, i8* %116
%118 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %3, i64 0, i64 %51, i64 125
store i8 %117, i8* %118
%119 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %52, i64 252
%120 = load i8, i8* %119
%121 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %3, i64 0, i64 %51, i64 126
store i8 %120, i8* %121
%122 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %2, i64 0, i64 %52, i64 254
%123 = load i8, i8* %122
%124 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %3, i64 0, i64 %51, i64 127
store i8 %123, i8* %124
%125 = add nuw nsw i64 %51, 1
%126 = icmp eq i64 %125, 128
br i1 %126, label %127, label %50
127: ; preds = %50
%128 = tail call i32* @fopen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%129 = bitcast [128 x [128 x i8]]* %3 to i8**
%130 = call i32 @fwrite(i8** %129, i32 1, i32 65536, i32* %128)
%131 = tail call i32 @fclose(i32* %128)
%132 = tail call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}