#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_get_att(int, int, char const *, void *);
int ncattget(int ncid, int varid, const char *name, void *value) {
  const int status = nc_get_att(ncid, varid, name, value);
  if (status != 0) {
    nc_advise("ncattget", status, "ncid %d", ncid);
    return -1;
  }
  return 1;
}


x86 assembly (clang, -O0):
<ncattget>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <nc_get_att@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     117b <ncattget+0x5b>
mov    -0x24(%rbp),%esi
mov    -0x8(%rbp),%ecx
lea    0xe9d(%rip),%rdi
lea    0xe9f(%rip),%rdx
call   1040 <nc_advise@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1182 <ncattget+0x62>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ncattget>:
push   %rbx
mov    %edi,%ebx
call   1030 <nc_get_att@plt>
test   %eax,%eax
je     114a <ncattget+0x2a>
lea    0xecd(%rip),%rdi
lea    0xecf(%rip),%rdx
mov    %eax,%esi
mov    %ebx,%ecx
call   1040 <nc_advise@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

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

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