#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 t_irc_nick {
  int dummy;
};
struct t_irc_channel {
  int dummy;
};

/* Variables and functions */
struct t_irc_nick *irc_nick_search(struct t_irc_channel *, char const *);
int /*<<< orphan*/ irc_nick_set(struct t_irc_channel *, struct t_irc_nick *,
                                int, int);
void irc_mode_channel_set_nick(struct t_irc_channel *channel, const char *nick,
                               char set_flag, int flag) {
  struct t_irc_nick *ptr_nick;
  if (nick) {
    ptr_nick = irc_nick_search(channel, nick);
    if (ptr_nick)
      irc_nick_set(channel, ptr_nick, (set_flag == '+'), flag);
  }
}


x86 assembly (clang, -O0):
<irc_mode_channel_set_nick>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %ecx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1183 <irc_mode_channel_set_nick+0x63>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <irc_nick_search@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     117e <irc_mode_channel_set_nick+0x5e>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movsbl -0x11(%rbp),%eax
cmp    $0x2b,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edx
mov    -0x18(%rbp),%ecx
call   1030 <irc_nick_set@plt>
jmp    1183 <irc_mode_channel_set_nick+0x63>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irc_mode_channel_set_nick>:
push   %rbp
push   %r14
push   %rbx
test   %rsi,%rsi
je     1156 <irc_mode_channel_set_nick+0x36>
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %rdi,%rbx
call   1040 <irc_nick_search@plt>
test   %rax,%rax
je     1156 <irc_mode_channel_set_nick+0x36>
xor    %edx,%edx
cmp    $0x2b,%bpl
sete   %dl
mov    %rbx,%rdi
mov    %rax,%rsi
mov    %r14d,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <irc_nick_set@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.t_irc_channel = type { i32 }
%struct.t_irc_nick = type { i32 }
define void @irc_mode_channel_set_nick(%struct.t_irc_channel* %0, i8* %1, i8 signext %2, i32 %3) {
%5 = alloca %struct.t_irc_channel*
%6 = alloca i8*
%7 = alloca i8
%8 = alloca i32
%9 = alloca %struct.t_irc_nick*
store %struct.t_irc_channel* %0, %struct.t_irc_channel** %5
store i8* %1, i8** %6
store i8 %2, i8* %7
store i32 %3, i32* %8
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %28
12: ; preds = %4
%13 = load %struct.t_irc_channel*, %struct.t_irc_channel** %5
%14 = load i8*, i8** %6
%15 = call %struct.t_irc_nick* @irc_nick_search(%struct.t_irc_channel* %13, i8* %14)
store %struct.t_irc_nick* %15, %struct.t_irc_nick** %9
%16 = load %struct.t_irc_nick*, %struct.t_irc_nick** %9
%17 = icmp ne %struct.t_irc_nick* %16, null
br i1 %17, label %18, label %27
18: ; preds = %12
%19 = load %struct.t_irc_channel*, %struct.t_irc_channel** %5
%20 = load %struct.t_irc_nick*, %struct.t_irc_nick** %9
%21 = load i8, i8* %7
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 43
%24 = zext i1 %23 to i32
%25 = load i32, i32* %8
%26 = call i32 @irc_nick_set(%struct.t_irc_channel* %19, %struct.t_irc_nick* %20, i32 %24, i32 %25)
br label %27
27: ; preds = %18, %12
br label %28
28: ; preds = %27, %4
ret void
}

LLVM IR (-O2):
%struct.t_irc_channel = type { i32 }
%struct.t_irc_nick = type { i32 }
define void @irc_mode_channel_set_nick(%struct.t_irc_channel* %0, i8* %1, i8 signext %2, i32 %3) {
%5 = icmp eq i8* %1, null
br i1 %5, label %13, label %6
6: ; preds = %4
%7 = tail call %struct.t_irc_nick* @irc_nick_search(%struct.t_irc_channel* %0, i8* %1)
%8 = icmp eq %struct.t_irc_nick* %7, null
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = icmp eq i8 %2, 43
%11 = zext i1 %10 to i32
%12 = tail call i32 @irc_nick_set(%struct.t_irc_channel* %0, %struct.t_irc_nick* %7, i32 %11, i32 %3)
br label %13
13: ; preds = %6, %9, %4
ret void
}