#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 */
scalar_t__ send_kbd_to_server(char *, char *, int /*<<< orphan*/ *);
int do_login_process() {
  if (send_kbd_to_server("USER", "USER:OK\n", NULL) < 0) {
    return -1;
  }
  if (send_kbd_to_server("PASS", "LOGIN:OK", NULL) < 0) {
    return -1;
  }
  return 1;
}


x86 assembly (clang, -O0):
<do_login_process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    0xedf(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <send_kbd_to_server@plt>
cmp    $0x0,%rax
jge    1145 <do_login_process+0x35>
movl   $0xffffffff,-0x4(%rbp)
jmp    1179 <do_login_process+0x69>
lea    0xec2(%rip),%rdi
lea    0xec0(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <send_kbd_to_server@plt>
cmp    $0x0,%rax
jge    1172 <do_login_process+0x62>
movl   $0xffffffff,-0x4(%rbp)
jmp    1179 <do_login_process+0x69>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_login_process>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xee6(%rip),%rsi
xor    %edx,%edx
call   1030 <send_kbd_to_server@plt>
test   %rax,%rax
js     1150 <do_login_process+0x40>
lea    0xedc(%rip),%rdi
lea    0xeda(%rip),%rsi
xor    %edx,%edx
call   1030 <send_kbd_to_server@plt>
xor    %ecx,%ecx
test   %rax,%rax
setns  %cl
lea    (%rcx,%rcx,1),%eax
add    $0xffffffff,%eax
pop    %rcx
ret
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"USER\00"
@.str.1 = [9 x i8] c"USER:OK\0A\00"
@.str.2 = [5 x i8] c"PASS\00"
@.str.3 = [9 x i8] c"LOGIN:OK\00"
define i32 @do_login_process() {
%1 = alloca i32
%2 = call i64 @send_kbd_to_server(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* null)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 -1, i32* %1
br label %10
5: ; preds = %0
%6 = call i64 @send_kbd_to_server(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* null)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %5
store i32 -1, i32* %1
br label %10
9: ; preds = %5
store i32 1, i32* %1
br label %10
10: ; preds = %9, %8, %4
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@.str = [5 x i8] c"USER\00"
@.str.1 = [9 x i8] c"USER:OK\0A\00"
@.str.2 = [5 x i8] c"PASS\00"
@.str.3 = [9 x i8] c"LOGIN:OK\00"
define i32 @do_login_process() {
%1 = tail call i64 @send_kbd_to_server(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* null)
%2 = icmp slt i64 %1, 0
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = tail call i64 @send_kbd_to_server(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* null)
%5 = icmp slt i64 %4, 0
%6 = select i1 %5, i32 -1, i32 1
br label %7
7: ; preds = %3, %0
%8 = phi i32 [ -1, %0 ], [ %6, %3 ]
ret i32 %8
}