#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 */
int /*<<< orphan*/ add_server(char const *, char const *, char *, char const *,
                              char const *, char const *);
char *edit_box(int, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ popup_notify(int /*<<< orphan*/, char *, char const *);
void add_server_menu(void) {
  const char *nick = NULL, *s = NULL;
  s = edit_box(60, "^Add server: enter hostname:port^", NULL);
  if (s)
    nick = edit_box(60, "^Add server: enter nick^", NULL);
  if (nick) {
    add_server(s, nick, "notset", nick, nick, s);
    popup_notify(0, "Server %s was added", s);
  }
  free((void *)s);
  ;
  free((void *)nick);
  ;
}


x86 assembly (clang, -O0):
<add_server_menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x3c,%edi
lea    0xe9c(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1060 <edit_box@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1195 <add_server_menu+0x55>
mov    $0x3c,%edi
lea    0xe9a(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1060 <edit_box@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11d2 <add_server_menu+0x92>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rcx
mov    -0x8(%rbp),%r8
mov    -0x10(%rbp),%r9
lea    0xe80(%rip),%rdx
call   1040 <add_server@plt>
mov    -0x10(%rbp),%rdx
xor    %edi,%edi
lea    0xe75(%rip),%rsi
call   1050 <popup_notify@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_server_menu>:
push   %r15
push   %r14
push   %rbx
lea    0xeb4(%rip),%rsi
xor    %r14d,%r14d
mov    $0x3c,%edi
xor    %edx,%edx
call   1060 <edit_box@plt>
mov    %rax,%rbx
test   %rax,%rax
je     11b0 <add_server_menu+0x70>
lea    0xeb8(%rip),%rsi
xor    %r14d,%r14d
mov    $0x3c,%edi
xor    %edx,%edx
call   1060 <edit_box@plt>
test   %rax,%rax
je     11b0 <add_server_menu+0x70>
mov    %rax,%r15
lea    0xeb3(%rip),%rdx
mov    %rbx,%rdi
mov    %rax,%rsi
mov    %rax,%rcx
mov    %rax,%r8
mov    %rbx,%r9
call   1040 <add_server@plt>
lea    0xe9f(%rip),%rsi
xor    %edi,%edi
mov    %rbx,%rdx
call   1050 <popup_notify@plt>
mov    %r15,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"^Add server: enter hostname:port^\00"
@.str.1 = [25 x i8] c"^Add server: enter nick^\00"
@.str.2 = [7 x i8] c"notset\00"
@.str.3 = [20 x i8] c"Server %s was added\00"
define void @add_server_menu() {
%1 = alloca i8*
%2 = alloca i8*
store i8* null, i8** %1
store i8* null, i8** %2
%3 = call i8* @edit_box(i32 60, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32* null)
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i8* @edit_box(i32 60, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32* null)
store i8* %7, i8** %1
br label %8
8: ; preds = %6, %0
%9 = load i8*, i8** %1
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load i8*, i8** %2
%13 = load i8*, i8** %1
%14 = load i8*, i8** %1
%15 = load i8*, i8** %1
%16 = load i8*, i8** %2
%17 = call i32 @add_server(i8* %12, i8* %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %14, i8* %15, i8* %16)
%18 = load i8*, i8** %2
%19 = call i32 @popup_notify(i32 0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %11, %8
%21 = load i8*, i8** %2
%22 = call i32 @free(i8* %21)
%23 = load i8*, i8** %1
%24 = call i32 @free(i8* %23)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"^Add server: enter hostname:port^\00"
@.str.1 = [25 x i8] c"^Add server: enter nick^\00"
@.str.2 = [7 x i8] c"notset\00"
@.str.3 = [20 x i8] c"Server %s was added\00"
define void @add_server_menu() {
%1 = tail call i8* @edit_box(i32 60, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32* null)
%2 = icmp eq i8* %1, null
br i1 %2, label %9, label %3
3: ; preds = %0
%4 = tail call i8* @edit_box(i32 60, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32* null)
%5 = icmp eq i8* %4, null
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 @add_server(i8* %1, i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %4, i8* %4, i8* %1)
%8 = tail call i32 @popup_notify(i32 0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %1)
br label %9
9: ; preds = %0, %6, %3
%10 = phi i8* [ %4, %6 ], [ null, %3 ], [ null, %0 ]
%11 = tail call i32 @free(i8* %1)
%12 = tail call i32 @free(i8* %10)
ret void
}