#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*/ buffer;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int main(int argc, char *argv[]) {
  FILE *in;
  FILE *out;
  in = fopen(argv[1], "r");
  out = fopen(argv[2], "w+");
  int i = 0;
  char buffer[300];
  fprintf(out,
          "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nlong "
          "long int mails[64];\nlong long int acc;\nchar str[10];\nchar "
          "input[12];\nint main(int argc, char* argv[])\n{\n");
  while (fgets(buffer, sizeof(buffer), in) != NULL) {
    if (!(buffer[0] == '\0' || buffer[0] == '#')) {
      fprintf(out, "mails[%d] = %d;\n", i, atoi(buffer));
      i++;
    }
  }
  fprintf(
      out,
      "int counter = 0;int halt = 0;while(!halt){long long int inst = "
      "mails[counter];counter++;unsigned int inst_a = inst/10000%%10;if(inst_a "
      "!= 7){long long int data = inst - (inst_a*10000);switch(inst_a){\ncase "
      "1:\nacc+=data;break;\ncase 2:\nacc-=data;break;\ncase "
      "3:\ndata--;mails[data] = acc;break;\ncase "
      "4:\nif(data!=0){acc=data;}else{acc=atoi(input);}break;\ncase "
      "5:\ndata--;if(!(data > 55)){for(int "
      "i=0;i<9;i++){str[i]=(char)mails[data+i];}str[9] = '\0';}break;\ncase "
      "6:\nif(data==0){printf(str);}else "
      "if(data==1){printf(input);}else{data--;acc-=mails[data];}break;\ncase "
      "8:\nif(data == "
      "0){scanf(\"%%s\",input);}else{data--;acc+=mails[data];}break;\ncase "
      "9:\ncounter=data;break;\ncase "
      "0:\ndata--;printf(\"%%d\",mails[data]);break;}\n}else{halt=1;}\n}"
      "\nprintf(\"\\n\");return 0;}");
  fclose(in);
  fclose(out);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe88(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe72(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe5a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
lea    -0x150(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x12c,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     123c <main+0xec>
movsbl -0x150(%rbp),%eax
cmp    $0x0,%eax
je     1237 <main+0xe7>
movsbl -0x150(%rbp),%eax
cmp    $0x23,%eax
je     1237 <main+0xe7>
mov    -0x20(%rbp),%rax
mov    %rax,-0x160(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x154(%rbp)
lea    -0x150(%rbp),%rdi
call   1070 <atoi@plt>
mov    -0x160(%rbp),%rdi
mov    -0x154(%rbp),%edx
mov    %eax,%ecx
lea    0xe84(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11b2 <main+0x62>
mov    -0x20(%rbp),%rdi
lea    0xe75(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x130,%rsp
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
lea    0xe83(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    0x10(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r14
lea    0xe66(%rip),%rdi
mov    $0xa5,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1080 <fwrite@plt>
mov    %rsp,%rdi
mov    $0x12c,%esi
mov    %rbx,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     121f <main+0xbf>
mov    %rsp,%r15
lea    0xedb(%rip),%r12
xor    %ebp,%ebp
jmp    11f5 <main+0x95>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
mov    $0x12c,%esi
mov    %rbx,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     121f <main+0xbf>
movzbl (%rsp),%eax
test   %al,%al
je     11e0 <main+0x80>
cmp    $0x23,%al
je     11e0 <main+0x80>
mov    %r15,%rdi
call   1070 <atoi@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0x1,%ebp
jmp    11e0 <main+0x80>
lea    0xe96(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [166 x i8] c"#include<stdio.h>\0A#include<string.h>\0A#include<stdlib.h>\0Along long int mails[64];\0Along long int acc;\0Achar str[10];\0Achar input[12];\0Aint main(int argc, char* argv[])\0A{\0A\00"
@.str.3 = [17 x i8] c"mails[%d] = %d;\0A\00"
@.str.4 = [750 x i8] c"int counter = 0;int halt = 0;while(!halt){long long int inst = mails[counter];counter++;unsigned int inst_a = inst/10000%%10;if(inst_a != 7){long long int data = inst - (inst_a*10000);switch(inst_a){\0Acase 1:\0Aacc+=data;break;\0Acase 2:\0Aacc-=data;break;\0Acase 3:\0Adata--;mails[data] = acc;break;\0Acase 4:\0Aif(data!=0){acc=data;}else{acc=atoi(input);}break;\0Acase 5:\0Adata--;if(!(data > 55)){for(int i=0;i<9;i++){str[i]=(char)mails[data+i];}str[9] = '\00';}break;\0Acase 6:\0Aif(data==0){printf(str);}else if(data==1){printf(input);}else{data--;acc-=mails[data];}break;\0Acase 8:\0Aif(data == 0){scanf(\22%%s\22,input);}else{data--;acc+=mails[data];}break;\0Acase 9:\0Acounter=data;break;\0Acase 0:\0Adata--;printf(\22%%d\22,mails[data]);break;}\0A}else{halt=1;}\0A}\0Aprintf(\22\\n\22);return 0;}\00"
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 [300 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %13, i32** %6
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 2
%16 = load i8*, i8** %15
%17 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %17, i32** %7
store i32 0, i32* %8
%18 = load i32*, i32** %7
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %43, %2
%21 = getelementptr inbounds [300 x i8], [300 x i8]* %9, i64 0, i64 0
%22 = load i32*, i32** %6
%23 = call i32* @fgets(i8* %21, i32 300, i32* %22)
%24 = icmp ne i32* %23, null
br i1 %24, label %25, label %44
25: ; preds = %20
%26 = getelementptr inbounds [300 x i8], [300 x i8]* %9, i64 0, i64 0
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 0
br i1 %29, label %43, label %30
30: ; preds = %25
%31 = getelementptr inbounds [300 x i8], [300 x i8]* %9, i64 0, i64 0
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 35
br i1 %34, label %43, label %35
35: ; preds = %30
%36 = load i32*, i32** %7
%37 = load i32, i32* %8
%38 = getelementptr inbounds [300 x i8], [300 x i8]* %9, i64 0, i64 0
%39 = call i32 @atoi(i8* %38)
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %36, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %37, i32 %39)
%41 = load i32, i32* %8
%42 = add nsw i32 %41, 1
store i32 %42, i32* %8
br label %43
43: ; preds = %35, %30, %25
br label %20
44: ; preds = %20
%45 = load i32*, i32** %7
%46 = call i32 (i32*, i8*, ...) @fprintf(i32* %45, i8* getelementptr inbounds ([750 x i8], [750 x i8]* @.str.4, i64 0, i64 0))
%47 = load i32*, i32** %6
%48 = call i32 @fclose(i32* %47)
%49 = load i32*, i32** %7
%50 = call i32 @fclose(i32* %49)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [166 x i8] c"#include<stdio.h>\0A#include<string.h>\0A#include<stdlib.h>\0Along long int mails[64];\0Along long int acc;\0Achar str[10];\0Achar input[12];\0Aint main(int argc, char* argv[])\0A{\0A\00"
@.str.3 = [17 x i8] c"mails[%d] = %d;\0A\00"
@.str.4 = [750 x i8] c"int counter = 0;int halt = 0;while(!halt){long long int inst = mails[counter];counter++;unsigned int inst_a = inst/10000%%10;if(inst_a != 7){long long int data = inst - (inst_a*10000);switch(inst_a){\0Acase 1:\0Aacc+=data;break;\0Acase 2:\0Aacc-=data;break;\0Acase 3:\0Adata--;mails[data] = acc;break;\0Acase 4:\0Aif(data!=0){acc=data;}else{acc=atoi(input);}break;\0Acase 5:\0Adata--;if(!(data > 55)){for(int i=0;i<9;i++){str[i]=(char)mails[data+i];}str[9] = '\00';}break;\0Acase 6:\0Aif(data==0){printf(str);}else if(data==1){printf(input);}else{data--;acc-=mails[data];}break;\0Acase 8:\0Aif(data == 0){scanf(\22%%s\22,input);}else{data--;acc+=mails[data];}break;\0Acase 9:\0Acounter=data;break;\0Acase 0:\0Adata--;printf(\22%%d\22,mails[data]);break;}\0A}else{halt=1;}\0A}\0Aprintf(\22\\n\22);return 0;}\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [300 x i8]
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = tail call i32* @fopen(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.2, i64 0, i64 0), i64 165, i64 1, i32* %9)
%12 = call i32* @fgets(i8* %10, i32 300, i32* %6)
%13 = icmp eq i32* %12, null
br i1 %13, label %25, label %14
14: ; preds = %2, %21
%15 = phi i32 [ %22, %21 ], [ 0, %2 ]
%16 = load i8, i8* %10
switch i8 %16, label %17 [
i8 35, label %21
i8 0, label %21
]
17: ; preds = %14
%18 = call i32 @atoi(i8* %10)
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %15, i32 %18)
%20 = add nsw i32 %15, 1
br label %21
21: ; preds = %14, %14, %17
%22 = phi i32 [ %15, %14 ], [ %20, %17 ], [ %15, %14 ]
%23 = call i32* @fgets(i8* %10, i32 300, i32* %6)
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %14
25: ; preds = %21, %2
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([750 x i8], [750 x i8]* @.str.4, i64 0, i64 0))
%27 = call i32 @fclose(i32* %6)
%28 = call i32 @fclose(i32* %9)
ret i32 0
}