#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 *, char const *);
int nc_copy_att(int, int, char const *, int, int);
int ncattcopy(int ncid_in, int varid_in, const char *name, int ncid_out,
              int varid_out) {
  const int status = nc_copy_att(ncid_in, varid_in, name, ncid_out, varid_out);
  if (status != 0) {
    nc_advise("ncattcopy", status, "%s", name);
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<ncattcopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1040 <nc_copy_att@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1182 <ncattcopy+0x62>
mov    -0x24(%rbp),%esi
mov    -0x18(%rbp),%rcx
lea    0xe96(%rip),%rdi
lea    0xe99(%rip),%rdx
call   1030 <nc_advise@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1189 <ncattcopy+0x69>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ncattcopy>:
push   %rbx
mov    %rdx,%rbx
call   1040 <nc_copy_att@plt>
test   %eax,%eax
je     114c <ncattcopy+0x2c>
lea    0xecc(%rip),%rdi
lea    0xecf(%rip),%rdx
mov    %eax,%esi
mov    %rbx,%rcx
call   1030 <nc_advise@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

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