#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 */

/* Variables and functions */
int /*<<< orphan*/ ex_err(char *, char *, int);
int /*<<< orphan*/ ex_fstrncpy(char *, char *, size_t);
int ex_put_init_info(int, int, int, char *);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ sprintf(char *, char *, int);
void nepii(int *idne, int *nproc, int *nproc_in_f, char *ftype, int *ierr,
           size_t ftypelen) {
  char errmsg[256];
  size_t slen = 1;
  char *file_type;
  if (ftypelen != 1) {
    slen = ftypelen;
  }
  file_type = (char *)malloc((slen + 1) * sizeof(char));
  ex_fstrncpy(file_type, ftype, slen);
  if ((*ierr = ex_put_init_info(*idne, *nproc, *nproc_in_f, file_type)) != 0) {
    sprintf(errmsg, "Error: failed to put initial information in file id %d",
            *idne);
    ex_err("nepii", errmsg, -1000);
  }
  free(file_type);
}


x86 assembly (clang, -O0):
<nepii>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movq   $0x1,-0x138(%rbp)
cmpq   $0x1,-0x30(%rbp)
je     11a4 <nepii+0x44>
mov    -0x30(%rbp),%rax
mov    %rax,-0x138(%rbp)
mov    -0x138(%rbp),%rdi
add    $0x1,%rdi
shl    $0x0,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x140(%rbp)
mov    -0x140(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x138(%rbp),%rdx
call   1050 <ex_fstrncpy@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
mov    -0x140(%rbp),%rcx
call   1040 <ex_put_init_info@plt>
mov    -0x28(%rbp),%rcx
mov    %eax,(%rcx)
cmp    $0x0,%eax
je     1234 <nepii+0xd4>
lea    -0x130(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
lea    0xde9(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x130(%rbp),%rsi
lea    0xe0d(%rip),%rdi
mov    $0xfffffc18,%edx
call   1080 <ex_err@plt>
mov    -0x140(%rbp),%rdi
call   1030 <free@plt>
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nepii>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %r9,%rbx
mov    %r8,0x8(%rsp)
mov    %rcx,%r13
mov    %rdx,%rbp
mov    %rsi,%r12
mov    %rdi,%r14
lea    0x1(%r9),%rdi
call   1060 <malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1050 <ex_fstrncpy@plt>
mov    (%r14),%edi
mov    (%r12),%esi
mov    0x0(%rbp),%edx
mov    %r15,%rcx
call   1040 <ex_put_init_info@plt>
mov    0x8(%rsp),%rcx
mov    %eax,(%rcx)
test   %eax,%eax
je     11e7 <nepii+0x87>
mov    (%r14),%edx
lea    0xe3a(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <sprintf@plt>
lea    0xe5d(%rip),%rdi
mov    %rbx,%rsi
mov    $0xfffffc18,%edx
call   1080 <ex_err@plt>
mov    %r15,%rdi
call   1030 <free@plt>
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [55 x i8] c"Error: failed to put initial information in file id %d\00"
@.str.1 = [6 x i8] c"nepii\00"
define void @nepii(i32* %0, i32* %1, i32* %2, i8* %3, i32* %4, i64 %5) {
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca i64
%13 = alloca [256 x i8]
%14 = alloca i64
%15 = alloca i8*
store i32* %0, i32** %7
store i32* %1, i32** %8
store i32* %2, i32** %9
store i8* %3, i8** %10
store i32* %4, i32** %11
store i64 %5, i64* %12
store i64 1, i64* %14
%16 = load i64, i64* %12
%17 = icmp ne i64 %16, 1
br i1 %17, label %18, label %20
18: ; preds = %6
%19 = load i64, i64* %12
store i64 %19, i64* %14
br label %20
20: ; preds = %18, %6
%21 = load i64, i64* %14
%22 = add i64 %21, 1
%23 = mul i64 %22, 1
%24 = call i64 @malloc(i64 %23)
%25 = inttoptr i64 %24 to i8*
store i8* %25, i8** %15
%26 = load i8*, i8** %15
%27 = load i8*, i8** %10
%28 = load i64, i64* %14
%29 = call i32 @ex_fstrncpy(i8* %26, i8* %27, i64 %28)
%30 = load i32*, i32** %7
%31 = load i32, i32* %30
%32 = load i32*, i32** %8
%33 = load i32, i32* %32
%34 = load i32*, i32** %9
%35 = load i32, i32* %34
%36 = load i8*, i8** %15
%37 = call i32 @ex_put_init_info(i32 %31, i32 %33, i32 %35, i8* %36)
%38 = load i32*, i32** %11
store i32 %37, i32* %38
%39 = icmp ne i32 %37, 0
br i1 %39, label %40, label %47
40: ; preds = %20
%41 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%42 = load i32*, i32** %7
%43 = load i32, i32* %42
%44 = call i32 @sprintf(i8* %41, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 %43)
%45 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%46 = call i32 @ex_err(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %45, i32 -1000)
br label %47
47: ; preds = %40, %20
%48 = load i8*, i8** %15
%49 = call i32 @free(i8* %48)
ret void
}

LLVM IR (-O2):
@.str = [55 x i8] c"Error: failed to put initial information in file id %d\00"
@.str.1 = [6 x i8] c"nepii\00"
define void @nepii(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2, i8* %3, i32* nocapture writeonly %4, i64 %5) {
%7 = alloca [256 x i8]
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%9 = add i64 %5, 1
%10 = tail call i64 @malloc(i64 %9)
%11 = inttoptr i64 %10 to i8*
%12 = tail call i32 @ex_fstrncpy(i8* %11, i8* %3, i64 %5)
%13 = load i32, i32* %0
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = tail call i32 @ex_put_init_info(i32 %13, i32 %14, i32 %15, i8* %11)
store i32 %16, i32* %4
%17 = icmp eq i32 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %6
%19 = load i32, i32* %0
%20 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = call i32 @ex_err(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %8, i32 -1000)
br label %22
22: ; preds = %18, %6
%23 = call i32 @free(i8* %11)
ret void
}