#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_rename_dim(int, int, char const *);
int ncdimrename(int ncid, int dimid, const char *name) {
  const int status = nc_rename_dim(ncid, dimid, name);
  if (status != 0) {
    nc_advise("ncdimrename", status, "ncid %d", ncid);
    return -1;
  }
  return dimid;
}


x86 assembly (clang, -O0):
<ncdimrename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <nc_rename_dim@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1173 <ncdimrename+0x53>
mov    -0x1c(%rbp),%esi
mov    -0x8(%rbp),%ecx
lea    0xea5(%rip),%rdi
lea    0xeaa(%rip),%rdx
call   1040 <nc_advise@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1179 <ncdimrename+0x59>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ncdimrename>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
call   1030 <nc_rename_dim@plt>
test   %eax,%eax
je     114c <ncdimrename+0x2c>
lea    0xec9(%rip),%rdi
lea    0xece(%rip),%rdx
mov    %eax,%esi
mov    %ebx,%ecx
call   1040 <nc_advise@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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