#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 xrdp_mcs {
  int dummy;
};
struct stream {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ xrdp_mcs_ber_out_header(struct xrdp_mcs *, struct stream *,
                                           int, int);
int /*<<< orphan*/ xrdp_mcs_ber_out_int24(struct xrdp_mcs *, struct stream *,
                                          int);
int /*<<< orphan*/ xrdp_mcs_ber_out_int8(struct xrdp_mcs *, struct stream *,
                                         int);
int xrdp_mcs_out_domain_params(struct xrdp_mcs *self, struct stream *s,
                               int max_channels, int max_users, int max_tokens,
                               int max_pdu_size) {
  xrdp_mcs_ber_out_header(self, s, 0x30, 26);
  xrdp_mcs_ber_out_int8(self, s, max_channels);
  xrdp_mcs_ber_out_int8(self, s, max_users);
  xrdp_mcs_ber_out_int8(self, s, max_tokens);
  xrdp_mcs_ber_out_int8(self, s, 1);
  xrdp_mcs_ber_out_int8(self, s, 0);
  xrdp_mcs_ber_out_int8(self, s, 1);
  xrdp_mcs_ber_out_int24(self, s, max_pdu_size);
  xrdp_mcs_ber_out_int8(self, s, 2);
  return 0;
}


x86 assembly (clang, -O0):
<xrdp_mcs_out_domain_params>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x30,%edx
mov    $0x1a,%ecx
call   1040 <xrdp_mcs_ber_out_header@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <xrdp_mcs_ber_out_int8@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1030 <xrdp_mcs_ber_out_int8@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <xrdp_mcs_ber_out_int8@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1030 <xrdp_mcs_ber_out_int8@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1030 <xrdp_mcs_ber_out_int8@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1030 <xrdp_mcs_ber_out_int8@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1050 <xrdp_mcs_ber_out_int24@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x2,%edx
call   1030 <xrdp_mcs_ber_out_int8@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrdp_mcs_out_domain_params>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r15d
mov    %r8d,%r12d
mov    %ecx,%r13d
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x30,%edx
mov    $0x1a,%ecx
call   1040 <xrdp_mcs_ber_out_header@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1030 <xrdp_mcs_ber_out_int8@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r13d,%edx
call   1030 <xrdp_mcs_ber_out_int8@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12d,%edx
call   1030 <xrdp_mcs_ber_out_int8@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <xrdp_mcs_ber_out_int8@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <xrdp_mcs_ber_out_int8@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <xrdp_mcs_ber_out_int8@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1050 <xrdp_mcs_ber_out_int24@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2,%edx
call   1030 <xrdp_mcs_ber_out_int8@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.xrdp_mcs = type { i32 }
%struct.stream = type { i32 }
define i32 @xrdp_mcs_out_domain_params(%struct.xrdp_mcs* %0, %struct.stream* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca %struct.xrdp_mcs*
%8 = alloca %struct.stream*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store %struct.xrdp_mcs* %0, %struct.xrdp_mcs** %7
store %struct.stream* %1, %struct.stream** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load %struct.xrdp_mcs*, %struct.xrdp_mcs** %7
%14 = load %struct.stream*, %struct.stream** %8
%15 = call i32 @xrdp_mcs_ber_out_header(%struct.xrdp_mcs* %13, %struct.stream* %14, i32 48, i32 26)
%16 = load %struct.xrdp_mcs*, %struct.xrdp_mcs** %7
%17 = load %struct.stream*, %struct.stream** %8
%18 = load i32, i32* %9
%19 = call i32 @xrdp_mcs_ber_out_int8(%struct.xrdp_mcs* %16, %struct.stream* %17, i32 %18)
%20 = load %struct.xrdp_mcs*, %struct.xrdp_mcs** %7
%21 = load %struct.stream*, %struct.stream** %8
%22 = load i32, i32* %10
%23 = call i32 @xrdp_mcs_ber_out_int8(%struct.xrdp_mcs* %20, %struct.stream* %21, i32 %22)
%24 = load %struct.xrdp_mcs*, %struct.xrdp_mcs** %7
%25 = load %struct.stream*, %struct.stream** %8
%26 = load i32, i32* %11
%27 = call i32 @xrdp_mcs_ber_out_int8(%struct.xrdp_mcs* %24, %struct.stream* %25, i32 %26)
%28 = load %struct.xrdp_mcs*, %struct.xrdp_mcs** %7
%29 = load %struct.stream*, %struct.stream** %8
%30 = call i32 @xrdp_mcs_ber_out_int8(%struct.xrdp_mcs* %28, %struct.stream* %29, i32 1)
%31 = load %struct.xrdp_mcs*, %struct.xrdp_mcs** %7
%32 = load %struct.stream*, %struct.stream** %8
%33 = call i32 @xrdp_mcs_ber_out_int8(%struct.xrdp_mcs* %31, %struct.stream* %32, i32 0)
%34 = load %struct.xrdp_mcs*, %struct.xrdp_mcs** %7
%35 = load %struct.stream*, %struct.stream** %8
%36 = call i32 @xrdp_mcs_ber_out_int8(%struct.xrdp_mcs* %34, %struct.stream* %35, i32 1)
%37 = load %struct.xrdp_mcs*, %struct.xrdp_mcs** %7
%38 = load %struct.stream*, %struct.stream** %8
%39 = load i32, i32* %12
%40 = call i32 @xrdp_mcs_ber_out_int24(%struct.xrdp_mcs* %37, %struct.stream* %38, i32 %39)
%41 = load %struct.xrdp_mcs*, %struct.xrdp_mcs** %7
%42 = load %struct.stream*, %struct.stream** %8
%43 = call i32 @xrdp_mcs_ber_out_int8(%struct.xrdp_mcs* %41, %struct.stream* %42, i32 2)
ret i32 0
}

LLVM IR (-O2):
%struct.xrdp_mcs = type { i32 }
%struct.stream = type { i32 }
define i32 @xrdp_mcs_out_domain_params(%struct.xrdp_mcs* %0, %struct.stream* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @xrdp_mcs_ber_out_header(%struct.xrdp_mcs* %0, %struct.stream* %1, i32 48, i32 26)
%8 = tail call i32 @xrdp_mcs_ber_out_int8(%struct.xrdp_mcs* %0, %struct.stream* %1, i32 %2)
%9 = tail call i32 @xrdp_mcs_ber_out_int8(%struct.xrdp_mcs* %0, %struct.stream* %1, i32 %3)
%10 = tail call i32 @xrdp_mcs_ber_out_int8(%struct.xrdp_mcs* %0, %struct.stream* %1, i32 %4)
%11 = tail call i32 @xrdp_mcs_ber_out_int8(%struct.xrdp_mcs* %0, %struct.stream* %1, i32 1)
%12 = tail call i32 @xrdp_mcs_ber_out_int8(%struct.xrdp_mcs* %0, %struct.stream* %1, i32 0)
%13 = tail call i32 @xrdp_mcs_ber_out_int8(%struct.xrdp_mcs* %0, %struct.stream* %1, i32 1)
%14 = tail call i32 @xrdp_mcs_ber_out_int24(%struct.xrdp_mcs* %0, %struct.stream* %1, i32 %5)
%15 = tail call i32 @xrdp_mcs_ber_out_int8(%struct.xrdp_mcs* %0, %struct.stream* %1, i32 2)
ret i32 0
}