#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*/ AssertFailure(char *, int);
int /*<<< orphan*/ UARTBaseValid(unsigned long);
void UART9BitAddrSend(unsigned long ulBase, unsigned char ucAddr) {
  unsigned long ulLCRH;
  {
    if (!(UARTBaseValid(ulBase))) {
      AssertFailure(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/AmesianX/OpenBLT/refs/heads/master/Target/"
          "Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/lib/driverlib/"
          "uartlib.c",
          1909);
    }
  };
  while ((*((volatile unsigned long *)(ulBase + 0x00000018))) &
         (0x00000080 | 0x00000008)) {
  }
  ulLCRH = (*((volatile unsigned long *)(ulBase + 0x0000002C)));
  (*((volatile unsigned long *)(ulBase + 0x0000002C))) =
      ((ulLCRH & ~0x00000004) | 0x00000080 | 0x00000002);
  (*((volatile unsigned long *)(ulBase + 0x00000000))) = ucAddr;
  while ((*((volatile unsigned long *)(ulBase + 0x00000018))) &
         (0x00000080 | 0x00000008)) {
  }
  (*((volatile unsigned long *)(ulBase + 0x0000002C))) = ulLCRH;
}


x86 assembly (clang, -O0):
<UART9BitAddrSend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <UARTBaseValid@plt>
cmp    $0x0,%eax
jne    1155 <UART9BitAddrSend+0x35>
lea    0xeb5(%rip),%rdi
mov    $0x775,%esi
call   1030 <AssertFailure@plt>
jmp    115a <UART9BitAddrSend+0x3a>
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rax
and    $0x88,%rax
cmp    $0x0,%rax
je     1177 <UART9BitAddrSend+0x57>
jmp    115a <UART9BitAddrSend+0x3a>
mov    -0x8(%rbp),%rax
mov    0x2c(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
and    $0xfffffffffffffffb,%rcx
or     $0x80,%rcx
or     $0x2,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x2c(%rax)
movzbl -0x9(%rbp),%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rax
and    $0x88,%rax
cmp    $0x0,%rax
je     11c8 <UART9BitAddrSend+0xa8>
jmp    11ab <UART9BitAddrSend+0x8b>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x2c(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UART9BitAddrSend>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1040 <UARTBaseValid@plt>
test   %eax,%eax
jne    1150 <UART9BitAddrSend+0x30>
lea    0xec8(%rip),%rdi
mov    $0x775,%esi
call   1030 <AssertFailure@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
testq  $0x88,0x18(%rbx)
jne    1150 <UART9BitAddrSend+0x30>
mov    0x2c(%rbx),%rax
mov    %rax,%rcx
and    $0xffffffffffffff79,%rcx
or     $0x82,%rcx
mov    %rcx,0x2c(%rbx)
movzbl %bpl,%ecx
mov    %rcx,(%rbx)
nopw   0x0(%rax,%rax,1)
testq  $0x88,0x18(%rbx)
jne    1180 <UART9BitAddrSend+0x60>
mov    %rax,0x2c(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [201 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AmesianX/OpenBLT/refs/heads/master/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/lib/driverlib/uartlib.c\00"
define void @UART9BitAddrSend(i64 %0, i8 zeroext %1) {
%3 = alloca i64
%4 = alloca i8
%5 = alloca i64
store i64 %0, i64* %3
store i8 %1, i8* %4
%6 = load i64, i64* %3
%7 = call i32 @UARTBaseValid(i64 %6)
%8 = icmp ne i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = call i32 @AssertFailure(i8* getelementptr inbounds ([201 x i8], [201 x i8]* @.str, i64 0, i64 0), i32 1909)
br label %11
11: ; preds = %9, %2
br label %12
12: ; preds = %19, %11
%13 = load i64, i64* %3
%14 = add i64 %13, 24
%15 = inttoptr i64 %14 to i64*
%16 = load volatile i64, i64* %15
%17 = and i64 %16, 136
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %12
br label %12
20: ; preds = %12
%21 = load i64, i64* %3
%22 = add i64 %21, 44
%23 = inttoptr i64 %22 to i64*
%24 = load volatile i64, i64* %23
store i64 %24, i64* %5
%25 = load i64, i64* %5
%26 = and i64 %25, -5
%27 = or i64 %26, 128
%28 = or i64 %27, 2
%29 = load i64, i64* %3
%30 = add i64 %29, 44
%31 = inttoptr i64 %30 to i64*
store volatile i64 %28, i64* %31
%32 = load i8, i8* %4
%33 = zext i8 %32 to i64
%34 = load i64, i64* %3
%35 = add i64 %34, 0
%36 = inttoptr i64 %35 to i64*
store volatile i64 %33, i64* %36
br label %37
37: ; preds = %44, %20
%38 = load i64, i64* %3
%39 = add i64 %38, 24
%40 = inttoptr i64 %39 to i64*
%41 = load volatile i64, i64* %40
%42 = and i64 %41, 136
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %37
br label %37
45: ; preds = %37
%46 = load i64, i64* %5
%47 = load i64, i64* %3
%48 = add i64 %47, 44
%49 = inttoptr i64 %48 to i64*
store volatile i64 %46, i64* %49
ret void
}

LLVM IR (-O2):
@.str = [201 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AmesianX/OpenBLT/refs/heads/master/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/lib/driverlib/uartlib.c\00"
define void @UART9BitAddrSend(i64 %0, i8 zeroext %1) {
%3 = tail call i32 @UARTBaseValid(i64 %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @AssertFailure(i8* getelementptr inbounds ([201 x i8], [201 x i8]* @.str, i64 0, i64 0), i32 1909)
br label %7
7: ; preds = %5, %2
%8 = add i64 %0, 24
%9 = inttoptr i64 %8 to i64*
br label %10
10: ; preds = %10, %7
%11 = load volatile i64, i64* %9
%12 = and i64 %11, 136
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %10
14: ; preds = %10
%15 = add i64 %0, 44
%16 = inttoptr i64 %15 to i64*
%17 = load volatile i64, i64* %16
%18 = and i64 %17, -135
%19 = or i64 %18, 130
store volatile i64 %19, i64* %16
%20 = zext i8 %1 to i64
%21 = inttoptr i64 %0 to i64*
store volatile i64 %20, i64* %21
br label %22
22: ; preds = %22, %14
%23 = load volatile i64, i64* %9
%24 = and i64 %23, 136
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %22
26: ; preds = %22
store volatile i64 %17, i64* %16
ret void
}