#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*/ assert(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
scalar_t__ send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char const *);
int /*<<< orphan*/ strlen(char *);
void sendNick(const char *nick, int sockfd) {
  assert(NULL != nick);
  assert(0 < sockfd);
  char output[1024] = {0};
  sprintf(output, "NICK %s\r\n", nick);
  if (0 > send(sockfd, output, strlen(output), 0)) {
    perror("send error");
    pthread_exit(NULL);
  }
}


x86 assembly (clang, -O0):
<sendNick>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
xor    %eax,%eax
cmp    -0xc(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe34(%rip),%rsi
call   1090 <sprintf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x41c(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x418(%rbp)
lea    -0x410(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x41c(%rbp),%edi
mov    -0x418(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    122d <sendNick+0xbd>
lea    0xdeb(%rip),%rdi
call   1080 <perror@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <pthread_exit@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendNick>:
push   %rbp
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1060 <assert@plt>
xor    %edi,%edi
test   %r14d,%r14d
setg   %dil
call   1060 <assert@plt>
mov    %rsp,%rbp
mov    $0x400,%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
lea    0xe4a(%rip),%rsi
mov    %rbp,%rdi
mov    %rbx,%rdx
call   1090 <sprintf@plt>
mov    %rbp,%rdi
call   1030 <strlen@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
test   %rax,%rax
js     11e9 <sendNick+0x79>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe1a(%rip),%rdi
call   1080 <perror@plt>
xor    %edi,%edi
call   1070 <pthread_exit@plt>
jmp    11dd <sendNick+0x6d>

LLVM IR (-O0):
@.str = [10 x i8] c"NICK %s\0D\0A\00"
@.str.1 = [11 x i8] c"send error\00"
define void @sendNick(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [1024 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = icmp ne i8* null, %6
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i32, i32* %4
%11 = icmp slt i32 0, %10
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = bitcast [1024 x i8]* %5 to i8*
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%16 = load i8*, i8** %3
%17 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i32, i32* %4
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%21 = call i32 @strlen(i8* %20)
%22 = call i64 @send(i32 %18, i8* %19, i32 %21, i32 0)
%23 = icmp sgt i64 0, %22
br i1 %23, label %24, label %27
24: ; preds = %2
%25 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%26 = call i32 @pthread_exit(i32* null)
br label %27
27: ; preds = %24, %2
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"NICK %s\0D\0A\00"
@.str.1 = [11 x i8] c"send error\00"
define void @sendNick(i8* %0, i32 %1) {
%3 = alloca [1024 x i8]
%4 = icmp ne i8* %0, null
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = icmp sgt i32 %1, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%11 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
%12 = call i32 @strlen(i8* %10)
%13 = call i64 @send(i32 %1, i8* %10, i32 %12, i32 0)
%14 = icmp slt i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @pthread_exit(i32* null)
br label %18
18: ; preds = %15, %2
ret void
}