#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*/ gds_swap2bytes(unsigned char *);
int /*<<< orphan*/ gds_swap4bytes(unsigned char *);
int /*<<< orphan*/ write(int, ...);
void gds_write_width(int fd, int width) {
  static short int count, token;
  count = 8;
  gds_swap2bytes((unsigned char *)&count);
  write(fd, &count, 2);
  token = 0x0F03;
  gds_swap2bytes((unsigned char *)&token);
  write(fd, &token, 2);
  gds_swap4bytes((unsigned char *)&width);
  write(fd, &width, 4);
}


x86 assembly (clang, -O0):
<gds_write_width>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movw   $0x8,0x2ef3(%rip)
lea    0x2eec(%rip),%rdi
call   1040 <gds_swap2bytes@plt>
mov    -0x4(%rbp),%edi
lea    0x2edd(%rip),%rsi
mov    $0x2,%edx
mov    $0x0,%al
call   1030 <write@plt>
movw   $0xf03,0x2eca(%rip)
03 0f
lea    0x2ec3(%rip),%rdi
call   1040 <gds_swap2bytes@plt>
mov    -0x4(%rbp),%edi
lea    0x2eb4(%rip),%rsi
mov    $0x2,%edx
mov    $0x0,%al
call   1030 <write@plt>
lea    -0x8(%rbp),%rdi
call   1050 <gds_swap4bytes@plt>
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gds_write_width>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %esi,0x4(%rsp)
movw   $0x8,0x2ef7(%rip)
lea    0x2ef0(%rip),%r14
mov    %r14,%rdi
call   1040 <gds_swap2bytes@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x2,%edx
xor    %eax,%eax
call   1030 <write@plt>
movw   $0xf03,0x2ed0(%rip)
03 0f
lea    0x2ec9(%rip),%r14
mov    %r14,%rdi
call   1040 <gds_swap2bytes@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x2,%edx
xor    %eax,%eax
call   1030 <write@plt>
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1050 <gds_swap4bytes@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   1030 <write@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@gds_write_width.count = internal global i16 0
@gds_write_width.token = internal global i16 0
define void @gds_write_width(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i16 8, i16* @gds_write_width.count
%5 = call i32 @gds_swap2bytes(i8* bitcast (i16* @gds_write_width.count to i8*))
%6 = load i32, i32* %3
%7 = call i32 (i32, ...) @write(i32 %6, i16* @gds_write_width.count, i32 2)
store i16 3843, i16* @gds_write_width.token
%8 = call i32 @gds_swap2bytes(i8* bitcast (i16* @gds_write_width.token to i8*))
%9 = load i32, i32* %3
%10 = call i32 (i32, ...) @write(i32 %9, i16* @gds_write_width.token, i32 2)
%11 = bitcast i32* %4 to i8*
%12 = call i32 @gds_swap4bytes(i8* %11)
%13 = load i32, i32* %3
%14 = call i32 (i32, ...) @write(i32 %13, i32* %4, i32 4)
ret void
}

LLVM IR (-O2):
@gds_write_width.count = internal global i16 0
@gds_write_width.token = internal global i16 0
define void @gds_write_width(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
store i16 8, i16* @gds_write_width.count
%4 = tail call i32 @gds_swap2bytes(i8* bitcast (i16* @gds_write_width.count to i8*))
%5 = tail call i32 (i32, ...) @write(i32 %0, i16* @gds_write_width.count, i32 2)
store i16 3843, i16* @gds_write_width.token
%6 = tail call i32 @gds_swap2bytes(i8* bitcast (i16* @gds_write_width.token to i8*))
%7 = tail call i32 (i32, ...) @write(i32 %0, i16* @gds_write_width.token, i32 2)
%8 = bitcast i32* %3 to i8*
%9 = call i32 @gds_swap4bytes(i8* %8)
%10 = call i32 (i32, ...) @write(i32 %0, i32* %3, i32 4)
ret void
}