#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);
long UARTCharGet(unsigned long ulBase) {
  {
    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",
          1183);
    }
  };
  while ((*((volatile unsigned long *)(ulBase + 0x00000018))) & 0x00000010) {
  }
  return ((*((volatile unsigned long *)(ulBase + 0x00000000))));
}


x86 assembly (clang, -O0):
<UARTCharGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <UARTBaseValid@plt>
cmp    $0x0,%eax
jne    114f <UARTCharGet+0x2f>
lea    0xebb(%rip),%rdi
mov    $0x49f,%esi
call   1030 <AssertFailure@plt>
jmp    1154 <UARTCharGet+0x34>
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rax
and    $0x10,%rax
cmp    $0x0,%rax
je     116f <UARTCharGet+0x4f>
jmp    1154 <UARTCharGet+0x34>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTCharGet>:
push   %rbx
mov    %rdi,%rbx
call   1040 <UARTBaseValid@plt>
test   %eax,%eax
jne    1140 <UARTCharGet+0x20>
lea    0xecc(%rip),%rdi
mov    $0x49f,%esi
call   1030 <AssertFailure@plt>
xchg   %ax,%ax
testq  $0x10,0x18(%rbx)
jne    1140 <UARTCharGet+0x20>
mov    (%rbx),%rax
pop    %rbx
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 i64 @UARTCharGet(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @UARTBaseValid(i64 %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 @AssertFailure(i8* getelementptr inbounds ([201 x i8], [201 x i8]* @.str, i64 0, i64 0), i32 1183)
br label %8
8: ; preds = %6, %1
br label %9
9: ; preds = %16, %8
%10 = load i64, i64* %2
%11 = add i64 %10, 24
%12 = inttoptr i64 %11 to i64*
%13 = load volatile i64, i64* %12
%14 = and i64 %13, 16
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %9
br label %9
17: ; preds = %9
%18 = load i64, i64* %2
%19 = add i64 %18, 0
%20 = inttoptr i64 %19 to i64*
%21 = load volatile i64, i64* %20
ret i64 %21
}

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 i64 @UARTCharGet(i64 %0) {
%2 = tail call i32 @UARTBaseValid(i64 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @AssertFailure(i8* getelementptr inbounds ([201 x i8], [201 x i8]* @.str, i64 0, i64 0), i32 1183)
br label %6
6: ; preds = %4, %1
%7 = add i64 %0, 24
%8 = inttoptr i64 %7 to i64*
br label %9
9: ; preds = %9, %6
%10 = load volatile i64, i64* %8
%11 = and i64 %10, 16
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %9
13: ; preds = %9
%14 = inttoptr i64 %0 to i64*
%15 = load volatile i64, i64* %14
ret i64 %15
}