int main(int argc, char **argv) {
  char *tmp[300];
  memset(tmp, 0, sizeof(tmp));
  gethostname(tmp, sizeof(tmp) - 1);
  if (strlen(tmp))
    printf("%s", tmp);
  return !(!strlen(tmp));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x970,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x970(%rbp),%rdi
xor    %esi,%esi
mov    $0x960,%edx
call   1050 <memset@plt>
lea    -0x970(%rbp),%rdi
mov    $0x95f,%esi
mov    $0x0,%al
call   1060 <gethostname@plt>
lea    -0x970(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
je     11aa <main+0x6a>
lea    -0x970(%rbp),%rsi
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x970(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x970,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x968,%rsp
mov    %rsp,%r14
xor    %ebx,%ebx
mov    $0x960,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    $0x95f,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <gethostname@plt>
cmpb   $0x0,(%rsp)
je     117d <main+0x4d>
lea    0xe96(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %ebx,%ebx
cmpb   $0x0,(%rsp)
setne  %bl
mov    %ebx,%eax
add    $0x968,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [300 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = getelementptr inbounds [300 x i8*], [300 x i8*]* %6, i64 0, i64 0
%8 = bitcast i8** %7 to i8*
%9 = getelementptr inbounds [300 x i8*], [300 x i8*]* %6, i64 0, i64 0
%10 = call i32 (i8**, i64, ...) bitcast (i32 (...)* @gethostname to i32 (i8**, i64, ...)*)(i8** %9, i64 2399)
%11 = getelementptr inbounds [300 x i8*], [300 x i8*]* %6, i64 0, i64 0
%12 = bitcast i8** %11 to i8*
%13 = call i64 @strlen(i8* %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = getelementptr inbounds [300 x i8*], [300 x i8*]* %6, i64 0, i64 0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %16)
br label %18
18: ; preds = %15, %2
%19 = getelementptr inbounds [300 x i8*], [300 x i8*]* %6, i64 0, i64 0
%20 = bitcast i8** %19 to i8*
%21 = call i64 @strlen(i8* %20)
%22 = icmp ne i64 %21, 0
%23 = xor i1 %22, true
%24 = xor i1 %23, true
%25 = zext i1 %24 to i32
ret i32 %25
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [300 x i8*]
%4 = bitcast [300 x i8*]* %3 to i8*
%5 = getelementptr inbounds [300 x i8*], [300 x i8*]* %3, i64 0, i64 0
%6 = call i32 (i8**, i64, ...) bitcast (i32 (...)* @gethostname to i32 (i8**, i64, ...)*)(i8** %5, i64 2399)
%7 = load i8, i8* %4
%8 = icmp eq i8 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %5)
%11 = load i8, i8* %4
%12 = icmp ne i8 %11, 0
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %9, %2
%15 = phi i32 [ %13, %9 ], [ 0, %2 ]
ret i32 %15
}