#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 */
scalar_t__ EOF;
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  FILE *fp;
  char c;
  if (argc != 2) {
    printf("Usage: %s [FILE]\n", argv[0]);
    return 1;
  }
  fp = fopen(*++argv, "r");
  while (fscanf(fp, "%c", &c) != EOF) {
    switch (c) {
    case 'z':
      printf("0");
      fseek(fp, 3, SEEK_CUR);
      break;
    case 'o':
      printf("1");
      fseek(fp, 2, SEEK_CUR);
      break;
    case 't':
      fscanf(fp, "%c", &c);
      if (c == 'w') {
        printf("2");
        fseek(fp, 1, SEEK_CUR);
      } else {
        printf("3");
        fseek(fp, 3, SEEK_CUR);
      }
      break;
    case 'f':
      fscanf(fp, "%c", &c);
      if (c == 'o')
        printf("4");
      else
        printf("5");
      fseek(fp, 2, SEEK_CUR);
      break;
    case 's':
      fscanf(fp, "%c", &c);
      if (c == 'i') {
        printf("6");
        fseek(fp, 1, SEEK_CUR);
      } else {
        printf("7");
        fseek(fp, 3, SEEK_CUR);
      }
      break;
    case 'e':
      printf("8");
      fseek(fp, 4, SEEK_CUR);
      break;
    case 'n':
      printf("9");
      fseek(fp, 3, SEEK_CUR);
      break;
    }
    if (fscanf(fp, "%c", &c) == EOF || c == '\n')
      printf("\n");
  }
  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)
