#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 */
unsigned int GET32(int);
int /*<<< orphan*/ PUT32(int, int);
int /*<<< orphan*/ dummy(unsigned int);
void gpio_init(void) {
  unsigned int ra;
  PUT32((0x20201000 + 0x30), 0);
  ra = GET32(0x20200004);
  ra &= ~(7 << 12);
  ra |= 4 << 12;
  ra &= ~(7 << 15);
  ra |= 4 << 15;
  ra &= ~(7 << 24);
  ra |= 2 << 24;
  ra &= ~(7 << 21);
  PUT32(0x20200004, ra);
  ra = GET32(0x20200000);
  ra &= ~(7 << 21);
  ra |= 1 << 21;
  ra &= ~(7 << 24);
  ra |= 1 << 24;
  ra &= ~(7 << 27);
  ra &= ~(7 << 0);
  ra |= (4 << 0);
  ra &= ~(7 << 3);
  ra |= (4 << 3);
  ra &= ~(7 << 6);
  ra |= (4 << 6);
  ra &= ~(7 << 9);
  ra |= (4 << 9);
  PUT32(0x20200000, ra);
  PUT32(0x20200094, 0);
  for (ra = 0; ra < 150; ra++)
    dummy(ra);
  PUT32(0x20200098,
        (1 << 14) | (1 << 15) | (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3));
  for (ra = 0; ra < 150; ra++)
    dummy(ra);
  PUT32(0x20200098, 0);
  PUT32(0x20200094, 1);
  for (ra = 0; ra < 150; ra++)
    dummy(ra);
  PUT32(0x20200098, (1 << 18) | (1 << 17) | (1 << 6) | (1 << 7) | (1 << 9));
  for (ra = 0; ra < 150; ra++)
    dummy(ra);
  PUT32(0x20200098, 0);
  PUT32(0x20200058, (1 << 17) | (1 << 9));
  PUT32(0x2020004C, (1 << 17) | (1 << 9));
}


x86 assembly (clang, -O0):
<gpio_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x20201030,%edi
xor    %esi,%esi
call   1040 <PUT32@plt>
mov    $0x20200004,%edi
call   1050 <GET32@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff8fff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x4000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfffc7fff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x20000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf8ffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x2000000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff1fffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x20200004,%edi
call   1040 <PUT32@plt>
mov    $0x20200000,%edi
call   1050 <GET32@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff1fffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x200000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf8ffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x1000000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xc7ffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfffffff8,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x4,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffffc7,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x20,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfffffe3f,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x100,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfffff1ff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x800,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x20200000,%edi
call   1040 <PUT32@plt>
mov    $0x20200094,%edi
xor    %esi,%esi
call   1040 <PUT32@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x96,-0x4(%rbp)
jae    1282 <gpio_init+0x152>
mov    -0x4(%rbp),%edi
call   1030 <dummy@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    125f <gpio_init+0x12f>
mov    $0x20200098,%edi
mov    $0xc00f,%esi
call   1040 <PUT32@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x96,-0x4(%rbp)
jae    12bb <gpio_init+0x18b>
mov    -0x4(%rbp),%edi
call   1030 <dummy@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1298 <gpio_init+0x168>
mov    $0x20200098,%edi
xor    %esi,%esi
call   1040 <PUT32@plt>
mov    $0x20200094,%edi
mov    $0x1,%esi
call   1040 <PUT32@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x96,-0x4(%rbp)
jae    1300 <gpio_init+0x1d0>
mov    -0x4(%rbp),%edi
call   1030 <dummy@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    12dd <gpio_init+0x1ad>
mov    $0x20200098,%edi
mov    $0x602c0,%esi
call   1040 <PUT32@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x96,-0x4(%rbp)
jae    1339 <gpio_init+0x209>
mov    -0x4(%rbp),%edi
call   1030 <dummy@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1316 <gpio_init+0x1e6>
mov    $0x20200098,%edi
xor    %esi,%esi
call   1040 <PUT32@plt>
mov    $0x20200058,%edi
mov    $0x20200,%esi
call   1040 <PUT32@plt>
mov    $0x2020004c,%edi
mov    $0x20200,%esi
call   1040 <PUT32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpio_init>:
push   %rbx
xor    %ebx,%ebx
mov    $0x20201030,%edi
xor    %esi,%esi
call   1040 <PUT32@plt>
mov    $0x20200004,%edi
call   1050 <GET32@plt>
and    $0xf81c0fff,%eax
lea    0x2024000(%rax),%esi
mov    $0x20200004,%edi
call   1040 <PUT32@plt>
mov    $0x20200000,%edi
call   1050 <GET32@plt>
and    $0xc01ff000,%eax
lea    0x1200924(%rax),%esi
mov    $0x20200000,%edi
call   1040 <PUT32@plt>
mov    $0x20200094,%edi
xor    %esi,%esi
call   1040 <PUT32@plt>
nopl   0x0(%rax)
mov    %ebx,%edi
call   1030 <dummy@plt>
add    $0x1,%ebx
cmp    $0x96,%ebx
jne    1190 <gpio_init+0x60>
mov    $0x20200098,%edi
mov    $0xc00f,%esi
call   1040 <PUT32@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <dummy@plt>
add    $0x1,%ebx
cmp    $0x96,%ebx
jne    11c0 <gpio_init+0x90>
xor    %ebx,%ebx
mov    $0x20200098,%edi
xor    %esi,%esi
call   1040 <PUT32@plt>
mov    $0x20200094,%edi
mov    $0x1,%esi
call   1040 <PUT32@plt>
nop
mov    %ebx,%edi
call   1030 <dummy@plt>
add    $0x1,%ebx
cmp    $0x96,%ebx
jne    11f0 <gpio_init+0xc0>
mov    $0x20200098,%edi
mov    $0x602c0,%esi
call   1040 <PUT32@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <dummy@plt>
add    $0x1,%ebx
cmp    $0x96,%ebx
jne    1220 <gpio_init+0xf0>
mov    $0x20200098,%edi
xor    %esi,%esi
call   1040 <PUT32@plt>
mov    $0x20200058,%edi
mov    $0x20200,%esi
call   1040 <PUT32@plt>
mov    $0x2020004c,%edi
mov    $0x20200,%esi
pop    %rbx
jmp    1040 <PUT32@plt>

