#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 wall {
  int dummy;
};
struct player {
  int dummy;
};
struct metadata {
  int dummy;
};
struct bomb {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ perror(char *);
int send_bomb(int, struct bomb *, int);
int send_meta(int, struct metadata *);
int send_player(int, struct player *, int);
int send_wall(int, struct wall *, int);
int /*<<< orphan*/ stderr;
int send_state_to_client(int fd, struct metadata *data, struct player *pl,
                         struct bomb *bo, int bo_cnt, struct wall *wa,
                         int wa_cnt) {
  if (send_meta(fd, data) == -1)
    perror("send_meta");
  if (send_player(fd, pl, 4) == -1)
    perror("send_meta");
  fprintf(stderr, "bo_cnt = %d\n", bo_cnt);
  if (send_bomb(fd, bo, bo_cnt) == -1)
    perror("send_meta");
  fprintf(stderr, "wa_cnt = %d\n", wa_cnt);
  if (send_wall(fd, wa, wa_cnt) == -1)
    perror("send_meta");
}


x86 assembly (clang, -O0):
<send_state_to_client>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <send_meta@plt>
cmp    $0xffffffff,%eax
jne    11a3 <send_state_to_client+0x43>
lea    0xe62(%rip),%rdi
call   1060 <perror@plt>
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    $0x4,%edx
call   1050 <send_player@plt>
cmp    $0xffffffff,%eax
jne    11c9 <send_state_to_client+0x69>
lea    0xe3c(%rip),%rdi
call   1060 <perror@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
mov    -0x24(%rbp),%edx
lea    0xe2e(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <send_bomb@plt>
cmp    $0xffffffff,%eax
jne    1205 <send_state_to_client+0xa5>
lea    0xe00(%rip),%rdi
call   1060 <perror@plt>
mov    0x2dd4(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbp),%edx
lea    0xdff(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    0x10(%rbp),%edx
call   1080 <send_wall@plt>
cmp    $0xffffffff,%eax
jne    1241 <send_state_to_client+0xe1>
lea    0xdc4(%rip),%rdi
call   1060 <perror@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_state_to_client>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8d,%r13d
mov    %rcx,%r15
mov    %rdx,%rbx
mov    %edi,%ebp
call   1070 <send_meta@plt>
cmp    $0xffffffff,%eax
je     11f8 <send_state_to_client+0x98>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1050 <send_player@plt>
cmp    $0xffffffff,%eax
je     1209 <send_state_to_client+0xa9>
mov    0x40(%rsp),%r12d
mov    0x2e3d(%rip),%rbx
mov    (%rbx),%edi
lea    0xe5e(%rip),%rsi
mov    %r13d,%edx
call   1040 <fprintf@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r13d,%edx
call   1030 <send_bomb@plt>
cmp    $0xffffffff,%eax
je     1217 <send_state_to_client+0xb7>
mov    (%rbx),%edi
lea    0xe48(%rip),%rsi
mov    %r12d,%edx
call   1040 <fprintf@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r12d,%edx
call   1080 <send_wall@plt>
cmp    $0xffffffff,%eax
je     1225 <send_state_to_client+0xc5>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe01(%rip),%rdi
call   1060 <perror@plt>
jmp    1183 <send_state_to_client+0x23>
lea    0xdf0(%rip),%rdi
call   1060 <perror@plt>
jmp    1197 <send_state_to_client+0x37>
lea    0xde2(%rip),%rdi
call   1060 <perror@plt>
jmp    11c6 <send_state_to_client+0x66>
lea    0xdd4(%rip),%rdi
call   1060 <perror@plt>
jmp    11e9 <send_state_to_client+0x89>

LLVM IR (-O0):
%struct.metadata = type { i32 }
%struct.player = type { i32 }
%struct.bomb = type { i32 }
%struct.wall = type { i32 }
@.str = [10 x i8] c"send_meta\00"
@stderr = global i32 0
@.str.1 = [13 x i8] c"bo_cnt = %d\0A\00"
@.str.2 = [13 x i8] c"wa_cnt = %d\0A\00"
define i32 @send_state_to_client(i32 %0, %struct.metadata* %1, %struct.player* %2, %struct.bomb* %3, i32 %4, %struct.wall* %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.metadata*
%11 = alloca %struct.player*
%12 = alloca %struct.bomb*
%13 = alloca i32
%14 = alloca %struct.wall*
%15 = alloca i32
store i32 %0, i32* %9
store %struct.metadata* %1, %struct.metadata** %10
store %struct.player* %2, %struct.player** %11
store %struct.bomb* %3, %struct.bomb** %12
store i32 %4, i32* %13
store %struct.wall* %5, %struct.wall** %14
store i32 %6, i32* %15
%16 = load i32, i32* %9
%17 = load %struct.metadata*, %struct.metadata** %10
%18 = call i32 @send_meta(i32 %16, %struct.metadata* %17)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %22
20: ; preds = %7
%21 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %20, %7
%23 = load i32, i32* %9
%24 = load %struct.player*, %struct.player** %11
%25 = call i32 @send_player(i32 %23, %struct.player* %24, i32 4)
%26 = icmp eq i32 %25, -1
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %29
29: ; preds = %27, %22
%30 = load i32, i32* @stderr
%31 = load i32, i32* %13
%32 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %9
%34 = load %struct.bomb*, %struct.bomb** %12
%35 = load i32, i32* %13
%36 = call i32 @send_bomb(i32 %33, %struct.bomb* %34, i32 %35)
%37 = icmp eq i32 %36, -1
br i1 %37, label %38, label %40
38: ; preds = %29
%39 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %40
40: ; preds = %38, %29
%41 = load i32, i32* @stderr
%42 = load i32, i32* %15
%43 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %9
%45 = load %struct.wall*, %struct.wall** %14
%46 = load i32, i32* %15
%47 = call i32 @send_wall(i32 %44, %struct.wall* %45, i32 %46)
%48 = icmp eq i32 %47, -1
br i1 %48, label %49, label %51
49: ; preds = %40
%50 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %51
51: ; preds = %49, %40
%52 = load i32, i32* %8
ret i32 %52
}

LLVM IR (-O2):
%struct.metadata = type { i32 }
%struct.player = type { i32 }
%struct.bomb = type { i32 }
%struct.wall = type { i32 }
@.str = [10 x i8] c"send_meta\00"
@stderr = global i32 0
@.str.1 = [13 x i8] c"bo_cnt = %d\0A\00"
@.str.2 = [13 x i8] c"wa_cnt = %d\0A\00"
define i32 @send_state_to_client(i32 %0, %struct.metadata* %1, %struct.player* %2, %struct.bomb* %3, i32 %4, %struct.wall* %5, i32 %6) {
%8 = tail call i32 @send_meta(i32 %0, %struct.metadata* %1)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
%13 = tail call i32 @send_player(i32 %0, %struct.player* %2, i32 4)
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = tail call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%20 = tail call i32 @send_bomb(i32 %0, %struct.bomb* %3, i32 %4)
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = tail call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %22, %17
%25 = load i32, i32* @stderr
%26 = tail call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%27 = tail call i32 @send_wall(i32 %0, %struct.wall* %5, i32 %6)
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = tail call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %31
31: ; preds = %29, %24
ret i32 undef
}