#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*/ mapif_sendall(unsigned char *, int);
int /*<<< orphan*/ printf(char *, int);
int mapif_party_broken(int party_id, int flag) {
  unsigned char buf[16];
  (*(unsigned short *)(((unsigned char *)(buf)) + (0))) = 0x3826;
  (*(unsigned int *)(((unsigned char *)(buf)) + (2))) = party_id;
  (*(unsigned char *)(((unsigned char *)(buf)) + (6))) = flag;
  mapif_sendall(buf, 7);
  printf("int_party: broken %d\n", party_id);
  return 0;
}


x86 assembly (clang, -O0):
<mapif_party_broken>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movw   $0x3826,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1e(%rbp)
mov    -0x8(%rbp),%eax
mov    %al,-0x1a(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1030 <mapif_sendall@plt>
mov    -0x4(%rbp),%esi
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mapif_party_broken>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movw   $0x3826,(%rsp)
mov    %edi,0x2(%rsp)
mov    %sil,0x6(%rsp)
mov    %rsp,%rdi
mov    $0x7,%esi
call   1030 <mapif_sendall@plt>
lea    0xeb6(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"int_party: broken %d\0A\00"
define i32 @mapif_party_broken(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [16 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = bitcast i8* %7 to i16*
store i16 14374, i16* %8
%9 = load i32, i32* %3
%10 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds i8, i8* %10, i64 2
%12 = bitcast i8* %11 to i32*
store i32 %9, i32* %12
%13 = load i32, i32* %4
%14 = trunc i32 %13 to i8
%15 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%16 = getelementptr inbounds i8, i8* %15, i64 6
store i8 %14, i8* %16
%17 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%18 = call i32 @mapif_sendall(i8* %17, i32 7)
%19 = load i32, i32* %3
%20 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"int_party: broken %d\0A\00"
define i32 @mapif_party_broken(i32 %0, i32 %1) {
%3 = alloca [16 x i8]
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%5 = bitcast [16 x i8]* %3 to i16*
store i16 14374, i16* %5
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 2
%7 = bitcast i8* %6 to i32*
store i32 %0, i32* %7
%8 = trunc i32 %1 to i8
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 6
store i8 %8, i8* %9
%10 = call i32 @mapif_sendall(i8* %4, i32 7)
%11 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 0
}