#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 EOF;
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
void writeparam_(FILE *fpp, FILE *fpp_param, double *ecutev, int *version) {
  int c;
  int cut;
  fprintf(fpp, "START COMMENT \n");
  cut = 0.8 * *ecutev;
  fprintf(fpp, "%-4d  COARSE \n", cut);
  cut = 0.9 * *ecutev;
  fprintf(fpp, "%-4d  MEDIUM\n", cut);
  cut = *ecutev;
  fprintf(fpp, "%-4d  FINE\n", cut);
  fprintf(fpp, "Pseudopotential generated by OPIUM \n");
  fprintf(fpp,
          "############################################################\n");
  fprintf(fpp, "\n");
  fprintf(fpp,
          "############################################################\n");
  fprintf(fpp,
          "#    Opium Parameter File                                  #\n");
  fprintf(fpp,
          "############################################################\n");
  fprintf(fpp, "\n");
  rewind(fpp_param);
  while ((c = fgetc(fpp_param)) != EOF)
    fputc(c, fpp);
  fprintf(fpp, "END COMMENT \n");
  fprintf(fpp, " 3 %d \n", *version);
}


x86 assembly (clang, -O0):
<writeparam_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xead(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rax
movsd  0xe92(%rip),%xmm0
mulsd  (%rax),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%edx
lea    0xe91(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rax
movsd  0xe5e(%rip),%xmm0
mulsd  (%rax),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%edx
lea    0xe74(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rax
cvttsd2si (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%edx
lea    0xe62(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe5c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe6f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe1c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe4b(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe77(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe27(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xdd4(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <rewind@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x24(%rbp)
mov    0x2d6c(%rip),%rcx
cmp    (%rcx),%eax
je     1295 <writeparam_+0x155>
mov    -0x24(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1050 <fputc@plt>
jmp    1269 <writeparam_+0x129>
mov    -0x8(%rbp),%rdi
lea    0xe4a(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
lea    0xe40(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeparam_>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%r13
lea    0xea4(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   1070 <fwrite@plt>
movsd  (%r12),%xmm0
mulsd  0xe74(%rip),%xmm0
cvttsd2si %xmm0,%edx
lea    0xe89(%rip),%rsi
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <fprintf@plt>
movsd  (%r12),%xmm0
mulsd  0xe59(%rip),%xmm0
cvttsd2si %xmm0,%edx
lea    0xe75(%rip),%rsi
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <fprintf@plt>
cvttsd2si (%r12),%edx
lea    0xe6c(%rip),%rsi
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    0xe67(%rip),%rdi
mov    $0x24,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   1070 <fwrite@plt>
lea    0xe73(%rip),%r12
mov    $0x3d,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %r13,%rcx
call   1070 <fwrite@plt>
mov    $0xa,%edi
mov    %r13,%rsi
call   1050 <fputc@plt>
mov    $0x3d,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %r13,%rcx
call   1070 <fwrite@plt>
lea    0xe73(%rip),%rdi
mov    $0x3d,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   1070 <fwrite@plt>
mov    $0x3d,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %r13,%rcx
call   1070 <fwrite@plt>
mov    $0xa,%edi
mov    %r13,%rsi
call   1050 <fputc@plt>
mov    %r15,%rdi
call   1030 <rewind@plt>
mov    %r15,%rdi
call   1040 <fgetc@plt>
mov    0x2d64(%rip),%rbx
cmp    (%rbx),%eax
je     12a6 <writeparam_+0x156>
nopl   0x0(%rax,%rax,1)
mov    %eax,%edi
mov    %r13,%rsi
call   1050 <fputc@plt>
mov    %r15,%rdi
call   1040 <fgetc@plt>
cmp    (%rbx),%eax
jne    1290 <writeparam_+0x140>
lea    0xe3d(%rip),%rdi
mov    $0xd,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   1070 <fwrite@plt>
mov    (%r14),%edx
lea    0xe2f(%rip),%rsi
mov    %r13,%rdi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1060 <fprintf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"START COMMENT \0A\00"
@.str.1 = [15 x i8] c"%-4d COARSE \0A\00"
@.str.2 = [14 x i8] c"%-4d MEDIUM\0A\00"
@.str.3 = [12 x i8] c"%-4d FINE\0A\00"
@.str.4 = [37 x i8] c"Pseudopotential generated by OPIUM \0A\00"
@.str.5 = [62 x i8] c"############################################################\0A\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [62 x i8] c"# Opium Parameter File #\0A\00"
@EOF = global i32 0
@.str.8 = [14 x i8] c"END COMMENT \0A\00"
@.str.9 = [8 x i8] c" 3 %d \0A\00"
define void @writeparam_(i32* %0, i32* %1, double* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca double*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store double* %2, double** %7
store i32* %3, i32** %8
%11 = load i32*, i32** %5
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%13 = load double*, double** %7
%14 = load double, double* %13
%15 = fmul double 8.000000e-01, %14
%16 = fptosi double %15 to i32
store i32 %16, i32* %10
%17 = load i32*, i32** %5
%18 = load i32, i32* %10
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = load double*, double** %7
%21 = load double, double* %20
%22 = fmul double 9.000000e-01, %21
%23 = fptosi double %22 to i32
store i32 %23, i32* %10
%24 = load i32*, i32** %5
%25 = load i32, i32* %10
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %25)
%27 = load double*, double** %7
%28 = load double, double* %27
%29 = fptosi double %28 to i32
store i32 %29, i32* %10
%30 = load i32*, i32** %5
%31 = load i32, i32* %10
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %31)
%33 = load i32*, i32** %5
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
%35 = load i32*, i32** %5
%36 = call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0))
%37 = load i32*, i32** %5
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%39 = load i32*, i32** %5
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0))
%41 = load i32*, i32** %5
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.7, i64 0, i64 0))
%43 = load i32*, i32** %5
%44 = call i32 (i32*, i8*, ...) @fprintf(i32* %43, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0))
%45 = load i32*, i32** %5
%46 = call i32 (i32*, i8*, ...) @fprintf(i32* %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%47 = load i32*, i32** %6
%48 = call i32 @rewind(i32* %47)
br label %49
49: ; preds = %54, %4
%50 = load i32*, i32** %6
%51 = call i32 @fgetc(i32* %50)
store i32 %51, i32* %9
%52 = load i32, i32* @EOF
%53 = icmp ne i32 %51, %52
br i1 %53, label %54, label %58
54: ; preds = %49
%55 = load i32, i32* %9
%56 = load i32*, i32** %5
%57 = call i32 @fputc(i32 %55, i32* %56)
br label %49
58: ; preds = %49
%59 = load i32*, i32** %5
%60 = call i32 (i32*, i8*, ...) @fprintf(i32* %59, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%61 = load i32*, i32** %5
%62 = load i32*, i32** %8
%63 = load i32, i32* %62
%64 = call i32 (i32*, i8*, ...) @fprintf(i32* %61, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i32 %63)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"START COMMENT \0A\00"
@.str.1 = [15 x i8] c"%-4d COARSE \0A\00"
@.str.2 = [14 x i8] c"%-4d MEDIUM\0A\00"
@.str.3 = [12 x i8] c"%-4d FINE\0A\00"
@.str.4 = [37 x i8] c"Pseudopotential generated by OPIUM \0A\00"
@.str.5 = [62 x i8] c"############################################################\0A\00"
@.str.7 = [62 x i8] c"# Opium Parameter File #\0A\00"
@EOF = global i32 0
@.str.8 = [14 x i8] c"END COMMENT \0A\00"
@.str.9 = [8 x i8] c" 3 %d \0A\00"
define void @writeparam_(i32* nocapture %0, i32* nocapture %1, double* nocapture %2, i32* nocapture %3) {
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 15, i64 1, i32* %0)
%6 = load double, double* %2
%7 = fmul double %6, 8.000000e-01
%8 = fptosi double %7 to i32
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = load double, double* %2
%11 = fmul double %10, 9.000000e-01
%12 = fptosi double %11 to i32
%13 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = load double, double* %2
%15 = fptosi double %14 to i32
%16 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = tail call i64 @fwrite(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i64 36, i64 1, i32* %0)
%18 = tail call i64 @fwrite(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0), i64 61, i64 1, i32* %0)
%19 = tail call i32 @fputc(i32 10, i32* %0)
%20 = tail call i64 @fwrite(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0), i64 61, i64 1, i32* %0)
%21 = tail call i64 @fwrite(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.7, i64 0, i64 0), i64 61, i64 1, i32* %0)
%22 = tail call i64 @fwrite(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0), i64 61, i64 1, i32* %0)
%23 = tail call i32 @fputc(i32 10, i32* %0)
%24 = tail call i32 @rewind(i32* %1)
%25 = tail call i32 @fgetc(i32* %1)
%26 = load i32, i32* @EOF
%27 = icmp eq i32 %25, %26
br i1 %27, label %34, label %28
28: ; preds = %4, %28
%29 = phi i32 [ %31, %28 ], [ %25, %4 ]
%30 = tail call i32 @fputc(i32 %29, i32* %0)
%31 = tail call i32 @fgetc(i32* %1)
%32 = load i32, i32* @EOF
%33 = icmp eq i32 %31, %32
br i1 %33, label %34, label %28
34: ; preds = %28, %4
%35 = tail call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i64 13, i64 1, i32* %0)
%36 = load i32, i32* %3
%37 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i32 %36)
ret void
}