#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 */
char *mask_create2(char *, char *, char *, int, int);
char *strtok(char *, char *);
char *mask_create(char *ident, char *mask, int maxlen, int depth) {
  char *nick, *user, *host;
  nick = strtok(ident, "!");
  user = strtok(NULL, "@");
  host = strtok(NULL, "");
  if (user && host)
    return mask_create2(user, host, mask, maxlen, depth);
  else
    return "";
}


x86 assembly (clang, -O0):
<mask_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xebf(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xead(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x30(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe98(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     11a9 <mask_create+0x89>
cmpq   $0x0,-0x38(%rbp)
je     11a9 <mask_create+0x89>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1040 <mask_create2@plt>
mov    %rax,-0x8(%rbp)
jmp    11b4 <mask_create+0x94>
lea    0xe51(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mask_create>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %rsi,%rbx
lea    0xec9(%rip),%rsi
call   1030 <strtok@plt>
lea    0xebf(%rip),%rsi
xor    %edi,%edi
call   1030 <strtok@plt>
mov    %rax,%rbp
lea    0xead(%rip),%rsi
xor    %edi,%edi
call   1030 <strtok@plt>
test   %rbp,%rbp
je     1183 <mask_create+0x63>
test   %rax,%rax
je     1183 <mask_create+0x63>
mov    %rbp,%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
mov    %r15d,%ecx
mov    %r14d,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <mask_create2@plt>
lea    0xe77(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"!\00"
@.str.1 = [2 x i8] c"@\00"
@.str.2 = [1 x i8] zeroinitializer
define i8* @mask_create(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%13 = load i8*, i8** %6
%14 = call i8* @strtok(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %14, i8** %10
%15 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %15, i8** %11
%16 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
store i8* %16, i8** %12
%17 = load i8*, i8** %11
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %29
19: ; preds = %4
%20 = load i8*, i8** %12
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %29
22: ; preds = %19
%23 = load i8*, i8** %11
%24 = load i8*, i8** %12
%25 = load i8*, i8** %7
%26 = load i32, i32* %8
%27 = load i32, i32* %9
%28 = call i8* @mask_create2(i8* %23, i8* %24, i8* %25, i32 %26, i32 %27)
store i8* %28, i8** %5
br label %30
29: ; preds = %19, %4
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %5
br label %30
30: ; preds = %29, %22
%31 = load i8*, i8** %5
ret i8* %31
}

LLVM IR (-O2):
@.str = [2 x i8] c"!\00"
@.str.1 = [2 x i8] c"@\00"
@.str.2 = [1 x i8] zeroinitializer
define i8* @mask_create(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp ne i8* %6, null
%9 = icmp ne i8* %7, null
%10 = select i1 %8, i1 %9, i1 false
br i1 %10, label %11, label %13
11: ; preds = %4
%12 = tail call i8* @mask_create2(i8* %6, i8* %7, i8* %1, i32 %2, i32 %3)
br label %13
13: ; preds = %4, %11
%14 = phi i8* [ %12, %11 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %4 ]
ret i8* %14
}