#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*/ SEEK_END;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fileHandle;
void *fopen(char *, char *);
int /*<<< orphan*/ fread(char *, long, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(char *, long, int, int /*<<< orphan*/ *);
char *malloc(int);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    return 0;
  }
  long longBuffer;
  char *charBuffer = NULL;
  {
    FILE *fileHandle = fileHandle = fopen(argv[1], "r");
    {
      fseek(fileHandle, 0, SEEK_END);
      longBuffer = ftell(fileHandle);
      rewind(fileHandle);
    }
    {
      charBuffer = malloc(sizeof(char) * longBuffer);
      fread(charBuffer, longBuffer, 1, fileHandle);
    }
    fclose(fileHandle);
  }
  {
    for (long longFor1 = 0; longFor1 < longBuffer - 3; longFor1 += 1) {
      if (charBuffer[longFor1 + 0] == 'U') {
        if (charBuffer[longFor1 + 1] == 'P') {
          if (charBuffer[longFor1 + 2] == 'X') {
            charBuffer[longFor1 + 0] = 'Z';
            charBuffer[longFor1 + 1] = 'Z';
            charBuffer[longFor1 + 2] = 'Z';
          }
        }
      }
    }
  }
  {
    FILE *fileHandle = fileHandle = fopen(argv[1], "w");
    { fwrite(charBuffer, longBuffer, 1, fileHandle); }
    fclose(fileHandle);
  }
  free(charBuffer);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11bc <main+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    1324 <main+0x194>
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe2d(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    0x2dfd(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <fseek@plt>
mov    -0x28(%rbp),%rdi
call   1070 <ftell@plt>
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rdi
call   1060 <rewind@plt>
mov    -0x18(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rcx
mov    $0x1,%edx
call   1040 <fread@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x3,%rcx
cmp    %rcx,%rax
jge    12e0 <main+0x150>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x55,%eax
jne    12ca <main+0x13a>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsbl 0x1(%rax,%rcx,1),%eax
cmp    $0x50,%eax
jne    12c5 <main+0x135>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsbl 0x2(%rax,%rcx,1),%eax
cmp    $0x58,%eax
jne    12c0 <main+0x130>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movb   $0x5a,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movb   $0x5a,0x1(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movb   $0x5a,0x2(%rax,%rcx,1)
jmp    12c5 <main+0x135>
jmp    12ca <main+0x13a>
jmp    12cf <main+0x13f>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1244 <main+0xb4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd13(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x38(%rbp)
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x38(%rbp),%rcx
mov    $0x1,%edx
call   10b0 <fwrite@plt>
mov    -0x38(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x2,%edi
jl     128e <main+0xfe>
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xe51(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r12
mov    0x2e2a(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
xor    %esi,%esi
call   1090 <fseek@plt>
mov    %r12,%rdi
call   1070 <ftell@plt>
mov    %rax,%r15
mov    %r12,%rdi
call   1060 <rewind@plt>
mov    %r15d,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
mov    %r12,%rcx
call   1040 <fread@plt>
mov    %r12,%rdi
call   1050 <fclose@plt>
cmp    $0x4,%r15
jl     124d <main+0xbd>
mov    %r15,%rax
add    $0xfffffffffffffffd,%rax
xor    %ecx,%ecx
jmp    1225 <main+0x95>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    %rcx,%rax
je     124d <main+0xbd>
mov    %rcx,%rdx
add    $0x1,%rcx
cmpb   $0x55,(%rbx,%rdx,1)
jne    1220 <main+0x90>
cmpb   $0x50,0x1(%rbx,%rdx,1)
jne    1220 <main+0x90>
cmpb   $0x58,0x2(%rbx,%rdx,1)
jne    1220 <main+0x90>
movw   $0x5a5a,(%rbx,%rdx,1)
movb   $0x5a,0x2(%rbx,%rdx,1)
jmp    1220 <main+0x90>
mov    0x8(%r14),%rdi
lea    0xdaa(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
mov    %rax,%rcx
call   10b0 <fwrite@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@SEEK_END = global i32 0
@.str.1 = [2 x i8] c"w\00"
@fileHandle = global i32* null
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i64
%10 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 2
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 0, i32* %3
br label %99
14: ; preds = %2
store i8* null, i8** %7
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i8* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%19 = bitcast i8* %18 to i32*
store i32* %19, i32** %8
store i32* %19, i32** %8
%20 = load i32*, i32** %8
%21 = load i32, i32* @SEEK_END
%22 = call i32 @fseek(i32* %20, i32 0, i32 %21)
%23 = load i32*, i32** %8
%24 = call i64 @ftell(i32* %23)
store i64 %24, i64* %6
%25 = load i32*, i32** %8
%26 = call i32 @rewind(i32* %25)
%27 = load i64, i64* %6
%28 = mul i64 1, %27
%29 = trunc i64 %28 to i32
%30 = call i8* @malloc(i32 %29)
store i8* %30, i8** %7
%31 = load i8*, i8** %7
%32 = load i64, i64* %6
%33 = load i32*, i32** %8
%34 = call i32 @fread(i8* %31, i64 %32, i32 1, i32* %33)
%35 = load i32*, i32** %8
%36 = call i32 @fclose(i32* %35)
store i64 0, i64* %9
br label %37
37: ; preds = %82, %14
%38 = load i64, i64* %9
%39 = load i64, i64* %6
%40 = sub nsw i64 %39, 3
%41 = icmp slt i64 %38, %40
br i1 %41, label %42, label %85
42: ; preds = %37
%43 = load i8*, i8** %7
%44 = load i64, i64* %9
%45 = add nsw i64 %44, 0
%46 = getelementptr inbounds i8, i8* %43, i64 %45
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 85
br i1 %49, label %50, label %81
50: ; preds = %42
%51 = load i8*, i8** %7
%52 = load i64, i64* %9
%53 = add nsw i64 %52, 1
%54 = getelementptr inbounds i8, i8* %51, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 80
br i1 %57, label %58, label %80
58: ; preds = %50
%59 = load i8*, i8** %7
%60 = load i64, i64* %9
%61 = add nsw i64 %60, 2
%62 = getelementptr inbounds i8, i8* %59, i64 %61
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = icmp eq i32 %64, 88
br i1 %65, label %66, label %79
66: ; preds = %58
%67 = load i8*, i8** %7
%68 = load i64, i64* %9
%69 = add nsw i64 %68, 0
%70 = getelementptr inbounds i8, i8* %67, i64 %69
store i8 90, i8* %70
%71 = load i8*, i8** %7
%72 = load i64, i64* %9
%73 = add nsw i64 %72, 1
%74 = getelementptr inbounds i8, i8* %71, i64 %73
store i8 90, i8* %74
%75 = load i8*, i8** %7
%76 = load i64, i64* %9
%77 = add nsw i64 %76, 2
%78 = getelementptr inbounds i8, i8* %75, i64 %77
store i8 90, i8* %78
br label %79
79: ; preds = %66, %58
br label %80
80: ; preds = %79, %50
br label %81
81: ; preds = %80, %42
br label %82
82: ; preds = %81
%83 = load i64, i64* %9
%84 = add nsw i64 %83, 1
store i64 %84, i64* %9
br label %37
85: ; preds = %37
%86 = load i8**, i8*** %5
%87 = getelementptr inbounds i8*, i8** %86, i64 1
%88 = load i8*, i8** %87
%89 = call i8* @fopen(i8* %88, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%90 = bitcast i8* %89 to i32*
store i32* %90, i32** %10
store i32* %90, i32** %10
%91 = load i8*, i8** %7
%92 = load i64, i64* %6
%93 = load i32*, i32** %10
%94 = call i32 @fwrite(i8* %91, i64 %92, i32 1, i32* %93)
%95 = load i32*, i32** %10
%96 = call i32 @fclose(i32* %95)
%97 = load i8*, i8** %7
%98 = call i32 @free(i8* %97)
br label %99
99: ; preds = %85, %13
%100 = load i32, i32* %3
ret i32 %100
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@SEEK_END = global i32 0
@.str.1 = [2 x i8] c"w\00"
@fileHandle = global i32* null
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %44, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i8* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = bitcast i8* %7 to i32*
%9 = load i32, i32* @SEEK_END
%10 = tail call i32 @fseek(i32* %8, i32 0, i32 %9)
%11 = tail call i64 @ftell(i32* %8)
%12 = tail call i32 @rewind(i32* %8)
%13 = trunc i64 %11 to i32
%14 = tail call i8* @malloc(i32 %13)
%15 = tail call i32 @fread(i8* %14, i64 %11, i32 1, i32* %8)
%16 = tail call i32 @fclose(i32* %8)
%17 = add i64 %11, -3
%18 = icmp sgt i64 %11, 3
br i1 %18, label %26, label %19
19: ; preds = %42, %4
%20 = load i8*, i8** %5
%21 = tail call i8* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = bitcast i8* %21 to i32*
%23 = tail call i32 @fwrite(i8* %14, i64 %11, i32 1, i32* %22)
%24 = tail call i32 @fclose(i32* %22)
%25 = tail call i32 @free(i8* %14)
br label %44
26: ; preds = %4, %42
%27 = phi i64 [ %31, %42 ], [ 0, %4 ]
%28 = getelementptr inbounds i8, i8* %14, i64 %27
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 85
%31 = add nuw nsw i64 %27, 1
br i1 %30, label %32, label %42
32: ; preds = %26
%33 = getelementptr inbounds i8, i8* %14, i64 %31
%34 = load i8, i8* %33
%35 = icmp eq i8 %34, 80
br i1 %35, label %36, label %42
36: ; preds = %32
%37 = add nuw nsw i64 %27, 2
%38 = getelementptr inbounds i8, i8* %14, i64 %37
%39 = load i8, i8* %38
%40 = icmp eq i8 %39, 88
br i1 %40, label %41, label %42
41: ; preds = %36
store i8 90, i8* %28
store i8 90, i8* %33
store i8 90, i8* %38
br label %42
42: ; preds = %26, %36, %41, %32
%43 = icmp eq i64 %31, %17
br i1 %43, label %19, label %26
44: ; preds = %2, %19
ret i32 0
}