#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 _chgrp_error(char *, int);
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, char *);
int /*<<< orphan*/ stderr;
int _chgrp_grp_error(char *group) {
  if (errno == 0) {
    fprintf(stderr, "%s%s%s",
            "chgrp"
            ": ",
            group, ": Unknown group\n");
    return 2;
  }
  return _chgrp_error(group, 2);
}


x86 assembly (clang, -O0):
<_chgrp_grp_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2ea5(%rip),%rax
cmpq   $0x0,(%rax)
jne    1170 <_chgrp_grp_error+0x50>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rcx
lea    0xeaf(%rip),%rsi
lea    0xeaf(%rip),%rdx
lea    0xeb0(%rip),%r8
call   1030 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1181 <_chgrp_grp_error+0x61>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1040 <_chgrp_error@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_chgrp_grp_error>:
push   %rax
mov    %rdi,%rcx
mov    0x2ead(%rip),%rax
cmpq   $0x0,(%rax)
je     113f <_chgrp_grp_error+0x1f>
mov    %rcx,%rdi
mov    $0x2,%esi
pop    %rax
jmp    1040 <_chgrp_error@plt>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    0xeb1(%rip),%rsi
lea    0xeb1(%rip),%rdx
lea    0xeb2(%rip),%r8
call   1030 <fprintf@plt>
mov    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
@errno = global i64 0
@stderr = global i32 0
@.str = [7 x i8] c"%s%s%s\00"
@.str.1 = [8 x i8] c"chgrp: \00"
@.str.2 = [17 x i8] c": Unknown group\0A\00"
define i32 @_chgrp_grp_error(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i64, i64* @errno
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %3
%9 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %8, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
store i32 2, i32* %2
br label %13
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i32 @_chgrp_error(i8* %11, i32 2)
store i32 %12, i32* %2
br label %13
13: ; preds = %10, %6
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@errno = global i64 0
@stderr = global i32 0
@.str = [7 x i8] c"%s%s%s\00"
@.str.1 = [8 x i8] c"chgrp: \00"
@.str.2 = [17 x i8] c": Unknown group\0A\00"
define i32 @_chgrp_grp_error(i8* %0) {
%2 = load i64, i64* @errno
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %9
7: ; preds = %1
%8 = tail call i32 @_chgrp_error(i8* %0, i32 2)
br label %9
9: ; preds = %7, %4
%10 = phi i32 [ 2, %4 ], [ %8, %7 ]
ret i32 %10
}