#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_CUR;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc < 2) {
    fprintf(stderr, "用法: %s 文件名...\n", argv[0]);
    return 1;
  }
  int i;
  for (i = 1; i < argc; ++i) {
    FILE *fp = fopen(argv[i], "r+");
    if (!fp) {
      fprintf(stderr, "无法打开文件 %s!\n", argv[i]);
    } else {
      fseek(fp, 0L, SEEK_SET);
      int j;
      for (j = 0; j < 160; ++j) {
        char v;
        fread(&v, sizeof(char), 1, fp);
        fseek(fp, -1L, SEEK_CUR);
        v ^= 0xff;
        fwrite(&v, sizeof(char), 1, fp);
      }
      fclose(fp);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11a8 <main+0x48>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe69(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12b0 <main+0x150>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12a9 <main+0x149>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe4b(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1208 <main+0xa8>
mov    0x2def(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe1e(%rip),%rsi
call   1050 <fprintf@plt>
jmp    1296 <main+0x136>
mov    -0x20(%rbp),%rdi
mov    0x2dbd(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1060 <fseek@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0xa0,-0x24(%rbp)
jge    128d <main+0x12d>
mov    -0x20(%rbp),%rcx
lea    -0x25(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
mov    -0x20(%rbp),%rdi
mov    0x2d97(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffffffffffff,%rsi
call   1060 <fseek@plt>
movsbl -0x25(%rbp),%eax
xor    $0xff,%eax
mov    %al,-0x25(%rbp)
mov    -0x20(%rbp),%rcx
lea    -0x25(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1080 <fwrite@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1225 <main+0xc5>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
jmp    129b <main+0x13b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11af <main+0x4f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r12
cmp    $0x2,%edi
jge    1199 <main+0x39>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
mov    (%r12),%rdx
lea    0xe76(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%eax
jmp    126a <main+0x10a>
mov    %edi,%eax
mov    %rax,0x10(%rsp)
mov    $0x1,%r15d
lea    0xf(%rsp),%r13
mov    0x2e36(%rip),%r14
jmp    11e8 <main+0x88>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
mov    (%r12,%r15,8),%rdx
lea    0xe48(%rip),%rsi
call   1060 <fprintf@plt>
add    $0x1,%r15
cmp    0x10(%rsp),%r15
je     1268 <main+0x108>
mov    (%r12,%r15,8),%rdi
lea    0xe26(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     11c0 <main+0x60>
mov    %rax,%rbx
mov    0x2dc9(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <fseek@plt>
mov    $0xa0,%ebp
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
mov    (%r14),%edx
mov    %rbx,%rdi
mov    $0xffffffffffffffff,%rsi
call   1070 <fseek@plt>
movsbl 0xf(%rsp),%edi
not    %edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
add    $0xffffffff,%ebp
jne    1220 <main+0xc0>
mov    %rbx,%rdi
call   1040 <fclose@plt>
jmp    11d9 <main+0x79>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"\E7\94\A8\E6\B3\95: %s \E6\96\87\E4\BB\B6\E5\90\8D...\0A\00"
@.str.1 = [3 x i8] c"r+\00"
@.str.2 = [24 x i8] c"\E6\97\A0\E6\B3\95\E6\89\93\E5\BC\80\E6\96\87\E4\BB\B6 %s!\0A\00"
@SEEK_SET = global i32 0
@SEEK_CUR = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 1, i32* %3
br label %70
18: ; preds = %2
store i32 1, i32* %6
br label %19
19: ; preds = %66, %18
%20 = load i32, i32* %6
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %69
23: ; preds = %19
%24 = load i8**, i8*** %5
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %29, i32** %7
%30 = load i32*, i32** %7
%31 = icmp ne i32* %30, null
br i1 %31, label %40, label %32
32: ; preds = %23
%33 = load i32, i32* @stderr
%34 = load i8**, i8*** %5
%35 = load i32, i32* %6
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %38)
br label %65
40: ; preds = %23
%41 = load i32*, i32** %7
%42 = load i32, i32* @SEEK_SET
%43 = call i32 @fseek(i32* %41, i64 0, i32 %42)
store i32 0, i32* %8
br label %44
44: ; preds = %59, %40
%45 = load i32, i32* %8
%46 = icmp slt i32 %45, 160
br i1 %46, label %47, label %62
47: ; preds = %44
%48 = load i32*, i32** %7
%49 = call i32 @fread(i8* %9, i32 1, i32 1, i32* %48)
%50 = load i32*, i32** %7
%51 = load i32, i32* @SEEK_CUR
%52 = call i32 @fseek(i32* %50, i64 -1, i32 %51)
%53 = load i8, i8* %9
%54 = sext i8 %53 to i32
%55 = xor i32 %54, 255
%56 = trunc i32 %55 to i8
store i8 %56, i8* %9
%57 = load i32*, i32** %7
%58 = call i32 @fwrite(i8* %9, i32 1, i32 1, i32* %57)
br label %59
59: ; preds = %47
%60 = load i32, i32* %8
%61 = add nsw i32 %60, 1
store i32 %61, i32* %8
br label %44
62: ; preds = %44
%63 = load i32*, i32** %7
%64 = call i32 @fclose(i32* %63)
br label %65
65: ; preds = %62, %32
br label %66
66: ; preds = %65
%67 = load i32, i32* %6
%68 = add nsw i32 %67, 1
store i32 %68, i32* %6
br label %19
69: ; preds = %19
store i32 0, i32* %3
br label %70
70: ; preds = %69, %12
%71 = load i32, i32* %3
ret i32 %71
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"\E7\94\A8\E6\B3\95: %s \E6\96\87\E4\BB\B6\E5\90\8D...\0A\00"
@.str.1 = [3 x i8] c"r+\00"
@.str.2 = [24 x i8] c"\E6\97\A0\E6\B3\95\E6\89\93\E5\BC\80\E6\96\87\E4\BB\B6 %s!\0A\00"
@SEEK_SET = global i32 0
@SEEK_CUR = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8
%4 = icmp slt i32 %0, 2
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = zext i32 %0 to i64
br label %11
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %1
%10 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %40
11: ; preds = %5, %37
%12 = phi i64 [ 1, %5 ], [ %38, %37 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %21
17: ; preds = %11
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %13
%20 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %19)
br label %37
21: ; preds = %11
%22 = load i32, i32* @SEEK_SET
%23 = tail call i32 @fseek(i32* %15, i64 0, i32 %22)
br label %24
24: ; preds = %21, %24
%25 = phi i32 [ 0, %21 ], [ %33, %24 ]
%26 = call i32 @fread(i8* %3, i32 1, i32 1, i32* %15)
%27 = load i32, i32* @SEEK_CUR
%28 = tail call i32 @fseek(i32* %15, i64 -1, i32 %27)
%29 = load i8, i8* %3
%30 = xor i8 %29, -1
%31 = sext i8 %30 to i32
%32 = tail call i32 @fputc(i32 %31, i32* %15)
%33 = add nuw nsw i32 %25, 1
%34 = icmp eq i32 %33, 160
br i1 %34, label %35, label %24
35: ; preds = %24
%36 = tail call i32 @fclose(i32* %15)
br label %37
37: ; preds = %35, %17
%38 = add nuw nsw i64 %12, 1
%39 = icmp eq i64 %38, %6
br i1 %39, label %40, label %11
40: ; preds = %37, %7
%41 = phi i32 [ 1, %7 ], [ 0, %37 ]
ret i32 %41
}