#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 */
scalar_t__ KSEG1ADDR(int);
unsigned int ar7100_gpio_float_high_test(unsigned int mask) {
  volatile unsigned int d;
  do {
    do {
      ((*(volatile unsigned int *)KSEG1ADDR((0x18000000 + 0x00040000 + 0x0))) =
           (((*(volatile unsigned int *)KSEG1ADDR(
                 (0x18000000 + 0x00040000 + 0x0))) &
             ~(mask))));
      (*(volatile unsigned int *)KSEG1ADDR((0x18000000 + 0x00040000 + 0x0)));
    } while (0);
    ;
    (*(volatile unsigned int *)KSEG1ADDR((0x18000000 + 0x00040000 + 0x0)));
  } while (0);
  ;
  d = (*(volatile unsigned int *)KSEG1ADDR(0x18000000 + 0x00040000 + 0x4));
  d = (*(volatile unsigned int *)KSEG1ADDR(0x18000000 + 0x00040000 + 0x4)) &
      mask;
  return d != mask;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
jmp    1120 <ar7100_gpio_float_high_test+0x10>
mov    $0x18040000,%edi
call   1030 <KSEG1ADDR@plt>
mov    (%rax),%eax
mov    -0x4(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    $0x18040000,%edi
call   1030 <KSEG1ADDR@plt>
mov    -0xc(%rbp),%ecx
mov    %ecx,(%rax)
mov    $0x18040000,%edi
call   1030 <KSEG1ADDR@plt>
mov    (%rax),%eax
mov    $0x18040000,%edi
call   1030 <KSEG1ADDR@plt>
mov    (%rax),%eax
mov    $0x18040004,%edi
call   1030 <KSEG1ADDR@plt>
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    $0x18040004,%edi
call   1030 <KSEG1ADDR@plt>
mov    (%rax),%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x18040000,%edi
call   1030 <KSEG1ADDR@plt>
mov    %ebx,%ebp
not    %ebp
and    (%rax),%ebp
mov    $0x18040000,%edi
call   1030 <KSEG1ADDR@plt>
mov    %ebp,(%rax)
mov    $0x18040000,%edi
call   1030 <KSEG1ADDR@plt>
mov    (%rax),%eax
mov    $0x18040000,%edi
call   1030 <KSEG1ADDR@plt>
mov    (%rax),%eax
mov    $0x18040004,%edi
call   1030 <KSEG1ADDR@plt>
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
mov    $0x18040004,%edi
call   1030 <KSEG1ADDR@plt>
mov    (%rax),%eax
and    %ebx,%eax
mov    %eax,0x4(%rsp)
mov    0x4(%rsp),%ecx
xor    %eax,%eax
cmp    %ebx,%ecx
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ar7100_gpio_float_high_test(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %1
br label %5
5: ; preds = %4
%6 = call i64 @KSEG1ADDR(i32 402915328)
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = load i32, i32* %2
%10 = xor i32 %9, -1
%11 = and i32 %8, %10
%12 = call i64 @KSEG1ADDR(i32 402915328)
%13 = inttoptr i64 %12 to i32*
store volatile i32 %11, i32* %13
%14 = call i64 @KSEG1ADDR(i32 402915328)
%15 = inttoptr i64 %14 to i32*
%16 = load volatile i32, i32* %15
br label %17
17: ; preds = %5
%18 = call i64 @KSEG1ADDR(i32 402915328)
%19 = inttoptr i64 %18 to i32*
%20 = load volatile i32, i32* %19
br label %21
21: ; preds = %17
%22 = call i64 @KSEG1ADDR(i32 402915332)
%23 = inttoptr i64 %22 to i32*
%24 = load volatile i32, i32* %23
store volatile i32 %24, i32* %3
%25 = call i64 @KSEG1ADDR(i32 402915332)
%26 = inttoptr i64 %25 to i32*
%27 = load volatile i32, i32* %26
%28 = load i32, i32* %2
%29 = and i32 %27, %28
store volatile i32 %29, i32* %3
%30 = load volatile i32, i32* %3
%31 = load i32, i32* %2
%32 = icmp ne i32 %30, %31
%33 = zext i1 %32 to i32
ret i32 %33
}

LLVM IR (-O2):
define i32 @ar7100_gpio_float_high_test(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i64 @KSEG1ADDR(i32 402915328)
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = xor i32 %0, -1
%8 = and i32 %6, %7
%9 = tail call i64 @KSEG1ADDR(i32 402915328)
%10 = inttoptr i64 %9 to i32*
store volatile i32 %8, i32* %10
%11 = tail call i64 @KSEG1ADDR(i32 402915328)
%12 = inttoptr i64 %11 to i32*
%13 = load volatile i32, i32* %12
%14 = tail call i64 @KSEG1ADDR(i32 402915328)
%15 = inttoptr i64 %14 to i32*
%16 = load volatile i32, i32* %15
%17 = tail call i64 @KSEG1ADDR(i32 402915332)
%18 = inttoptr i64 %17 to i32*
%19 = load volatile i32, i32* %18
store volatile i32 %19, i32* %2
%20 = tail call i64 @KSEG1ADDR(i32 402915332)
%21 = inttoptr i64 %20 to i32*
%22 = load volatile i32, i32* %21
%23 = and i32 %22, %0
store volatile i32 %23, i32* %2
%24 = load volatile i32, i32* %2
%25 = icmp ne i32 %24, %0
%26 = zext i1 %25 to i32
ret i32 %26
}