LLVM IR (-O0):
define void @gpio_init() {
%1 = alloca i32
%2 = call i32 @PUT32(i32 538972208, i32 0)
%3 = call i32 @GET32(i32 538968068)
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = and i32 %4, -28673
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = or i32 %6, 16384
store i32 %7, i32* %1
%8 = load i32, i32* %1
%9 = and i32 %8, -229377
store i32 %9, i32* %1
%10 = load i32, i32* %1
%11 = or i32 %10, 131072
store i32 %11, i32* %1
%12 = load i32, i32* %1
%13 = and i32 %12, -117440513
store i32 %13, i32* %1
%14 = load i32, i32* %1
%15 = or i32 %14, 33554432
store i32 %15, i32* %1
%16 = load i32, i32* %1
%17 = and i32 %16, -14680065
store i32 %17, i32* %1
%18 = load i32, i32* %1
%19 = call i32 @PUT32(i32 538968068, i32 %18)
%20 = call i32 @GET32(i32 538968064)
store i32 %20, i32* %1
%21 = load i32, i32* %1
%22 = and i32 %21, -14680065
store i32 %22, i32* %1
%23 = load i32, i32* %1
%24 = or i32 %23, 2097152
store i32 %24, i32* %1
%25 = load i32, i32* %1
%26 = and i32 %25, -117440513
store i32 %26, i32* %1
%27 = load i32, i32* %1
%28 = or i32 %27, 16777216
store i32 %28, i32* %1
%29 = load i32, i32* %1
%30 = and i32 %29, -939524097
store i32 %30, i32* %1
%31 = load i32, i32* %1
%32 = and i32 %31, -8
store i32 %32, i32* %1
%33 = load i32, i32* %1
%34 = or i32 %33, 4
store i32 %34, i32* %1
%35 = load i32, i32* %1
%36 = and i32 %35, -57
store i32 %36, i32* %1
%37 = load i32, i32* %1
%38 = or i32 %37, 32
store i32 %38, i32* %1
%39 = load i32, i32* %1
%40 = and i32 %39, -449
store i32 %40, i32* %1
%41 = load i32, i32* %1
%42 = or i32 %41, 256
store i32 %42, i32* %1
%43 = load i32, i32* %1
%44 = and i32 %43, -3585
store i32 %44, i32* %1
%45 = load i32, i32* %1
%46 = or i32 %45, 2048
store i32 %46, i32* %1
%47 = load i32, i32* %1
%48 = call i32 @PUT32(i32 538968064, i32 %47)
%49 = call i32 @PUT32(i32 538968212, i32 0)
store i32 0, i32* %1
br label %50
50: ; preds = %56, %0
%51 = load i32, i32* %1
%52 = icmp ult i32 %51, 150
br i1 %52, label %53, label %59
53: ; preds = %50
%54 = load i32, i32* %1
%55 = call i32 @dummy(i32 %54)
br label %56
56: ; preds = %53
%57 = load i32, i32* %1
%58 = add i32 %57, 1
store i32 %58, i32* %1
br label %50
59: ; preds = %50
%60 = call i32 @PUT32(i32 538968216, i32 49167)
store i32 0, i32* %1
br label %61
61: ; preds = %67, %59
%62 = load i32, i32* %1
%63 = icmp ult i32 %62, 150
br i1 %63, label %64, label %70
64: ; preds = %61
%65 = load i32, i32* %1
%66 = call i32 @dummy(i32 %65)
br label %67
67: ; preds = %64
%68 = load i32, i32* %1
%69 = add i32 %68, 1
store i32 %69, i32* %1
br label %61
70: ; preds = %61
%71 = call i32 @PUT32(i32 538968216, i32 0)
%72 = call i32 @PUT32(i32 538968212, i32 1)
store i32 0, i32* %1
br label %73
73: ; preds = %79, %70
%74 = load i32, i32* %1
%75 = icmp ult i32 %74, 150
br i1 %75, label %76, label %82
76: ; preds = %73
%77 = load i32, i32* %1
%78 = call i32 @dummy(i32 %77)
br label %79
79: ; preds = %76
%80 = load i32, i32* %1
%81 = add i32 %80, 1
store i32 %81, i32* %1
br label %73
82: ; preds = %73
%83 = call i32 @PUT32(i32 538968216, i32 393920)
store i32 0, i32* %1
br label %84
84: ; preds = %90, %82
%85 = load i32, i32* %1
%86 = icmp ult i32 %85, 150
br i1 %86, label %87, label %93
87: ; preds = %84
%88 = load i32, i32* %1
%89 = call i32 @dummy(i32 %88)
br label %90
90: ; preds = %87
%91 = load i32, i32* %1
%92 = add i32 %91, 1
store i32 %92, i32* %1
br label %84
93: ; preds = %84
%94 = call i32 @PUT32(i32 538968216, i32 0)
%95 = call i32 @PUT32(i32 538968152, i32 131584)
%96 = call i32 @PUT32(i32 538968140, i32 131584)
ret void
}

