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

/* Variables and functions */
int /*<<< orphan*/ rdp_mcs_ber_out_header(struct rdp_mcs *, struct stream *,
                                          int, int);
int /*<<< orphan*/ rdp_mcs_ber_out_int16(struct rdp_mcs *, struct stream *,
                                         int);
int rdp_mcs_out_domain_params(struct rdp_mcs *self, struct stream *s,
                              int max_channels, int max_users, int max_tokens,
                              int max_pdu_size) {
  rdp_mcs_ber_out_header(self, s, 0x30, 32);
  rdp_mcs_ber_out_int16(self, s, max_channels);
  rdp_mcs_ber_out_int16(self, s, max_users);
  rdp_mcs_ber_out_int16(self, s, max_tokens);
  rdp_mcs_ber_out_int16(self, s, 1);
  rdp_mcs_ber_out_int16(self, s, 0);
  rdp_mcs_ber_out_int16(self, s, 1);
  rdp_mcs_ber_out_int16(self, s, max_pdu_size);
  rdp_mcs_ber_out_int16(self, s, 2);
  return 0;
}


x86 assembly (clang, -O0):
<rdp_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    $0x20,%ecx
call   1030 <rdp_mcs_ber_out_header@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <rdp_mcs_ber_out_int16@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1040 <rdp_mcs_ber_out_int16@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <rdp_mcs_ber_out_int16@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1040 <rdp_mcs_ber_out_int16@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1040 <rdp_mcs_ber_out_int16@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1040 <rdp_mcs_ber_out_int16@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1040 <rdp_mcs_ber_out_int16@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x2,%edx
call   1040 <rdp_mcs_ber_out_int16@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdp_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    $0x20,%ecx
call   1030 <rdp_mcs_ber_out_header@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <rdp_mcs_ber_out_int16@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r13d,%edx
call   1040 <rdp_mcs_ber_out_int16@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12d,%edx
call   1040 <rdp_mcs_ber_out_int16@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <rdp_mcs_ber_out_int16@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1040 <rdp_mcs_ber_out_int16@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <rdp_mcs_ber_out_int16@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1040 <rdp_mcs_ber_out_int16@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2,%edx
call   1040 <rdp_mcs_ber_out_int16@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.rdp_mcs = type { i32 }
%struct.stream = type { i32 }
define i32 @rdp_mcs_out_domain_params(%struct.rdp_mcs* %0, %struct.stream* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @rdp_mcs_ber_out_header(%struct.rdp_mcs* %0, %struct.stream* %1, i32 48, i32 32)
%8 = tail call i32 @rdp_mcs_ber_out_int16(%struct.rdp_mcs* %0, %struct.stream* %1, i32 %2)
%9 = tail call i32 @rdp_mcs_ber_out_int16(%struct.rdp_mcs* %0, %struct.stream* %1, i32 %3)
%10 = tail call i32 @rdp_mcs_ber_out_int16(%struct.rdp_mcs* %0, %struct.stream* %1, i32 %4)
%11 = tail call i32 @rdp_mcs_ber_out_int16(%struct.rdp_mcs* %0, %struct.stream* %1, i32 1)
%12 = tail call i32 @rdp_mcs_ber_out_int16(%struct.rdp_mcs* %0, %struct.stream* %1, i32 0)
%13 = tail call i32 @rdp_mcs_ber_out_int16(%struct.rdp_mcs* %0, %struct.stream* %1, i32 1)
%14 = tail call i32 @rdp_mcs_ber_out_int16(%struct.rdp_mcs* %0, %struct.stream* %1, i32 %5)
%15 = tail call i32 @rdp_mcs_ber_out_int16(%struct.rdp_mcs* %0, %struct.stream* %1, i32 2)
ret i32 0
}