je     1181 <main+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1428 <main+0x2e8>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xecf(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xebd(%rip),%rsi
lea    -0x19(%rbp),%rdx
call   1040 <fscanf@plt>
mov    0x2e21(%rip),%rcx
cmp    (%rcx),%rax
je     1421 <main+0x2e1>
movsbl -0x19(%rbp),%eax
add    $0xffffff9b,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x15,%eax
ja     13dd <main+0x29d>
mov    -0x28(%rbp),%rax
lea    0xe17(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    0x2ddd(%rip),%rax
mov    (%rax),%edx
mov    $0x3,%esi
call   1050 <fseek@plt>
jmp    13dd <main+0x29d>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    0x2db3(%rip),%rax
mov    (%rax),%edx
mov    $0x2,%esi
call   1050 <fseek@plt>
jmp    13dd <main+0x29d>
mov    -0x18(%rbp),%rdi
lea    0xe1b(%rip),%rsi
lea    -0x19(%rbp),%rdx
call   1040 <fscanf@plt>
movsbl -0x19(%rbp),%eax
cmp    $0x77,%eax
jne    1291 <main+0x151>
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    0x2d68(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%esi
call   1050 <fseek@plt>
jmp    12b6 <main+0x176>
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    0x2d3e(%rip),%rax
mov    (%rax),%edx
mov    $0x3,%esi
call   1050 <fseek@plt>
jmp    13dd <main+0x29d>
mov    -0x18(%rbp),%rdi
lea    0xda6(%rip),%rsi
lea    -0x19(%rbp),%rdx
call   1040 <fscanf@plt>
movsbl -0x19(%rbp),%eax
cmp    $0x6f,%eax
jne    12ef <main+0x1af>
lea    0xd94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12fd <main+0x1bd>
lea    0xd83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    0x2ce0(%rip),%rax
mov    (%rax),%edx
mov    $0x2,%esi
call   1050 <fseek@plt>
jmp    13dd <main+0x29d>
mov    -0x18(%rbp),%rdi
lea    0xd48(%rip),%rsi
lea    -0x19(%rbp),%rdx
call   1040 <fscanf@plt>
movsbl -0x19(%rbp),%eax
cmp    $0x69,%eax
jne    1364 <main+0x224>
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    0x2c95(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%esi
call   1050 <fseek@plt>
jmp    1389 <main+0x249>
lea    0xd12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    0x2c6b(%rip),%rax
mov    (%rax),%edx
mov    $0x3,%esi
call   1050 <fseek@plt>
jmp    13dd <main+0x29d>
lea    0xcea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    0x2c41(%rip),%rax
mov    (%rax),%edx
mov    $0x4,%esi
call   1050 <fseek@plt>
jmp    13dd <main+0x29d>
lea    0xcc2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    0x2c17(%rip),%rax
mov    (%rax),%edx
mov    $0x3,%esi
call   1050 <fseek@plt>
mov    -0x18(%rbp),%rdi
lea    0xc84(%rip),%rsi
lea    -0x19(%rbp),%rdx
call   1040 <fscanf@plt>
mov    0x2be8(%rip),%rcx
cmp    (%rcx),%rax
je     140e <main+0x2ce>
movsbl -0x19(%rbp),%eax
cmp    $0xa,%eax
jne    141c <main+0x2dc>
lea    0xc53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a4 <main+0x64>
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
push   %rax
cmp    $0x2,%edi
jne    12d5 <main+0x185>
mov    0x8(%rsi),%rdi
lea    0xefb(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
lea    0xeee(%rip),%rsi
lea    0x7(%rsp),%rdx
mov    %rax,%rdi
call   1050 <fscanf@plt>
mov    0x2e4e(%rip),%r13
xor    %ecx,%ecx
cmp    0x0(%r13),%rax
je     12ef <main+0x19f>
lea    0xec7(%rip),%r15
lea    0x7(%rsp),%r12
lea    0xe4f(%rip),%r14
jmp    11e2 <main+0x92>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1050 <fscanf@plt>
cmp    0x0(%r13),%rax
je     12ed <main+0x19d>
movsbl 0x7(%rsp),%eax
add    $0xffffff9b,%eax
cmp    $0x15,%eax
ja     12ad <main+0x15d>
mov    $0x3,%ebp
mov    $0x30,%edi
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
mov    $0x4,%ebp
mov    $0x38,%edi
jmp    1295 <main+0x145>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1050 <fscanf@plt>
xor    %eax,%eax
xor    %edi,%edi
cmpb   $0x69,0x7(%rsp)
setne  %al
sete   %dil
xor    $0x37,%edi
jmp    128f <main+0x13f>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1050 <fscanf@plt>
xor    %edi,%edi
cmpb   $0x6f,0x7(%rsp)
sete   %dil
xor    $0x35,%edi
mov    $0x2,%ebp
jmp    1295 <main+0x145>
mov    $0x39,%edi
jmp    1295 <main+0x145>
mov    $0x2,%ebp
mov    $0x31,%edi
jmp    1295 <main+0x145>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1050 <fscanf@plt>
xor    %eax,%eax
xor    %edi,%edi
cmpb   $0x77,0x7(%rsp)
setne  %al
sete   %dil
xor    $0x33,%edi
lea    (%rax,%rax,1),%ebp
add    $0x1,%ebp
call   1030 <putchar@plt>
mov    0x2d47(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1060 <fseek@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1050 <fscanf@plt>
cmp    0x0(%r13),%rax
je     11c0 <main+0x70>
cmpb   $0xa,0x7(%rsp)
jne    11ca <main+0x7a>
jmp    11c0 <main+0x70>
mov    (%rsi),%rsi
lea    0xd79(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ecx
jmp    12ef <main+0x19f>
xor    %ecx,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%c\00"
@EOF = global i64 0
@.str.3 = [2 x i8] c"0\00"
@SEEK_CUR = global i32 0
@.str.4 = [2 x i8] c"1\00"
@.str.5 = [2 x i8] c"2\00"
@.str.6 = [2 x i8] c"3\00"
@.str.7 = [2 x i8] c"4\00"
@.str.8 = [2 x i8] c"5\00"
@.str.9 = [2 x i8] c"6\00"
@.str.10 = [2 x i8] c"7\00"
@.str.11 = [2 x i8] c"8\00"
@.str.12 = [2 x i8] c"9\00"
@.str.13 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%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 %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %13)
store i32 1, i32* %3
br label %109
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i32 1
store i8** %17, i8*** %5
%18 = load i8*, i8** %17
%19 = call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %19, i32** %6
br label %20
20: ; preds = %107, %15
%21 = load i32*, i32** %6
%22 = call i64 @fscanf(i32* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%23 = load i64, i64* @EOF
%24 = icmp ne i64 %22, %23
br i1 %24, label %25, label %108
25: ; preds = %20
%26 = load i8, i8* %7
%27 = sext i8 %26 to i32
switch i32 %27, label %96 [
i32 122, label %28
i32 111, label %33
i32 116, label %38
i32 102, label %55
i32 115, label %69
i32 101, label %86
i32 110, label %91
]
28: ; preds = %25
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%30 = load i32*, i32** %6
%31 = load i32, i32* @SEEK_CUR
%32 = call i32 @fseek(i32* %30, i32 3, i32 %31)
br label %96
33: ; preds = %25
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%35 = load i32*, i32** %6
%36 = load i32, i32* @SEEK_CUR
%37 = call i32 @fseek(i32* %35, i32 2, i32 %36)
br label %96
38: ; preds = %25
%39 = load i32*, i32** %6
%40 = call i64 @fscanf(i32* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%41 = load i8, i8* %7
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 119
br i1 %43, label %44, label %49
44: ; preds = %38
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%46 = load i32*, i32** %6
%47 = load i32, i32* @SEEK_CUR
%48 = call i32 @fseek(i32* %46, i32 1, i32 %47)
br label %54
49: ; preds = %38
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%51 = load i32*, i32** %6
%52 = load i32, i32* @SEEK_CUR
%53 = call i32 @fseek(i32* %51, i32 3, i32 %52)
br label %54
54: ; preds = %49, %44
br label %96
55: ; preds = %25
%56 = load i32*, i32** %6
%57 = call i64 @fscanf(i32* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%58 = load i8, i8* %7
%59 = sext i8 %58 to i32
%60 = icmp eq i32 %59, 111
br i1 %60, label %61, label %63
61: ; preds = %55
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %65
63: ; preds = %55
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %65
65: ; preds = %63, %61
%66 = load i32*, i32** %6
%67 = load i32, i32* @SEEK_CUR
%68 = call i32 @fseek(i32* %66, i32 2, i32 %67)
br label %96
69: ; preds = %25
%70 = load i32*, i32** %6
%71 = call i64 @fscanf(i32* %70, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%72 = load i8, i8* %7
%73 = sext i8 %72 to i32
%74 = icmp eq i32 %73, 105
br i1 %74, label %75, label %80
75: ; preds = %69
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%77 = load i32*, i32** %6
%78 = load i32, i32* @SEEK_CUR
%79 = call i32 @fseek(i32* %77, i32 1, i32 %78)
br label %85
80: ; preds = %69
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%82 = load i32*, i32** %6
%83 = load i32, i32* @SEEK_CUR
%84 = call i32 @fseek(i32* %82, i32 3, i32 %83)
br label %85
85: ; preds = %80, %75
br label %96
86: ; preds = %25
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%88 = load i32*, i32** %6
%89 = load i32, i32* @SEEK_CUR
%90 = call i32 @fseek(i32* %88, i32 4, i32 %89)
br label %96
91: ; preds = %25
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%93 = load i32*, i32** %6
%94 = load i32, i32* @SEEK_CUR
%95 = call i32 @fseek(i32* %93, i32 3, i32 %94)
br label %96
96: ; preds = %25, %91, %86, %85, %65, %54, %33, %28
%97 = load i32*, i32** %6
%98 = call i64 @fscanf(i32* %97, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%99 = load i64, i64* @EOF
%100 = icmp eq i64 %98, %99
br i1 %100, label %105, label %101
101: ; preds = %96
%102 = load i8, i8* %7
%103 = sext i8 %102 to i32
%104 = icmp eq i32 %103, 10
br i1 %104, label %105, label %107
105: ; preds = %101, %96
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
br label %107
107: ; preds = %105, %101
br label %20
108: ; preds = %20
store i32 0, i32* %3
br label %109
109: ; preds = %108, %10
%110 = load i32, i32* %3
ret i32 %110
}

LLVM IR (-O2):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%c\00"
@EOF = global i64 0
@SEEK_CUR = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8
%4 = icmp eq i32 %0, 2
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %57
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = call i64 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%13 = load i64, i64* @EOF
%14 = icmp eq i64 %12, %13
br i1 %14, label %57, label %15
15: ; preds = %8, %53
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
switch i32 %17, label %44 [
i32 122, label %38
i32 111, label %18
i32 116, label %19
i32 102, label %25
i32 115, label %30
i32 101, label %36
i32 110, label %37
]
18: ; preds = %15
br label %38
19: ; preds = %15
%20 = call i64 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%21 = load i8, i8* %3
%22 = icmp eq i8 %21, 119
%23 = select i1 %22, i32 50, i32 51
%24 = select i1 %22, i32 1, i32 3
br label %38
25: ; preds = %15
%26 = call i64 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%27 = load i8, i8* %3
%28 = icmp eq i8 %27, 111
%29 = select i1 %28, i32 52, i32 53
br label %38
30: ; preds = %15
%31 = call i64 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%32 = load i8, i8* %3
%33 = icmp eq i8 %32, 105
%34 = select i1 %33, i32 54, i32 55
%35 = select i1 %33, i32 1, i32 3
br label %38
36: ; preds = %15
br label %38
37: ; preds = %15
br label %38
38: ; preds = %30, %19, %15, %18, %25, %36, %37
%39 = phi i32 [ 57, %37 ], [ 56, %36 ], [ %29, %25 ], [ 49, %18 ], [ 48, %15 ], [ %23, %19 ], [ %34, %30 ]
%40 = phi i32 [ 3, %37 ], [ 4, %36 ], [ 2, %25 ], [ 2, %18 ], [ 3, %15 ], [ %24, %19 ], [ %35, %30 ]
%41 = call i32 @putchar(i32 %39)
%42 = load i32, i32* @SEEK_CUR
%43 = call i32 @fseek(i32* %11, i32 %40, i32 %42)
br label %44
44: ; preds = %38, %15
%45 = call i64 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%46 = load i64, i64* @EOF
%47 = icmp eq i64 %45, %46
%48 = load i8, i8* %3
%49 = icmp eq i8 %48, 10
%50 = select i1 %47, i1 true, i1 %49
br i1 %50, label %51, label %53
51: ; preds = %44
%52 = call i32 @putchar(i32 10)
br label %53
53: ; preds = %44, %51
%54 = call i64 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%55 = load i64, i64* @EOF
%56 = icmp eq i64 %54, %55
br i1 %56, label %57, label %15
57: ; preds = %53, %8, %5
%58 = phi i32 [ 1, %5 ], [ 0, %8 ], [ 0, %53 ]
ret i32 %58
}