#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 */
typedef int int16_t;

/* Variables and functions */
int /*<<< orphan*/ U_WMRCORE_N16_swap(char *, int, int);
int /*<<< orphan*/ U_swap2(char *, int);
void U_WMRTEXTOUT_swap(char *record, int torev) {
  int L2;
  if (torev) {
    L2 = *(int16_t *)(record + 6);
  }
  U_WMRCORE_N16_swap(record, 1, torev);
  if (!torev) {
    L2 = *(int16_t *)(record + 6);
  }
  U_swap2(record + 8 + L2, 2);
}


x86 assembly (clang, -O0):
<U_WMRTEXTOUT_swap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1143 <U_WMRTEXTOUT_swap+0x23>
mov    -0x8(%rbp),%rax
mov    0x6(%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    $0x1,%esi
call   1040 <U_WMRCORE_N16_swap@plt>
cmpl   $0x0,-0xc(%rbp)
jne    1168 <U_WMRTEXTOUT_swap+0x48>
mov    -0x8(%rbp),%rax
mov    0x6(%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x8,%rdi
movslq -0x10(%rbp),%rax
add    %rax,%rdi
mov    $0x2,%esi
call   1030 <U_swap2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<U_WMRTEXTOUT_swap>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
test   %esi,%esi
je     113e <U_WMRTEXTOUT_swap+0x1e>
mov    %esi,%edx
mov    0x6(%rbx),%ebp
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <U_WMRCORE_N16_swap@plt>
jmp    1150 <U_WMRTEXTOUT_swap+0x30>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1040 <U_WMRCORE_N16_swap@plt>
mov    0x6(%rbx),%ebp
movslq %ebp,%rax
lea    (%rbx,%rax,1),%rdi
add    $0x8,%rdi
mov    $0x2,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <U_swap2@plt>

LLVM IR (-O0):
define void @U_WMRTEXTOUT_swap(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 6
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
store i32 %12, i32* %5
br label %13
13: ; preds = %8, %2
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = call i32 @U_WMRCORE_N16_swap(i8* %14, i32 1, i32 %15)
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 0
br i1 %18, label %24, label %19
19: ; preds = %13
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 6
%22 = bitcast i8* %21 to i32*
%23 = load i32, i32* %22
store i32 %23, i32* %5
br label %24
24: ; preds = %19, %13
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 8
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = call i32 @U_swap2(i8* %29, i32 2)
ret void
}

LLVM IR (-O2):
define void @U_WMRTEXTOUT_swap(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8, i8* %0, i64 6
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = tail call i32 @U_WMRCORE_N16_swap(i8* %0, i32 1, i32 %1)
br label %14
9: ; preds = %2
%10 = tail call i32 @U_WMRCORE_N16_swap(i8* %0, i32 1, i32 0)
%11 = getelementptr inbounds i8, i8* %0, i64 6
%12 = bitcast i8* %11 to i32*
%13 = load i32, i32* %12
br label %14
14: ; preds = %4, %9
%15 = phi i32 [ %7, %4 ], [ %13, %9 ]
%16 = getelementptr inbounds i8, i8* %0, i64 8
%17 = sext i32 %15 to i64
%18 = getelementptr inbounds i8, i8* %16, i64 %17
%19 = tail call i32 @U_swap2(i8* %18, i32 2)
ret void
}