#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);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, int, int, int,
                           double, long double);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *);
int printToPathFile(char *FileName, int x, int y, int z, int ChargeId,
                    double Time, long double GlobalTime) {
  char buf[256];
  snprintf(buf, sizeof buf, "%s%s", FileName, ".path");
  FILE *PathFile;
  if ((PathFile = fopen(buf, "a")) == NULL) {
    printf("ERROR! unable to write .path file!\n");
    exit(1);
  }
  fprintf(PathFile, "%d %d %d %d %g %Le\n", x, y, z, ChargeId, Time,
          GlobalTime);
  fclose(PathFile);
  return 0;
}


x86 assembly (clang, -O0):
<printToPathFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
fldt   0x10(%rbp)
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
fstpt  -0x30(%rbp)
lea    -0x130(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x100,%esi
lea    0xe62(%rip),%rdx
lea    0xe60(%rip),%r8
call   1050 <snprintf@plt>
lea    -0x130(%rbp),%rdi
lea    0xe53(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x138(%rbp)
cmp    $0x0,%rax
jne    11e4 <printToPathFile+0x84>
lea    0xe38(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x138(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
movsd  -0x20(%rbp),%xmm0
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xe24(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x138(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printToPathFile>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x130,%rsp
movsd  %xmm0,0x18(%rsp)
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%ebp
mov    %rdi,%rcx
fldt   0x160(%rsp)
fstpt  0x24(%rsp)
lea    0xe6b(%rip),%rdx
lea    0xe69(%rip),%r8
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1050 <snprintf@plt>
lea    0xe56(%rip),%rsi
mov    %rbx,%rdi
call   1070 <fopen@plt>
test   %rax,%rax
je     1206 <printToPathFile+0xa6>
mov    %rax,%rbx
fldt   0x24(%rsp)
fstpt  (%rsp)
lea    0xe3a(%rip),%rsi
mov    %rax,%rdi
mov    %ebp,%edx
mov    %r12d,%ecx
mov    %r15d,%r8d
mov    %r14d,%r9d
movsd  0x18(%rsp),%xmm0
call   1060 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe14(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [6 x i8] c".path\00"
@.str.2 = [2 x i8] c"a\00"
@.str.3 = [36 x i8] c"ERROR! unable to write .path file!\0A\00"
@.str.4 = [20 x i8] c"%d %d %d %d %g %Le\0A\00"
define i32 @printToPathFile(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, double %5, x86_fp80 %6) {
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
%14 = alloca x86_fp80
%15 = alloca [256 x i8]
%16 = alloca i32*
store i8* %0, i8** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store double %5, double* %13
store x86_fp80 %6, x86_fp80* %14
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%18 = load i8*, i8** %8
%19 = call i32 @snprintf(i8* %17, i32 256, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %21, i32** %16
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %26
23: ; preds = %7
%24 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %7
%27 = load i32*, i32** %16
%28 = load i32, i32* %9
%29 = load i32, i32* %10
%30 = load i32, i32* %11
%31 = load i32, i32* %12
%32 = load double, double* %13
%33 = load x86_fp80, x86_fp80* %14
%34 = call i32 @fprintf(i32* %27, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %28, i32 %29, i32 %30, i32 %31, double %32, x86_fp80 %33)
%35 = load i32*, i32** %16
%36 = call i32 @fclose(i32* %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [6 x i8] c".path\00"
@.str.2 = [2 x i8] c"a\00"
@.str.4 = [20 x i8] c"%d %d %d %d %g %Le\0A\00"
@str = [35 x i8] c"ERROR! unable to write .path file!\00"
define i32 @printToPathFile(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, double %5, x86_fp80 %6) {
%8 = alloca [256 x i8]
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%10 = call i32 @snprintf(i8* %9, i32 256, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %7
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %7
%17 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %1, i32 %2, i32 %3, i32 %4, double %5, x86_fp80 %6)
%18 = call i32 @fclose(i32* %11)
ret i32 0
}