#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 */
int /*<<< orphan*/ free(char *);
scalar_t__ fw_set_fwuser(char *, struct conn_info_st *);
char *quotstrtok_prepend(char *, char const *, char *, int *);
scalar_t__ std_user_split(char *, struct conn_info_st *);
int strlen(char *);
int fw_user_type9(const char *args, struct conn_info_st *conn_info) {
  char *remoteuser;
  char *fwuser;
  int offset = strlen("USER ");
  remoteuser = quotstrtok_prepend("USER ", args, " \t", &offset);
  if (std_user_split(remoteuser, conn_info) != 0) {
    free(remoteuser);
    return (-2);
  }
  free(remoteuser);
  fwuser = quotstrtok_prepend("USER ", args, " \t", &offset);
  if (fw_set_fwuser(fwuser, conn_info) != 0) {
    free(fwuser);
    return (-2);
  }
  free(fwuser);
  return 0;
}


x86 assembly (clang, -O0):
<fw_user_type9>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    0xe99(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe86(%rip),%rdi
lea    0xe85(%rip),%rdx
lea    -0x2c(%rbp),%rcx
call   1070 <quotstrtok_prepend@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <std_user_split@plt>
cmp    $0x0,%rax
je     11ba <fw_user_type9+0x6a>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    121e <fw_user_type9+0xce>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rsi
lea    0xe32(%rip),%rdi
lea    0xe31(%rip),%rdx
lea    -0x2c(%rbp),%rcx
call   1070 <quotstrtok_prepend@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <fw_set_fwuser@plt>
cmp    $0x0,%rax
je     120e <fw_user_type9+0xbe>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    121e <fw_user_type9+0xce>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fw_user_type9>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xe9b(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,0x4(%rsp)
lea    0xe8e(%rip),%rdx
lea    0x4(%rsp),%rcx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <quotstrtok_prepend@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <std_user_split@plt>
mov    %rax,%r12
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0xfffffffe,%eax
test   %r12,%r12
jne    11ea <fw_user_type9+0x9a>
lea    0xe4e(%rip),%rdi
lea    0xe4d(%rip),%rdx
lea    0x4(%rsp),%rcx
mov    %r15,%rsi
call   1070 <quotstrtok_prepend@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    %r14,%rsi
call   1060 <fw_set_fwuser@plt>
xor    %ebx,%ebx
test   %rax,%rax
sete   %bl
mov    %r15,%rdi
call   1030 <free@plt>
lea    (%rbx,%rbx,1),%eax
add    $0xfffffffe,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.conn_info_st = type { i32 }
@.str = [6 x i8] c"USER \00"
@.str.1 = [3 x i8] c" \09\00"
define i32 @fw_user_type9(i8* %0, %struct.conn_info_st* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.conn_info_st*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %4
store %struct.conn_info_st* %1, %struct.conn_info_st** %5
%9 = call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %9, i32* %8
%10 = load i8*, i8** %4
%11 = call i8* @quotstrtok_prepend(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
store i8* %11, i8** %6
%12 = load i8*, i8** %6
%13 = load %struct.conn_info_st*, %struct.conn_info_st** %5
%14 = call i64 @std_user_split(i8* %12, %struct.conn_info_st* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = load i8*, i8** %6
%18 = call i32 @free(i8* %17)
store i32 -2, i32* %3
br label %34
19: ; preds = %2
%20 = load i8*, i8** %6
%21 = call i32 @free(i8* %20)
%22 = load i8*, i8** %4
%23 = call i8* @quotstrtok_prepend(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
store i8* %23, i8** %7
%24 = load i8*, i8** %7
%25 = load %struct.conn_info_st*, %struct.conn_info_st** %5
%26 = call i64 @fw_set_fwuser(i8* %24, %struct.conn_info_st* %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %19
%29 = load i8*, i8** %7
%30 = call i32 @free(i8* %29)
store i32 -2, i32* %3
br label %34
31: ; preds = %19
%32 = load i8*, i8** %7
%33 = call i32 @free(i8* %32)
store i32 0, i32* %3
br label %34
34: ; preds = %31, %28, %16
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
%struct.conn_info_st = type { i32 }
@.str = [6 x i8] c"USER \00"
@.str.1 = [3 x i8] c" \09\00"
define i32 @fw_user_type9(i8* %0, %struct.conn_info_st* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %5, i32* %3
%6 = call i8* @quotstrtok_prepend(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = call i64 @std_user_split(i8* %6, %struct.conn_info_st* %1)
%8 = icmp eq i64 %7, 0
%9 = call i32 @free(i8* %6)
br i1 %8, label %10, label %16
10: ; preds = %2
%11 = call i8* @quotstrtok_prepend(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = call i64 @fw_set_fwuser(i8* %11, %struct.conn_info_st* %1)
%13 = icmp eq i64 %12, 0
%14 = call i32 @free(i8* %11)
%15 = select i1 %13, i32 0, i32 -2
br label %16
16: ; preds = %10, %2
%17 = phi i32 [ -2, %2 ], [ %15, %10 ]
ret i32 %17
}