#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, double, double,
                           double, double, double, double, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sscanf(char *, char *, int *, double *, double *, double *,
                          double *, double *, double *, int *);
int main(int argc, char *argv[]) {
  FILE *fpin, *fpout;
  int i, gps, flg;
  double acc[3], res[3];
  char line[400];
  if ((fpin = fopen(argv[1], "r")) == NULL) {
    printf("Cannot open acc file!\n");
    exit(0);
  }
  if ((fpout = fopen(argv[2], "w")) == NULL) {
    printf("Cannot open acc file!\n");
    exit(0);
  }
  i = 0;
  while (1) {
    if (fgets(line, 400, fpin) == NULL)
      break;
    sscanf(line, "%d%*s%lf%lf%lf%*f%*f%*f%lf%lf%lf%d", &gps, &acc[0], &acc[1],
           &acc[2], &res[0], &res[1], &res[2], &flg);
    fprintf(fpout, "%10d %25.15e %25.15e %25.15e %25.15e %25.15e %25.15e %d \n",
            gps, acc[0], acc[1], acc[2], res[0], res[1], res[2], flg);
    i++;
  }
  fclose(fpin);
  fclose(fpout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x218,%rsp
movl   $0x0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe67(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    11bf <main+0x4f>
lea    0xe4f(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe4b(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    11f4 <main+0x84>
lea    0xe1a(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
movl   $0x0,-0x2c(%rbp)
lea    -0x200(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x190,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
jne    121f <main+0xaf>
jmp    12b7 <main+0x147>
lea    -0x200(%rbp),%rdi
lea    -0x50(%rbp),%rcx
lea    -0x50(%rbp),%r8
add    $0x8,%r8
lea    -0x50(%rbp),%r9
add    $0x10,%r9
lea    -0x70(%rbp),%rbx
lea    -0x70(%rbp),%r11
add    $0x8,%r11
lea    -0x70(%rbp),%r10
add    $0x10,%r10
lea    0xdc6(%rip),%rsi
lea    -0x30(%rbp),%rdx
lea    -0x34(%rbp),%rax
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1070 <sscanf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%edx
movsd  -0x50(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm3
movsd  -0x68(%rbp),%xmm4
movsd  -0x60(%rbp),%xmm5
mov    -0x34(%rbp),%ecx
lea    0xd9a(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11fb <main+0x8b>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x218,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1e8,%rsp
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe71(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     129f <main+0x12f>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
lea    0xe57(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     129f <main+0x12f>
mov    %rax,%rbx
lea    0x50(%rsp),%rdi
mov    $0x190,%esi
mov    %r14,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     127b <main+0x10b>
lea    0x50(%rsp),%rbp
lea    0xc(%rsp),%r15
lea    0x30(%rsp),%r12
lea    0xe3a(%rip),%r13
nopl   (%rax)
mov    %rbp,%rdi
lea    0xe0a(%rip),%rsi
mov    %r15,%rdx
mov    %r12,%rcx
lea    0x38(%rsp),%r8
lea    0x40(%rsp),%r9
lea    0x8(%rsp),%rax
push   %rax
lea    0x28(%rsp),%rax
push   %rax
lea    0x28(%rsp),%rax
push   %rax
lea    0x28(%rsp),%rax
push   %rax
call   1070 <sscanf@plt>
add    $0x20,%rsp
mov    0xc(%rsp),%edx
movsd  0x30(%rsp),%xmm0
movsd  0x38(%rsp),%xmm1
movsd  0x40(%rsp),%xmm2
movsd  0x10(%rsp),%xmm3
movsd  0x18(%rsp),%xmm4
movsd  0x20(%rsp),%xmm5
mov    0x8(%rsp),%ecx
mov    %rbx,%rdi
mov    %r13,%rsi
call   1060 <fprintf@plt>
mov    %rbp,%rdi
mov    $0x190,%esi
mov    %r14,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
jne    11f0 <main+0x80>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x1e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdbb(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [23 x i8] c"Cannot open acc file!\0A\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [35 x i8] c"%d%*s%lf%lf%lf%*f%*f%*f%lf%lf%lf%d\00"
@.str.4 = [58 x i8] c"%10d %25.15e %25.15e %25.15e %25.15e %25.15e %25.15e %d \0A\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 i32
%10 = alloca i32
%11 = alloca [3 x double]
%12 = alloca [3 x double]
%13 = alloca [400 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %17, i32** %6
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %22
19: ; preds = %2
%20 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @exit(i32 0)
unreachable
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %26, i32** %7
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %31
28: ; preds = %22
%29 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%30 = call i32 @exit(i32 0)
unreachable
31: ; preds = %22
store i32 0, i32* %8
br label %32
32: ; preds = %31, %38
%33 = getelementptr inbounds [400 x i8], [400 x i8]* %13, i64 0, i64 0
%34 = load i32*, i32** %6
%35 = call i32* @fgets(i8* %33, i32 400, i32* %34)
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %38
37: ; preds = %32
br label %65
38: ; preds = %32
%39 = getelementptr inbounds [400 x i8], [400 x i8]* %13, i64 0, i64 0
%40 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%41 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
%42 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 2
%43 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0, i64 0
%44 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0, i64 1
%45 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0, i64 2
%46 = call i32 @sscanf(i8* %39, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32* %9, double* %40, double* %41, double* %42, double* %43, double* %44, double* %45, i32* %10)
%47 = load i32*, i32** %7
%48 = load i32, i32* %9
%49 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%50 = load double, double* %49
%51 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
%52 = load double, double* %51
%53 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 2
%54 = load double, double* %53
%55 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0, i64 0
%56 = load double, double* %55
%57 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0, i64 1
%58 = load double, double* %57
%59 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0, i64 2
%60 = load double, double* %59
%61 = load i32, i32* %10
%62 = call i32 @fprintf(i32* %47, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0), i32 %48, double %50, double %52, double %54, double %56, double %58, double %60, i32 %61)
%63 = load i32, i32* %8
%64 = add nsw i32 %63, 1
store i32 %64, i32* %8
br label %32
65: ; preds = %37
%66 = load i32*, i32** %6
%67 = call i32 @fclose(i32* %66)
%68 = load i32*, i32** %7
%69 = call i32 @fclose(i32* %68)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [35 x i8] c"%d%*s%lf%lf%lf%*f%*f%*f%lf%lf%lf%d\00"
@.str.4 = [58 x i8] c"%10d %25.15e %25.15e %25.15e %25.15e %25.15e %25.15e %d \0A\00"
@str.5 = [22 x i8] c"Cannot open acc file!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [3 x double]
%6 = alloca [3 x double]
%7 = alloca [400 x i8]
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast [3 x double]* %5 to i8*
%11 = bitcast [3 x double]* %6 to i8*
%12 = getelementptr inbounds [400 x i8], [400 x i8]* %7, i64 0, i64 0
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.5, i64 0, i64 0))
%19 = tail call i32 @exit(i32 0)
unreachable
20: ; preds = %2
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = tail call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i32* %23, null
br i1 %24, label %35, label %25
25: ; preds = %20
%26 = call i32* @fgets(i8* %12, i32 400, i32* %15)
%27 = icmp eq i32* %26, null
br i1 %27, label %51, label %28
28: ; preds = %25
%29 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%30 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 1
%31 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
%32 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%33 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
%34 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
br label %38
35: ; preds = %20
%36 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.5, i64 0, i64 0))
%37 = tail call i32 @exit(i32 0)
unreachable
38: ; preds = %28, %38
%39 = call i32 @sscanf(i8* %12, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32* %3, double* %29, double* %30, double* %31, double* %32, double* %33, double* %34, i32* %4)
%40 = load i32, i32* %3
%41 = load double, double* %29
%42 = load double, double* %30
%43 = load double, double* %31
%44 = load double, double* %32
%45 = load double, double* %33
%46 = load double, double* %34
%47 = load i32, i32* %4
%48 = call i32 @fprintf(i32* %23, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0), i32 %40, double %41, double %42, double %43, double %44, double %45, double %46, i32 %47)
%49 = call i32* @fgets(i8* %12, i32 400, i32* %15)
%50 = icmp eq i32* %49, null
br i1 %50, label %51, label %38
51: ; preds = %38, %25
%52 = call i32 @fclose(i32* %15)
%53 = call i32 @fclose(i32* %23)
ret i32 0
}