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

/* Variables and functions */
int /*<<< orphan*/ F_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/);
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
int main(int argc, char **argv) {
  char buf[10000];
  char *p;
  if (argc != 2) {
    printf("Usage: %s INPUT_FILE\n\n", argv[0]);
    exit(-1);
  }
  if (access(argv[1], F_OK)) {
    printf("Error: INPUT_FILE %s does not exist\n\n", argv[1]);
    exit(-1);
  }
  freopen(argv[1], "r", stdin);
  while (fgets(buf, sizeof(buf), stdin)) {
    p = buf;
    while (*p) {
      if (*p != '\n')
        *p = *p - 7;
      p++;
    }
    printf("%s", buf);
  }
  fclose(stdin);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2730,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11a0 <main+0x40>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe6f(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e21(%rip),%rax
mov    (%rax),%esi
call   1070 <access@plt>
cmp    $0x0,%rax
je     11de <main+0x7e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe48(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2dfb(%rip),%rax
mov    (%rax),%edx
lea    0xe47(%rip),%rsi
call   1050 <freopen@plt>
lea    -0x2720(%rbp),%rdi
mov    0x2ddf(%rip),%rax
mov    (%rax),%edx
mov    $0x2710,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     1297 <main+0x137>
lea    -0x2720(%rbp),%rax
mov    %rax,-0x2728(%rbp)
mov    -0x2728(%rbp),%rax
cmpb   $0x0,(%rax)
je     127f <main+0x11f>
mov    -0x2728(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     1268 <main+0x108>
mov    -0x2728(%rbp),%rax
movsbl (%rax),%eax
sub    $0x7,%eax
mov    %al,%cl
mov    -0x2728(%rbp),%rax
mov    %cl,(%rax)
mov    -0x2728(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x2728(%rbp)
jmp    122d <main+0xcd>
lea    -0x2720(%rbp),%rsi
lea    0xdb2(%rip),%rdi
call   1040 <printf@plt>
jmp    11fb <main+0x9b>
mov    0x2d4a(%rip),%rax
mov    (%rax),%edi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x2730,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x2710,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    123a <main+0xda>
mov    0x8(%rbx),%rdi
mov    0x2e4d(%rip),%rax
mov    (%rax),%esi
call   1070 <access@plt>
mov    0x8(%rbx),%rcx
test   %rax,%rax
jne    1246 <main+0xe6>
mov    0x2e4a(%rip),%r15
mov    (%r15),%edx
lea    0xe95(%rip),%rsi
mov    %rcx,%rdi
call   1050 <freopen@plt>
mov    (%r15),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x2710,%esi
call   1060 <fgets@plt>
test   %rax,%rax
je     1223 <main+0xc3>
lea    0xe70(%rip),%r14
mov    %rbx,%rcx
jmp    11e4 <main+0x84>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rcx
movzbl (%rcx),%eax
test   %al,%al
je     1200 <main+0xa0>
cmp    $0xa,%al
je     11e0 <main+0x80>
add    $0xf9,%al
mov    %al,(%rcx)
jmp    11e0 <main+0x80>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x2710,%esi
call   1060 <fgets@plt>
mov    %rbx,%rcx
test   %rax,%rax
jne    11e4 <main+0x84>
mov    (%r15),%edi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x2710,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    (%rbx),%rsi
lea    0xdbc(%rip),%rdi
jmp    1250 <main+0xf0>
lea    0xdca(%rip),%rdi
mov    %rcx,%rsi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Usage: %s INPUT_FILE\0A\0A\00"
@F_OK = global i32 0
@.str.1 = [38 x i8] c"Error: INPUT_FILE %s does not exist\0A\0A\00"
@.str.2 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.3 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10000 x i8]
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = call i32 @exit(i32 -1)
unreachable
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = load i32, i32* @F_OK
%21 = call i64 @access(i8* %19, i32 %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %16
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = call i32 @exit(i32 -1)
unreachable
29: ; preds = %16
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = load i32, i32* @stdin
%34 = call i32 @freopen(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %61, %29
%36 = getelementptr inbounds [10000 x i8], [10000 x i8]* %6, i64 0, i64 0
%37 = load i32, i32* @stdin
%38 = call i64 @fgets(i8* %36, i32 10000, i32 %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %64
40: ; preds = %35
%41 = getelementptr inbounds [10000 x i8], [10000 x i8]* %6, i64 0, i64 0
store i8* %41, i8** %7
br label %42
42: ; preds = %58, %40
%43 = load i8*, i8** %7
%44 = load i8, i8* %43
%45 = icmp ne i8 %44, 0
br i1 %45, label %46, label %61
46: ; preds = %42
%47 = load i8*, i8** %7
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp ne i32 %49, 10
br i1 %50, label %51, label %58
51: ; preds = %46
%52 = load i8*, i8** %7
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = sub nsw i32 %54, 7
%56 = trunc i32 %55 to i8
%57 = load i8*, i8** %7
store i8 %56, i8* %57
br label %58
58: ; preds = %51, %46
%59 = load i8*, i8** %7
%60 = getelementptr inbounds i8, i8* %59, i32 1
store i8* %60, i8** %7
br label %42
61: ; preds = %42
%62 = getelementptr inbounds [10000 x i8], [10000 x i8]* %6, i64 0, i64 0
%63 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %62)
br label %35
64: ; preds = %35
%65 = load i32, i32* @stdin
%66 = call i32 @fclose(i32 %65)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Usage: %s INPUT_FILE\0A\0A\00"
@F_OK = global i32 0
@.str.1 = [38 x i8] c"Error: INPUT_FILE %s does not exist\0A\0A\00"
@.str.2 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.3 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [10000 x i8]
%4 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 2
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = tail call i32 @exit(i32 -1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = load i32, i32* @F_OK
%14 = tail call i64 @access(i8* %12, i32 %13)
%15 = icmp eq i64 %14, 0
%16 = load i8*, i8** %11
br i1 %15, label %20, label %17
17: ; preds = %10
%18 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%19 = tail call i32 @exit(i32 -1)
unreachable
20: ; preds = %10
%21 = load i32, i32* @stdin
%22 = tail call i32 @freopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = load i32, i32* @stdin
%24 = call i64 @fgets(i8* %4, i32 10000, i32 %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %40, label %26
26: ; preds = %20, %33
%27 = phi i8* [ %34, %33 ], [ %4, %20 ]
%28 = load i8, i8* %27
switch i8 %28, label %29 [
i8 0, label %35
i8 10, label %31
]
29: ; preds = %26
%30 = add i8 %28, -7
store i8 %30, i8* %27
br label %31
31: ; preds = %26, %29
%32 = getelementptr inbounds i8, i8* %27, i64 1
br label %33
33: ; preds = %31, %35
%34 = phi i8* [ %32, %31 ], [ %4, %35 ]
br label %26
35: ; preds = %26
%36 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%37 = load i32, i32* @stdin
%38 = call i64 @fgets(i8* %4, i32 10000, i32 %37)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %33
40: ; preds = %35, %20
%41 = load i32, i32* @stdin
%42 = call i32 @fclose(i32 %41)
ret i32 0
}