void ckhost(vvbuf, vvlen) char *vvbuf;
int vvlen;
{
  extern int nopush;
  extern int en_hos;
  char *g;
  int havefull = 0;
  if (getenv("CK_NOPUSH")) {
    nopush = 1;
    en_hos = 0;
  }
  *vvbuf = '\0';
  if (*vvbuf == '\0') {
    g = getenv("HOST");
    if (g)
      ckstrncpy(vvbuf, g, vvlen);
  }
  vvbuf[vvlen - 1] = '\0';
}


x86 assembly (clang, -O0):
<ckhost>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <getenv@plt>
cmp    $0x0,%eax
je     1167 <ckhost+0x47>
mov    0x2e84(%rip),%rax
movl   $0x1,(%rax)
mov    0x2e87(%rip),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11b4 <ckhost+0x94>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <getenv@plt>
cltq
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11af <ckhost+0x8f>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    $0x0,%al
call   1040 <ckstrncpy@plt>
jmp    11b4 <ckhost+0x94>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ckhost>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xed1(%rip),%rdi
xor    %eax,%eax
call   1030 <getenv@plt>
test   %eax,%eax
je     1154 <ckhost+0x34>
mov    0x2e97(%rip),%rax
movl   $0x1,(%rax)
mov    0x2e9a(%rip),%rax
movl   $0x0,(%rax)
movb   $0x0,(%rbx)
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1030 <getenv@plt>
test   %eax,%eax
je     1178 <ckhost+0x58>
movslq %eax,%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <ckstrncpy@plt>
movslq %ebp,%rax
movb   $0x0,-0x1(%rax,%rbx,1)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"CK_NOPUSH\00"
@nopush = external global i32
@en_hos = external global i32
@.str.1 = [5 x i8] c"HOST\00"
define void @ckhost(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %6
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @getenv to i32 (i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 1, i32* @nopush
store i32 0, i32* @en_hos
br label %10
10: ; preds = %9, %2
%11 = load i8*, i8** %3
store i8 0, i8* %11
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %28
16: ; preds = %10
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @getenv to i32 (i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i8*
store i8* %19, i8** %5
%20 = load i8*, i8** %5
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %27
22: ; preds = %16
%23 = load i8*, i8** %3
%24 = load i8*, i8** %5
%25 = load i32, i32* %4
%26 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @ckstrncpy to i32 (i8*, i8*, i32, ...)*)(i8* %23, i8* %24, i32 %25)
br label %27
27: ; preds = %22, %16
br label %28
28: ; preds = %27, %10
%29 = load i8*, i8** %3
%30 = load i32, i32* %4
%31 = sub nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %29, i64 %32
store i8 0, i8* %33
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"CK_NOPUSH\00"
@nopush = external global i32
@en_hos = external global i32
@.str.1 = [5 x i8] c"HOST\00"
define void @ckhost(i8* %0, i32 %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @getenv to i32 (i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %6, label %5
5: ; preds = %2
store i32 1, i32* @nopush
store i32 0, i32* @en_hos
br label %6
6: ; preds = %5, %2
store i8 0, i8* %0
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @getenv to i32 (i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = sext i32 %7 to i64
%11 = inttoptr i64 %10 to i8*
%12 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @ckstrncpy to i32 (i8*, i8*, i32, ...)*)(i8* %0, i8* %11, i32 %1)
br label %13
13: ; preds = %6, %9
%14 = add nsw i32 %1, -1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %0, i64 %15
store i8 0, i8* %16
ret void
}