unsigned long SysCtlPIOSCCalibrate(unsigned long ulType) {
  if (ulType & (0x80000000 | 0x00000100)) {
    (*((volatile unsigned long *)(0x400FE150))) = ulType & 0x80000000;
    (*((volatile unsigned long *)(0x400FE150))) =
        ulType & (0x80000000 | 0x0000007F);
  }
  (*((volatile unsigned long *)(0x400FE150))) = ulType;
  if (ulType & 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    %rdi,-0x10(%rbp)
movabs $0x80000100,%rax
and    -0x10(%rbp),%rax
cmp    $0x0,%rax
je     114c <SysCtlPIOSCCalibrate+0x4c>
movabs $0x80000000,%rcx
and    -0x10(%rbp),%rcx
mov    $0x400fe150,%eax
mov    %rcx,(%rax)
movabs $0x8000007f,%rcx
and    -0x10(%rbp),%rcx
mov    $0x400fe150,%eax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rcx
mov    $0x400fe150,%eax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
and    $0x200,%rax
cmp    $0x0,%rax
je     11ba <SysCtlPIOSCCalibrate+0xba>
jmp    1171 <SysCtlPIOSCCalibrate+0x71>
mov    $0x400fe154,%eax
mov    (%rax),%rax
and    $0x300,%rax
cmp    $0x0,%rax
jne    118e <SysCtlPIOSCCalibrate+0x8e>
jmp    1171 <SysCtlPIOSCCalibrate+0x71>
mov    $0x400fe154,%eax
mov    (%rax),%rax
and    $0x300,%rax
cmp    $0x100,%rax
je     11b5 <SysCtlPIOSCCalibrate+0xb5>
movq   $0x0,-0x8(%rbp)
jmp    11c2 <SysCtlPIOSCCalibrate+0xc2>
jmp    11ba <SysCtlPIOSCCalibrate+0xba>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rax
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
mov    %rdi,0x400fe150
40
test   $0x200,%edi
je     1162 <SysCtlPIOSCCalibrate+0x62>
cs nopw 0x0(%rax,%rax,1)
testq  $0x300,0x400fe154
je     1140 <SysCtlPIOSCCalibrate+0x40>
mov    0x400fe154,%rax
40
and    $0x300,%eax
cmp    $0x100,%eax
jne    1168 <SysCtlPIOSCCalibrate+0x68>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

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

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