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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ str_delete(char *, char *, char);
int /*<<< orphan*/ str_replace(char *, char, char);
char **str_split(char *, char);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char **argv) {
  FILE *pf, *pr;
  char str[100];
  char filed[100];
  char nums[100];
  strcpy(filed, argv[1]);
  strcat(filed, ".js");
  pf = fopen(filed, "w");
  pr = fopen(argv[1], "r");
  fprintf(pf, "var mass =[");
  while (fgets(str, 100, pr)) {
    char **strspl = str_split(str, ';');
    memset(nums, 0, sizeof(nums));
    str_delete(strspl[1], nums, '\"');
    str_replace(nums, ',', '.');
    if (nums[0] != '0')
      fprintf(pf, "\n{name:%s,value:%s},", strspl[0], nums);
  }
  fprintf(pf, "\n{name:\"0\",value:0} ]");
  fclose(pf);
  fclose(pr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x100(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x100(%rbp),%rdi
lea    0xe25(%rip),%rsi
call   10c0 <strcat@plt>
lea    -0x100(%rbp),%rdi
lea    0xe16(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe00(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xdee(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
lea    -0x90(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x64,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     12d5 <main+0x135>
lea    -0x90(%rbp),%rdi
mov    $0x3b,%esi
call   1090 <str_split@plt>
mov    %rax,-0x178(%rbp)
lea    -0x170(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
mov    -0x178(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x170(%rbp),%rsi
mov    $0x22,%edx
call   10a0 <str_delete@plt>
lea    -0x170(%rbp),%rdi
mov    $0x2c,%esi
mov    $0x2e,%edx
call   1080 <str_replace@plt>
movsbl -0x170(%rbp),%eax
cmp    $0x30,%eax
je     12d0 <main+0x130>
mov    -0x18(%rbp),%rdi
mov    -0x178(%rbp),%rax
mov    (%rax),%rdx
lea    -0x170(%rbp),%rcx
lea    0xd4b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1221 <main+0x81>
mov    -0x18(%rbp),%rdi
lea    0xd49(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x148,%rsp
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
lea    0xe0(%rsp),%rbp
mov    %rbp,%rdi
call   1030 <strcpy@plt>
lea    0xe21(%rip),%rsi
mov    %rbp,%rdi
call   10c0 <strcat@plt>
lea    0xe16(%rip),%rsi
mov    %rbp,%rdi
call   10b0 <fopen@plt>
mov    %rax,%r14
mov    0x8(%rbx),%rdi
lea    0xe02(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%r15
lea    0xdf5(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10d0 <fwrite@plt>
lea    0x70(%rsp),%rdi
mov    $0x64,%esi
mov    %r15,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     12d3 <main+0x123>
lea    0x70(%rsp),%r12
mov    %rsp,%rbx
lea    0xdc5(%rip),%r13
jmp    1275 <main+0xc5>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    $0x64,%esi
mov    %r15,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     12d3 <main+0x123>
mov    %r12,%rdi
mov    $0x3b,%esi
call   1090 <str_split@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
mov    0x8(%rbp),%rdi
mov    %rbx,%rsi
mov    $0x22,%edx
call   10a0 <str_delete@plt>
mov    %rbx,%rdi
mov    $0x2c,%esi
mov    $0x2e,%edx
call   1080 <str_replace@plt>
cmpb   $0x30,(%rsp)
je     1260 <main+0xb0>
mov    0x0(%rbp),%rdx
mov    %r14,%rdi
mov    %r13,%rsi
mov    %rbx,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    1260 <main+0xb0>
lea    0xd4f(%rip),%rdi
mov    $0x15,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10d0 <fwrite@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x148,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c".js\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [12 x i8] c"var mass =[\00"
@.str.4 = [21 x i8] c"\0A{name:%s,value:%s},\00"
@.str.5 = [22 x i8] c"\0A{name:\220\22,value: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 [100 x i8]
%9 = alloca [100 x i8]
%10 = alloca [100 x i8]
%11 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @strcpy(i8* %12, i8* %15)
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%18 = call i32 @strcat(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%20 = call i32* @fopen(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %20, i32** %6
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %24, i32** %7
%25 = load i32*, i32** %6
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %27
27: ; preds = %55, %2
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%29 = load i32*, i32** %7
%30 = call i64 @fgets(i8* %28, i32 100, i32* %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %56
32: ; preds = %27
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%34 = call i8** @str_split(i8* %33, i8 signext 59)
store i8** %34, i8*** %11
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%36 = call i32 @memset(i8* %35, i32 0, i32 100)
%37 = load i8**, i8*** %11
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%41 = call i32 @str_delete(i8* %39, i8* %40, i8 signext 34)
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%43 = call i32 @str_replace(i8* %42, i8 signext 44, i8 signext 46)
%44 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp ne i32 %46, 48
br i1 %47, label %48, label %55
48: ; preds = %32
%49 = load i32*, i32** %6
%50 = load i8**, i8*** %11
%51 = getelementptr inbounds i8*, i8** %50, i64 0
%52 = load i8*, i8** %51
%53 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%54 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %52, i8* %53)
br label %55
55: ; preds = %48, %32
br label %27
56: ; preds = %27
%57 = load i32*, i32** %6
%58 = call i32 (i32*, i8*, ...) @fprintf(i32* %57, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%59 = load i32*, i32** %6
%60 = call i32 @fclose(i32* %59)
%61 = load i32*, i32** %7
%62 = call i32 @fclose(i32* %61)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c".js\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [12 x i8] c"var mass =[\00"
@.str.4 = [21 x i8] c"\0A{name:%s,value:%s},\00"
@.str.5 = [22 x i8] c"\0A{name:\220\22,value:0} ]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @strcpy(i8* %7, i8* %10)
%12 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%13 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = load i8*, i8** %9
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%16 = call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i64 11, i64 1, i32* %13)
%17 = call i64 @fgets(i8* %6, i32 100, i32* %15)
%18 = icmp eq i64 %17, 0
br i1 %18, label %34, label %19
19: ; preds = %2, %31
%20 = call i8** @str_split(i8* %6, i8 signext 59)
%21 = call i32 @memset(i8* %8, i32 0, i32 100)
%22 = getelementptr inbounds i8*, i8** %20, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @str_delete(i8* %23, i8* %8, i8 signext 34)
%25 = call i32 @str_replace(i8* %8, i8 signext 44, i8 signext 46)
%26 = load i8, i8* %8
%27 = icmp eq i8 %26, 48
br i1 %27, label %31, label %28
28: ; preds = %19
%29 = load i8*, i8** %20
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %29, i8* %8)
br label %31
31: ; preds = %28, %19
%32 = call i64 @fgets(i8* %6, i32 100, i32* %15)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %19
34: ; preds = %31, %2
%35 = call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i64 21, i64 1, i32* %13)
%36 = call i32 @fclose(i32* %13)
%37 = call i32 @fclose(i32* %15)
ret i32 0
}