#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 */
struct conn_info_st {
  int dummy;
};

/* Variables and functions */
scalar_t__ fw_user(char const *, struct conn_info_st *);
scalar_t__ std_user_split(char const *, struct conn_info_st *);
int fw_login_type2(const char *args, struct conn_info_st *conn_info) {
  static int stage;
  if (stage == 0) {
    if (fw_user(args, conn_info) == 0) {
      stage++;
    } else {
      stage = 0;
    }
  }
  if (stage == 1) {
    if (std_user_split(args, conn_info) == 0) {
      stage++;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<fw_login_type2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,0x2efd(%rip)
jne    1177 <fw_login_type2+0x57>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <fw_user@plt>
cmp    $0x0,%rax
jne    1168 <fw_login_type2+0x48>
mov    0x2eda(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ed1(%rip)
jmp    1172 <fw_login_type2+0x52>
movl   $0x0,0x2ec2(%rip)
jmp    1177 <fw_login_type2+0x57>
cmpl   $0x1,0x2eb6(%rip)
jne    11af <fw_login_type2+0x8f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <std_user_split@plt>
cmp    $0x0,%rax
jne    11aa <fw_login_type2+0x8a>
mov    0x2e93(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e8a(%rip)
jmp    11af <fw_login_type2+0x8f>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fw_login_type2>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2f04(%rip),%eax
test   %eax,%eax
je     1154 <fw_login_type2+0x34>
cmp    $0x1,%eax
jne    116c <fw_login_type2+0x4c>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <std_user_split@plt>
test   %rax,%rax
jne    116c <fw_login_type2+0x4c>
mov    0x2ee5(%rip),%ecx
add    $0x1,%ecx
jmp    1166 <fw_login_type2+0x46>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fw_user@plt>
xor    %ecx,%ecx
test   %rax,%rax
je     1176 <fw_login_type2+0x56>
mov    %ecx,0x2ec8(%rip)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2eb8(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2eaf(%rip)
cmp    $0x1,%eax
je     1139 <fw_login_type2+0x19>
jmp    116c <fw_login_type2+0x4c>

LLVM IR (-O0):
%struct.conn_info_st = type { i32 }
@fw_login_type2.stage = internal global i32 0
define i32 @fw_login_type2(i8* %0, %struct.conn_info_st* %1) {
%3 = alloca i8*
%4 = alloca %struct.conn_info_st*
store i8* %0, i8** %3
store %struct.conn_info_st* %1, %struct.conn_info_st** %4
%5 = load i32, i32* @fw_login_type2.stage
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = load %struct.conn_info_st*, %struct.conn_info_st** %4
%10 = call i64 @fw_user(i8* %8, %struct.conn_info_st* %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i32, i32* @fw_login_type2.stage
%14 = add nsw i32 %13, 1
store i32 %14, i32* @fw_login_type2.stage
br label %16
15: ; preds = %7
store i32 0, i32* @fw_login_type2.stage
br label %16
16: ; preds = %15, %12
br label %17
17: ; preds = %16, %2
%18 = load i32, i32* @fw_login_type2.stage
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %29
20: ; preds = %17
%21 = load i8*, i8** %3
%22 = load %struct.conn_info_st*, %struct.conn_info_st** %4
%23 = call i64 @std_user_split(i8* %21, %struct.conn_info_st* %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = load i32, i32* @fw_login_type2.stage
%27 = add nsw i32 %26, 1
store i32 %27, i32* @fw_login_type2.stage
br label %28
28: ; preds = %25, %20
br label %29
29: ; preds = %28, %17
ret i32 0
}

LLVM IR (-O2):
%struct.conn_info_st = type { i32 }
@fw_login_type2.stage = internal unnamed_addr global i32 0
define i32 @fw_login_type2(i8* %0, %struct.conn_info_st* %1) {
%3 = load i32, i32* @fw_login_type2.stage
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = tail call i64 @fw_user(i8* %0, %struct.conn_info_st* %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = load i32, i32* @fw_login_type2.stage
%10 = add nsw i32 %9, 1
store i32 %10, i32* @fw_login_type2.stage
br label %11
11: ; preds = %8, %2
%12 = phi i32 [ %10, %8 ], [ %3, %2 ]
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %22
14: ; preds = %11
%15 = tail call i64 @std_user_split(i8* %0, %struct.conn_info_st* %1)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = load i32, i32* @fw_login_type2.stage
%19 = add nsw i32 %18, 1
br label %20
20: ; preds = %5, %17
%21 = phi i32 [ %19, %17 ], [ 0, %5 ]
store i32 %21, i32* @fw_login_type2.stage
br label %22
22: ; preds = %20, %14, %11
ret i32 0
}