#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*/ nc_advise(char *, int const, char *, int);
int nc_set_fill(int, int, int *);
int ncsetfill(int ncid, int fillmode) {
  int oldmode = -1;
  const int status = nc_set_fill(ncid, fillmode, &oldmode);
  if (status != 0) {
    nc_advise("ncsetfill", status, "ncid %d", ncid);
    return -1;
  }
  return oldmode;
}


x86 assembly (clang, -O0):
<ncsetfill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0xffffffff,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
lea    -0x10(%rbp),%rdx
call   1030 <nc_set_fill@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1176 <ncsetfill+0x56>
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%ecx
lea    0xea2(%rip),%rdi
lea    0xea5(%rip),%rdx
call   1040 <nc_advise@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    117c <ncsetfill+0x5c>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ncsetfill>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movl   $0xffffffff,0xc(%rsp)
ff
lea    0xc(%rsp),%rdx
call   1030 <nc_set_fill@plt>
test   %eax,%eax
je     115b <ncsetfill+0x3b>
lea    0xebc(%rip),%rdi
lea    0xebf(%rip),%rdx
mov    %eax,%esi
mov    %ebx,%ecx
call   1040 <nc_advise@plt>
mov    $0xffffffff,%eax
jmp    115f <ncsetfill+0x3f>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"ncsetfill\00"
@.str.1 = [8 x i8] c"ncid %d\00"
define i32 @ncsetfill(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 -1, i32* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = call i32 @nc_set_fill(i32 %8, i32 %9, i32* %6)
store i32 %10, i32* %7
%11 = load i32, i32* %7
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = load i32, i32* %7
%15 = load i32, i32* %4
%16 = call i32 @nc_advise(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %14, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %15)
store i32 -1, i32* %3
br label %19
17: ; preds = %2
%18 = load i32, i32* %6
store i32 %18, i32* %3
br label %19
19: ; preds = %17, %13
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@.str = [10 x i8] c"ncsetfill\00"
@.str.1 = [8 x i8] c"ncid %d\00"
define i32 @ncsetfill(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 -1, i32* %3
%5 = call i32 @nc_set_fill(i32 %0, i32 %1, i32* %3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = call i32 @nc_advise(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %11
9: ; preds = %2
%10 = load i32, i32* %3
br label %11
11: ; preds = %9, %7
%12 = phi i32 [ -1, %7 ], [ %10, %9 ]
ret i32 %12
}