#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 uint32_t;

/* Variables and functions */
uint32_t SysCtlPIOSCCalibrate(uint32_t ui32Type) {
  if (ui32Type & (0x80000000 | 0x00000100)) {
    (*((volatile unsigned long *)(0x400FE150))) = ui32Type & 0x80000000;
    (*((volatile unsigned long *)(0x400FE150))) =
        ui32Type & (0x80000000 | 0x0000007F);
  }
  (*((volatile unsigned long *)(0x400FE150))) = ui32Type;
  if (ui32Type & 0x00000200) {
    while (((*((volatile unsigned long *)(0x400FE154))) & 0x00000300) == 0) {
    }
    if (((*((volatile unsigned long *)(0x400FE154))) & 0x00000300) !=
        0x00000100) {
      return (0);
    }
  }
  return (1);
}


x86 assembly (clang, -O0):
<SysCtlPIOSCCalibrate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x80000100,%eax
cmp    $0x0,%eax
je     1140 <SysCtlPIOSCCalibrate+0x40>
mov    -0x8(%rbp),%eax
and    $0x80000000,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x400fe150,%eax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%eax
and    $0x8000007f,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x400fe150,%eax
mov    %rcx,(%rax)
movslq -0x8(%rbp),%rcx
mov    $0x400fe150,%eax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%eax
and    $0x200,%eax
cmp    $0x0,%eax
je     11aa <SysCtlPIOSCCalibrate+0xaa>
jmp    1162 <SysCtlPIOSCCalibrate+0x62>
mov    $0x400fe154,%eax
mov    (%rax),%rax
and    $0x300,%rax
cmp    $0x0,%rax
jne    117f <SysCtlPIOSCCalibrate+0x7f>
jmp    1162 <SysCtlPIOSCCalibrate+0x62>
mov    $0x400fe154,%eax
mov    (%rax),%rax
and    $0x300,%rax
cmp    $0x100,%rax
je     11a5 <SysCtlPIOSCCalibrate+0xa5>
movl   $0x0,-0x4(%rbp)
jmp    11b1 <SysCtlPIOSCCalibrate+0xb1>
jmp    11aa <SysCtlPIOSCCalibrate+0xaa>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlPIOSCCalibrate>:
test   $0x80000100,%edi
je     1126 <SysCtlPIOSCCalibrate+0x26>
mov    %edi,%eax
and    $0x80000000,%eax
mov    %rax,0x400fe150
40
mov    %edi,%eax
and    $0x8000007f,%eax
mov    %rax,0x400fe150
40
movslq %edi,%rax
mov    %rax,0x400fe150
40
test   $0x200,%edi
je     1166 <SysCtlPIOSCCalibrate+0x66>
nopl   0x0(%rax)
testq  $0x300,0x400fe154
je     1140 <SysCtlPIOSCCalibrate+0x40>
mov    0x400fe154,%rcx
40
and    $0x300,%ecx
xor    %eax,%eax
cmp    $0x100,%ecx
jne    116b <SysCtlPIOSCCalibrate+0x6b>
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @SysCtlPIOSCCalibrate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, -2147483392
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %1
%8 = load i32, i32* %3
%9 = and i32 %8, -2147483648
%10 = zext i32 %9 to i64
store volatile i64 %10, i64* inttoptr (i64 1074782544 to i64*)
%11 = load i32, i32* %3
%12 = and i32 %11, -2147483521
%13 = zext i32 %12 to i64
store volatile i64 %13, i64* inttoptr (i64 1074782544 to i64*)
br label %14
14: ; preds = %7, %1
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
store volatile i64 %16, i64* inttoptr (i64 1074782544 to i64*)
%17 = load i32, i32* %3
%18 = and i32 %17, 512
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %32
20: ; preds = %14
br label %21
21: ; preds = %25, %20
%22 = load volatile i64, i64* inttoptr (i64 1074782548 to i64*)
%23 = and i64 %22, 768
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %21
br label %21
26: ; preds = %21
%27 = load volatile i64, i64* inttoptr (i64 1074782548 to i64*)
%28 = and i64 %27, 768
%29 = icmp ne i64 %28, 256
br i1 %29, label %30, label %31
30: ; preds = %26
store i32 0, i32* %2
br label %33
31: ; preds = %26
br label %32
32: ; preds = %31, %14
store i32 1, i32* %2
br label %33
33: ; preds = %32, %30
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
define i32 @SysCtlPIOSCCalibrate(i32 %0) {
%2 = and i32 %0, -2147483392
%3 = icmp eq i32 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = and i32 %0, -2147483648
%6 = zext i32 %5 to i64
store volatile i64 %6, i64* inttoptr (i64 1074782544 to i64*)
%7 = and i32 %0, -2147483521
%8 = zext i32 %7 to i64
store volatile i64 %8, i64* inttoptr (i64 1074782544 to i64*)
br label %9
9: ; preds = %4, %1
%10 = sext i32 %0 to i64
store volatile i64 %10, i64* inttoptr (i64 1074782544 to i64*)
%11 = and i32 %0, 512
%12 = icmp eq i32 %11, 0
br i1 %12, label %21, label %13
13: ; preds = %9, %13
%14 = load volatile i64, i64* inttoptr (i64 1074782548 to i64*)
%15 = and i64 %14, 768
%16 = icmp eq i64 %15, 0
br i1 %16, label %13, label %17
17: ; preds = %13
%18 = load volatile i64, i64* inttoptr (i64 1074782548 to i64*)
%19 = and i64 %18, 768
%20 = icmp eq i64 %19, 256
br i1 %20, label %21, label %22
21: ; preds = %17, %9
br label %22
22: ; preds = %17, %21
%23 = phi i32 [ 1, %21 ], [ 0, %17 ]
ret i32 %23
}