LLVM IR (-O2):
define void @gpio_init() {
%1 = tail call i32 @PUT32(i32 538972208, i32 0)
%2 = tail call i32 @GET32(i32 538968068)
%3 = and i32 %2, -132378625
%4 = or i32 %3, 33701888
%5 = tail call i32 @PUT32(i32 538968068, i32 %4)
%6 = tail call i32 @GET32(i32 538968064)
%7 = and i32 %6, -1071648768
%8 = or i32 %7, 18876708
%9 = tail call i32 @PUT32(i32 538968064, i32 %8)
%10 = tail call i32 @PUT32(i32 538968212, i32 0)
br label %11
11: ; preds = %0, %11
%12 = phi i32 [ 0, %0 ], [ %14, %11 ]
%13 = tail call i32 @dummy(i32 %12)
%14 = add nuw nsw i32 %12, 1
%15 = icmp eq i32 %14, 150
br i1 %15, label %16, label %11
16: ; preds = %11
%17 = tail call i32 @PUT32(i32 538968216, i32 49167)
br label %18
18: ; preds = %16, %18
%19 = phi i32 [ 0, %16 ], [ %21, %18 ]
%20 = tail call i32 @dummy(i32 %19)
%21 = add nuw nsw i32 %19, 1
%22 = icmp eq i32 %21, 150
br i1 %22, label %23, label %18
23: ; preds = %18
%24 = tail call i32 @PUT32(i32 538968216, i32 0)
%25 = tail call i32 @PUT32(i32 538968212, i32 1)
br label %26
26: ; preds = %23, %26
%27 = phi i32 [ 0, %23 ], [ %29, %26 ]
%28 = tail call i32 @dummy(i32 %27)
%29 = add nuw nsw i32 %27, 1
%30 = icmp eq i32 %29, 150
br i1 %30, label %31, label %26
31: ; preds = %26
%32 = tail call i32 @PUT32(i32 538968216, i32 393920)
br label %33
33: ; preds = %31, %33
%34 = phi i32 [ 0, %31 ], [ %36, %33 ]
%35 = tail call i32 @dummy(i32 %34)
%36 = add nuw nsw i32 %34, 1
%37 = icmp eq i32 %36, 150
br i1 %37, label %38, label %33
38: ; preds = %33
%39 = tail call i32 @PUT32(i32 538968216, i32 0)
%40 = tail call i32 @PUT32(i32 538968152, i32 131584)
%41 = tail call i32 @PUT32(i32 538968140, i32 131584)
ret void
}