#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 atoi(char *);
int client_create_group(int, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ run_netplay();
int create_group(int argc, char **argv) {
  int ret;
  int open = 1;
  char *name;
  char *passwd;
  if (argc > 1)
    name = argv[1];
  else
    name = "testroom";
  if (argc > 2)
    passwd = argv[2];
  else
    passwd = "";
  if (argc > 3)
    open = atoi(argv[3]);
  else
    open = 1;
  printf("create room, %d, name:%s, passwd:%s\n", open, name, passwd);
  ret = client_create_group(open, name, passwd);
  if (ret) {
    printf("create room fail.\n");
    return -1;
  }
  printf("wait other player.\n");
  run_netplay();
  return 0;
}


x86 assembly (clang, -O0):
<create_group>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1171 <create_group+0x31>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    117c <create_group+0x3c>
lea    0xe88(%rip),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    1197 <create_group+0x57>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    11a2 <create_group+0x62>
lea    0xea2(%rip),%rax
mov    %rax,-0x28(%rbp)
cmpl   $0x3,-0x8(%rbp)
jle    11c1 <create_group+0x81>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    11c8 <create_group+0x88>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1040 <client_create_group@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1218 <create_group+0xd8>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1234 <create_group+0xf4>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <run_netplay@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_group>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebp
lea    0xeca(%rip),%r15
cmp    $0x2,%edi
jl     1184 <create_group+0x34>
mov    0x8(%rsi),%r14
je     118b <create_group+0x3b>
mov    0x10(%rsi),%r15
cmp    $0x4,%edi
jb     118b <create_group+0x3b>
mov    0x18(%rsi),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
jmp    118b <create_group+0x3b>
lea    0xe75(%rip),%r14
lea    0xe77(%rip),%rdi
xor    %ebx,%ebx
mov    %ebp,%esi
mov    %r14,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <client_create_group@plt>
test   %eax,%eax
je     11c7 <create_group+0x77>
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
jmp    11da <create_group+0x8a>
lea    0xe60(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <run_netplay@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"testroom\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [37 x i8] c"create room, %d, name:%s, passwd:%s\0A\00"
@.str.3 = [19 x i8] c"create room fail.\0A\00"
@.str.4 = [20 x i8] c"wait other player.\0A\00"
define i32 @create_group(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %7
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
store i8* %15, i8** %8
br label %17
16: ; preds = %2
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %8
br label %17
17: ; preds = %16, %12
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 2
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
store i8* %23, i8** %9
br label %25
24: ; preds = %17
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8** %9
br label %25
25: ; preds = %24, %20
%26 = load i32, i32* %4
%27 = icmp sgt i32 %26, 3
br i1 %27, label %28, label %33
28: ; preds = %25
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 3
%31 = load i8*, i8** %30
%32 = call i32 @atoi(i8* %31)
store i32 %32, i32* %7
br label %34
33: ; preds = %25
store i32 1, i32* %7
br label %34
34: ; preds = %33, %28
%35 = load i32, i32* %7
%36 = load i8*, i8** %8
%37 = load i8*, i8** %9
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %35, i8* %36, i8* %37)
%39 = load i32, i32* %7
%40 = load i8*, i8** %8
%41 = load i8*, i8** %9
%42 = call i32 @client_create_group(i32 %39, i8* %40, i8* %41)
store i32 %42, i32* %6
%43 = load i32, i32* %6
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %34
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %50
47: ; preds = %34
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%49 = call i32 (...) @run_netplay()
store i32 0, i32* %3
br label %50
50: ; preds = %47, %45
%51 = load i32, i32* %3
ret i32 %51
}

LLVM IR (-O2):
@.str = [9 x i8] c"testroom\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [37 x i8] c"create room, %d, name:%s, passwd:%s\0A\00"
@str = [19 x i8] c"wait other player.\00"
@str.5 = [18 x i8] c"create room fail.\00"
define i32 @create_group(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %16
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = icmp eq i32 %0, 2
br i1 %7, label %16, label %8
8: ; preds = %4
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = icmp ugt i32 %0, 3
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = getelementptr inbounds i8*, i8** %1, i64 3
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
br label %16
16: ; preds = %2, %4, %8, %12
%17 = phi i8* [ %10, %12 ], [ %10, %8 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %2 ]
%18 = phi i8* [ %6, %12 ], [ %6, %8 ], [ %6, %4 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %2 ]
%19 = phi i32 [ %15, %12 ], [ 1, %8 ], [ 1, %4 ], [ 1, %2 ]
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %19, i8* %18, i8* %17)
%21 = tail call i32 @client_create_group(i32 %19, i8* %18, i8* %17)
%22 = icmp eq i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %16
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.5, i64 0, i64 0))
br label %28
25: ; preds = %16
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%27 = tail call i32 (...) @run_netplay()
br label %28
28: ; preds = %25, %23
%29 = phi i32 [ -1, %23 ], [ 0, %25 ]
ret i32 %29
}