#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*/ abort();
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ send_raw_msg(int, char *);
unsigned int sleep(unsigned int);
void login(int socket) {
  send_raw_msg(socket, "USER "
                       "d8Gbot"
                       " "
                       "d8Gbot"
                       ": noname noname\n");
  send_raw_msg(socket, "NICK "
                       "d8Gbot"
                       "\n");
  if (sleep(1U) > 0U) {
    perror("usleep");
    abort();
  }
  send_raw_msg(socket, "JOIN #"
                       "test"
                       "\n");
}


x86 assembly (clang, -O0):
<login>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0xeab(%rip),%rsi
call   1040 <send_raw_msg@plt>
mov    -0x4(%rbp),%edi
lea    0xebf(%rip),%rsi
call   1040 <send_raw_msg@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
cmp    $0x0,%eax
jbe    118f <login+0x4f>
lea    0xead(%rip),%rdi
call   1050 <perror@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x4(%rbp),%edi
lea    0xe9e(%rip),%rsi
call   1040 <send_raw_msg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<login>:
push   %rbx
mov    %edi,%ebx
lea    0xeb6(%rip),%rsi
call   1040 <send_raw_msg@plt>
lea    0xecd(%rip),%rsi
mov    %ebx,%edi
call   1040 <send_raw_msg@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
test   %eax,%eax
jne    117a <login+0x3a>
lea    0xec5(%rip),%rsi
mov    %ebx,%edi
pop    %rbx
jmp    1040 <send_raw_msg@plt>
lea    0xeaf(%rip),%rdi
call   1050 <perror@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"USER d8Gbot d8Gbot: noname noname\0A\00"
@.str.1 = [13 x i8] c"NICK d8Gbot\0A\00"
@.str.2 = [7 x i8] c"usleep\00"
@.str.3 = [12 x i8] c"JOIN #test\0A\00"
define void @login(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @send_raw_msg(i32 %3, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
%6 = call i32 @send_raw_msg(i32 %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @sleep(i32 1)
%8 = icmp ugt i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %1
%13 = load i32, i32* %2
%14 = call i32 @send_raw_msg(i32 %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"USER d8Gbot d8Gbot: noname noname\0A\00"
@.str.1 = [13 x i8] c"NICK d8Gbot\0A\00"
@.str.2 = [7 x i8] c"usleep\00"
@.str.3 = [12 x i8] c"JOIN #test\0A\00"
define void @login(i32 %0) {
%2 = tail call i32 @send_raw_msg(i32 %0, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @send_raw_msg(i32 %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @sleep(i32 1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %1
%10 = tail call i32 @send_raw_msg(i32 %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
ret void
}