#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_fcdcpy(char *, size_t, char *);
int ex_get_init_info(int, int *, int *, char *);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ sprintf(char *, char *, int);
void negii(int *idne, int *nproc, int *nproc_in_f, char *ftype, int *ierr,
           size_t ftypelen) {
  size_t slen = 1;
  char *file_type;
  if (ftypelen != 1) {
    slen = ftypelen;
  }
  file_type = (char *)malloc((slen + 1) * sizeof(char));
  if ((*ierr = ex_get_init_info(*idne, nproc, nproc_in_f, file_type)) != 0) {
    char errmsg[256];
    sprintf(errmsg, "Error: failed to get initial information from file id %d",
            *idne);
    ex_err("negii", errmsg, -1000);
  }
  if (*ierr == 0)
    ex_fcdcpy(ftype, slen, file_type);
  free(file_type);
}


x86 assembly (clang, -O0):
<negii>:
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,-0x38(%rbp)
cmpq   $0x1,-0x30(%rbp)
je     119e <negii+0x3e>
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
add    $0x1,%rdi
shl    $0x0,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x40(%rbp),%rcx
call   1060 <ex_get_init_info@plt>
mov    -0x28(%rbp),%rcx
mov    %eax,(%rcx)
cmp    $0x0,%eax
je     120a <negii+0xaa>
lea    -0x140(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
lea    0xe13(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x140(%rbp),%rsi
lea    0xe39(%rip),%rdi
mov    $0xfffffc18,%edx
call   1080 <ex_err@plt>
mov    -0x28(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1228 <negii+0xc8>
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
call   1030 <ex_fcdcpy@plt>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<negii>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %r9,%r15
mov    %r8,%r12
mov    %rcx,0x8(%rsp)
mov    %rdx,%rbp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x1(%r9),%rdi
call   1050 <malloc@plt>
mov    %rax,%r13
mov    (%rbx),%edi
mov    %r14,%rsi
mov    %rbp,%rdx
mov    %rax,%rcx
call   1060 <ex_get_init_info@plt>
mov    %eax,(%r12)
test   %eax,%eax
je     11da <negii+0x7a>
mov    (%rbx),%edx
lea    0xe4e(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <sprintf@plt>
lea    0xe73(%rip),%rdi
mov    %rbx,%rsi
mov    $0xfffffc18,%edx
call   1080 <ex_err@plt>
cmpl   $0x0,(%r12)
jne    11ea <negii+0x8a>
mov    0x8(%rsp),%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   1030 <ex_fcdcpy@plt>
mov    %r13,%rdi
call   1040 <free@plt>
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [57 x i8] c"Error: failed to get initial information from file id %d\00"
@.str.1 = [6 x i8] c"negii\00"
define void @negii(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 i64
%14 = alloca i8*
%15 = alloca [256 x 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* %13
%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* %13
br label %20
20: ; preds = %18, %6
%21 = load i64, i64* %13
%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** %14
%26 = load i32*, i32** %7
%27 = load i32, i32* %26
%28 = load i32*, i32** %8
%29 = load i32*, i32** %9
%30 = load i8*, i8** %14
%31 = call i32 @ex_get_init_info(i32 %27, i32* %28, i32* %29, i8* %30)
%32 = load i32*, i32** %11
store i32 %31, i32* %32
%33 = icmp ne i32 %31, 0
br i1 %33, label %34, label %41
34: ; preds = %20
%35 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%36 = load i32*, i32** %7
%37 = load i32, i32* %36
%38 = call i32 @sprintf(i8* %35, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%40 = call i32 @ex_err(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %39, i32 -1000)
br label %41
41: ; preds = %34, %20
%42 = load i32*, i32** %11
%43 = load i32, i32* %42
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %50
45: ; preds = %41
%46 = load i8*, i8** %10
%47 = load i64, i64* %13
%48 = load i8*, i8** %14
%49 = call i32 @ex_fcdcpy(i8* %46, i64 %47, i8* %48)
br label %50
50: ; preds = %45, %41
%51 = load i8*, i8** %14
%52 = call i32 @free(i8* %51)
ret void
}

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