#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 GET32(int);
int /*<<< orphan*/ PUT32(int, int);
int /*<<< orphan*/ usleep(int);
void pwm_init(void) {
  PUT32((0x20101000 + 0xA0), 0x5A000000 | (1 << 5));
  usleep(10);
  while (GET32((0x20101000 + 0xA0)) & 0x00000080) {
  }
  PUT32((0x20101000 + 0xA4), 0x5A000000 | (1900 << 12));
  PUT32((0x20101000 + 0xA0), 0x5A000000 | (1 << 4) | 1);
  while (GET32((0x20101000 + 0xA0)) & 0x00000080) {
  }
  PUT32((0x2020C000 + 0), 0);
  usleep(10);
  PUT32((0x2020C000 + 0x10), 100);
  usleep(10);
  PUT32((0x2020C000 + 0x14), 75);
  usleep(10);
  PUT32((0x2020C000 + 0), GET32((0x2020C000 + 0)) | 1);
}


x86 assembly (clang, -O0):
<pwm_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x201010a0,%edi
mov    $0x5a000020,%esi
call   1030 <PUT32@plt>
mov    $0xa,%edi
call   1050 <usleep@plt>
mov    $0x201010a0,%edi
call   1040 <GET32@plt>
and    $0x80,%eax
cmp    $0x0,%eax
je     116a <pwm_init+0x3a>
jmp    114d <pwm_init+0x1d>
mov    $0x201010a4,%edi
mov    $0x5a76c000,%esi
call   1030 <PUT32@plt>
mov    $0x201010a0,%edi
mov    $0x5a000011,%esi
call   1030 <PUT32@plt>
mov    $0x201010a0,%edi
call   1040 <GET32@plt>
and    $0x80,%eax
cmp    $0x0,%eax
je     11a5 <pwm_init+0x75>
jmp    1188 <pwm_init+0x58>
mov    $0x2020c000,%edi
xor    %esi,%esi
call   1030 <PUT32@plt>
mov    $0xa,%edi
call   1050 <usleep@plt>
mov    $0x2020c010,%edi
mov    $0x64,%esi
call   1030 <PUT32@plt>
mov    $0xa,%edi
call   1050 <usleep@plt>
mov    $0x2020c014,%edi
mov    $0x4b,%esi
call   1030 <PUT32@plt>
mov    $0xa,%edi
call   1050 <usleep@plt>
mov    $0x2020c000,%edi
call   1040 <GET32@plt>
mov    %eax,%esi
or     $0x1,%esi
mov    $0x2020c000,%edi
call   1030 <PUT32@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pwm_init>:
push   %rax
mov    $0x201010a0,%edi
mov    $0x5a000020,%esi
call   1030 <PUT32@plt>
mov    $0xa,%edi
call   1050 <usleep@plt>
nopw   0x0(%rax,%rax,1)
mov    $0x201010a0,%edi
call   1040 <GET32@plt>
test   $0x80,%al
jne    1150 <pwm_init+0x20>
mov    $0x201010a4,%edi
mov    $0x5a76c000,%esi
call   1030 <PUT32@plt>
mov    $0x201010a0,%edi
mov    $0x5a000011,%esi
call   1030 <PUT32@plt>
nopl   0x0(%rax)
mov    $0x201010a0,%edi
call   1040 <GET32@plt>
test   $0x80,%al
jne    1180 <pwm_init+0x50>
mov    $0x2020c000,%edi
xor    %esi,%esi
call   1030 <PUT32@plt>
mov    $0xa,%edi
call   1050 <usleep@plt>
mov    $0x2020c010,%edi
mov    $0x64,%esi
call   1030 <PUT32@plt>
mov    $0xa,%edi
call   1050 <usleep@plt>
mov    $0x2020c014,%edi
mov    $0x4b,%esi
call   1030 <PUT32@plt>
mov    $0xa,%edi
call   1050 <usleep@plt>
mov    $0x2020c000,%edi
call   1040 <GET32@plt>
or     $0x1,%eax
mov    $0x2020c000,%edi
mov    %eax,%esi
pop    %rax
jmp    1030 <PUT32@plt>

LLVM IR (-O0):
define void @pwm_init() {
%1 = call i32 @PUT32(i32 537923744, i32 1509949472)
%2 = call i32 @usleep(i32 10)
br label %3
3: ; preds = %7, %0
%4 = call i32 @GET32(i32 537923744)
%5 = and i32 %4, 128
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
%9 = call i32 @PUT32(i32 537923748, i32 1517731840)
%10 = call i32 @PUT32(i32 537923744, i32 1509949457)
br label %11
11: ; preds = %15, %8
%12 = call i32 @GET32(i32 537923744)
%13 = and i32 %12, 128
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
br label %11
16: ; preds = %11
%17 = call i32 @PUT32(i32 539017216, i32 0)
%18 = call i32 @usleep(i32 10)
%19 = call i32 @PUT32(i32 539017232, i32 100)
%20 = call i32 @usleep(i32 10)
%21 = call i32 @PUT32(i32 539017236, i32 75)
%22 = call i32 @usleep(i32 10)
%23 = call i32 @GET32(i32 539017216)
%24 = or i32 %23, 1
%25 = call i32 @PUT32(i32 539017216, i32 %24)
ret void
}

LLVM IR (-O2):
define void @pwm_init() {
%1 = tail call i32 @PUT32(i32 537923744, i32 1509949472)
%2 = tail call i32 @usleep(i32 10)
br label %3
3: ; preds = %3, %0
%4 = tail call i32 @GET32(i32 537923744)
%5 = and i32 %4, 128
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %3
7: ; preds = %3
%8 = tail call i32 @PUT32(i32 537923748, i32 1517731840)
%9 = tail call i32 @PUT32(i32 537923744, i32 1509949457)
br label %10
10: ; preds = %10, %7
%11 = tail call i32 @GET32(i32 537923744)
%12 = and i32 %11, 128
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %10
14: ; preds = %10
%15 = tail call i32 @PUT32(i32 539017216, i32 0)
%16 = tail call i32 @usleep(i32 10)
%17 = tail call i32 @PUT32(i32 539017232, i32 100)
%18 = tail call i32 @usleep(i32 10)
%19 = tail call i32 @PUT32(i32 539017236, i32 75)
%20 = tail call i32 @usleep(i32 10)
%21 = tail call i32 @GET32(i32 539017216)
%22 = or i32 %21, 1
%23 = tail call i32 @PUT32(i32 539017216, i32 %22)
ret void
}