#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 /*<<< orphan*/ udelay(int);
void mi_phy_addr(unsigned char addr) {
  (*((volatile unsigned short *)(0x0C000000 + ((0x300 + (0x8)) << 2)))) =
      (((addr >> 4) & 0x1) | 0x0008);
  udelay(100);
  (*((volatile unsigned short *)(0x0C000000 + ((0x300 + (0x8)) << 2)))) =
      (((addr >> 4) & 0x1) | 0x0008 | 0x0004);
  udelay(100);
  (*((volatile unsigned short *)(0x0C000000 + ((0x300 + (0x8)) << 2)))) =
      (((addr >> 3) & 0x1) | 0x0008);
  udelay(100);
  (*((volatile unsigned short *)(0x0C000000 + ((0x300 + (0x8)) << 2)))) =
      (((addr >> 3) & 0x1) | 0x0008 | 0x0004);
  udelay(100);
  (*((volatile unsigned short *)(0x0C000000 + ((0x300 + (0x8)) << 2)))) =
      (((addr >> 2) & 0x1) | 0x0008);
  udelay(100);
  (*((volatile unsigned short *)(0x0C000000 + ((0x300 + (0x8)) << 2)))) =
      (((addr >> 2) & 0x1) | 0x0008 | 0x0004);
  udelay(100);
  (*((volatile unsigned short *)(0x0C000000 + ((0x300 + (0x8)) << 2)))) =
      (((addr >> 1) & 0x1) | 0x0008);
  udelay(100);
  (*((volatile unsigned short *)(0x0C000000 + ((0x300 + (0x8)) << 2)))) =
      (((addr >> 1) & 0x1) | 0x0008 | 0x0004);
  udelay(100);
  (*((volatile unsigned short *)(0x0C000000 + ((0x300 + (0x8)) << 2)))) =
      ((addr & 0x1) | 0x0008);
  udelay(100);
  (*((volatile unsigned short *)(0x0C000000 + ((0x300 + (0x8)) << 2)))) =
      ((addr & 0x1) | 0x0008 | 0x0004);
  udelay(100);
}


x86 assembly (clang, -O0):
<mi_phy_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
sar    $0x4,%eax
and    $0x1,%eax
or     $0x8,%eax
mov    %ax,%cx
mov    $0xc000c20,%eax
mov    %cx,(%rax)
mov    $0x64,%edi
call   1030 <udelay@plt>
movzbl -0x1(%rbp),%eax
sar    $0x4,%eax
and    $0x1,%eax
or     $0x8,%eax
or     $0x4,%eax
mov    %ax,%cx
mov    $0xc000c20,%eax
mov    %cx,(%rax)
mov    $0x64,%edi
call   1030 <udelay@plt>
movzbl -0x1(%rbp),%eax
sar    $0x3,%eax
and    $0x1,%eax
or     $0x8,%eax
mov    %ax,%cx
mov    $0xc000c20,%eax
mov    %cx,(%rax)
mov    $0x64,%edi
call   1030 <udelay@plt>
movzbl -0x1(%rbp),%eax
sar    $0x3,%eax
and    $0x1,%eax
or     $0x8,%eax
or     $0x4,%eax
mov    %ax,%cx
mov    $0xc000c20,%eax
mov    %cx,(%rax)
mov    $0x64,%edi
call   1030 <udelay@plt>
movzbl -0x1(%rbp),%eax
sar    $0x2,%eax
and    $0x1,%eax
or     $0x8,%eax
mov    %ax,%cx
mov    $0xc000c20,%eax
mov    %cx,(%rax)
mov    $0x64,%edi
call   1030 <udelay@plt>
movzbl -0x1(%rbp),%eax
sar    $0x2,%eax
and    $0x1,%eax
or     $0x8,%eax
or     $0x4,%eax
mov    %ax,%cx
mov    $0xc000c20,%eax
mov    %cx,(%rax)
mov    $0x64,%edi
call   1030 <udelay@plt>
movzbl -0x1(%rbp),%eax
sar    $0x1,%eax
and    $0x1,%eax
or     $0x8,%eax
mov    %ax,%cx
mov    $0xc000c20,%eax
mov    %cx,(%rax)
mov    $0x64,%edi
call   1030 <udelay@plt>
movzbl -0x1(%rbp),%eax
sar    $0x1,%eax
and    $0x1,%eax
or     $0x8,%eax
or     $0x4,%eax
mov    %ax,%cx
mov    $0xc000c20,%eax
mov    %cx,(%rax)
mov    $0x64,%edi
call   1030 <udelay@plt>
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
or     $0x8,%eax
mov    %ax,%cx
mov    $0xc000c20,%eax
mov    %cx,(%rax)
mov    $0x64,%edi
call   1030 <udelay@plt>
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
or     $0x8,%eax
or     $0x4,%eax
mov    %ax,%cx
mov    $0xc000c20,%eax
mov    %cx,(%rax)
mov    $0x64,%edi
call   1030 <udelay@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mi_phy_addr>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%r14d
mov    %r14d,%eax
shr    $0x4,%al
and    $0x1,%al
movzbl %al,%ebx
lea    0x8(%rbx),%eax
mov    %ax,0xc000c20
0c
mov    $0x64,%edi
call   1030 <udelay@plt>
or     $0xc,%ebx
mov    %bx,0xc000c20
0c
mov    $0x64,%edi
call   1030 <udelay@plt>
mov    %r14d,%eax
shr    $0x3,%al
and    $0x1,%al
movzbl %al,%ebx
lea    0x8(%rbx),%eax
mov    %ax,0xc000c20
0c
mov    $0x64,%edi
call   1030 <udelay@plt>
or     $0xc,%ebx
mov    %bx,0xc000c20
0c
mov    $0x64,%edi
call   1030 <udelay@plt>
mov    %r14d,%eax
shr    $0x2,%al
and    $0x1,%al
movzbl %al,%ebx
lea    0x8(%rbx),%eax
mov    %ax,0xc000c20
0c
mov    $0x64,%edi
call   1030 <udelay@plt>
or     $0xc,%ebx
mov    %bx,0xc000c20
0c
mov    $0x64,%edi
call   1030 <udelay@plt>
mov    %r14d,%eax
shr    %al
and    $0x1,%al
movzbl %al,%ebx
lea    0x8(%rbx),%eax
mov    %ax,0xc000c20
0c
mov    $0x64,%edi
call   1030 <udelay@plt>
or     $0xc,%ebx
mov    %bx,0xc000c20
0c
mov    $0x64,%edi
call   1030 <udelay@plt>
and    $0x1,%r14d
lea    0x8(%r14),%eax
mov    %ax,0xc000c20
0c
mov    $0x64,%edi
call   1030 <udelay@plt>
or     $0xc,%r14d
mov    %r14w,0xc000c20
mov    $0x64,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <udelay@plt>

LLVM IR (-O0):
define void @mi_phy_addr(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = ashr i32 %4, 4
%6 = and i32 %5, 1
%7 = or i32 %6, 8
%8 = trunc i32 %7 to i16
store volatile i16 %8, i16* inttoptr (i64 201329696 to i16*)
%9 = call i32 @udelay(i32 100)
%10 = load i8, i8* %2
%11 = zext i8 %10 to i32
%12 = ashr i32 %11, 4
%13 = and i32 %12, 1
%14 = or i32 %13, 8
%15 = or i32 %14, 4
%16 = trunc i32 %15 to i16
store volatile i16 %16, i16* inttoptr (i64 201329696 to i16*)
%17 = call i32 @udelay(i32 100)
%18 = load i8, i8* %2
%19 = zext i8 %18 to i32
%20 = ashr i32 %19, 3
%21 = and i32 %20, 1
%22 = or i32 %21, 8
%23 = trunc i32 %22 to i16
store volatile i16 %23, i16* inttoptr (i64 201329696 to i16*)
%24 = call i32 @udelay(i32 100)
%25 = load i8, i8* %2
%26 = zext i8 %25 to i32
%27 = ashr i32 %26, 3
%28 = and i32 %27, 1
%29 = or i32 %28, 8
%30 = or i32 %29, 4
%31 = trunc i32 %30 to i16
store volatile i16 %31, i16* inttoptr (i64 201329696 to i16*)
%32 = call i32 @udelay(i32 100)
%33 = load i8, i8* %2
%34 = zext i8 %33 to i32
%35 = ashr i32 %34, 2
%36 = and i32 %35, 1
%37 = or i32 %36, 8
%38 = trunc i32 %37 to i16
store volatile i16 %38, i16* inttoptr (i64 201329696 to i16*)
%39 = call i32 @udelay(i32 100)
%40 = load i8, i8* %2
%41 = zext i8 %40 to i32
%42 = ashr i32 %41, 2
%43 = and i32 %42, 1
%44 = or i32 %43, 8
%45 = or i32 %44, 4
%46 = trunc i32 %45 to i16
store volatile i16 %46, i16* inttoptr (i64 201329696 to i16*)
%47 = call i32 @udelay(i32 100)
%48 = load i8, i8* %2
%49 = zext i8 %48 to i32
%50 = ashr i32 %49, 1
%51 = and i32 %50, 1
%52 = or i32 %51, 8
%53 = trunc i32 %52 to i16
store volatile i16 %53, i16* inttoptr (i64 201329696 to i16*)
%54 = call i32 @udelay(i32 100)
%55 = load i8, i8* %2
%56 = zext i8 %55 to i32
%57 = ashr i32 %56, 1
%58 = and i32 %57, 1
%59 = or i32 %58, 8
%60 = or i32 %59, 4
%61 = trunc i32 %60 to i16
store volatile i16 %61, i16* inttoptr (i64 201329696 to i16*)
%62 = call i32 @udelay(i32 100)
%63 = load i8, i8* %2
%64 = zext i8 %63 to i32
%65 = and i32 %64, 1
%66 = or i32 %65, 8
%67 = trunc i32 %66 to i16
store volatile i16 %67, i16* inttoptr (i64 201329696 to i16*)
%68 = call i32 @udelay(i32 100)
%69 = load i8, i8* %2
%70 = zext i8 %69 to i32
%71 = and i32 %70, 1
%72 = or i32 %71, 8
%73 = or i32 %72, 4
%74 = trunc i32 %73 to i16
store volatile i16 %74, i16* inttoptr (i64 201329696 to i16*)
%75 = call i32 @udelay(i32 100)
ret void
}

LLVM IR (-O2):
define void @mi_phy_addr(i8 zeroext %0) {
%2 = lshr i8 %0, 4
%3 = and i8 %2, 1
%4 = zext i8 %3 to i16
%5 = or i16 %4, 8
store volatile i16 %5, i16* inttoptr (i64 201329696 to i16*)
%6 = tail call i32 @udelay(i32 100)
%7 = or i16 %4, 12
store volatile i16 %7, i16* inttoptr (i64 201329696 to i16*)
%8 = tail call i32 @udelay(i32 100)
%9 = lshr i8 %0, 3
%10 = and i8 %9, 1
%11 = zext i8 %10 to i16
%12 = or i16 %11, 8
store volatile i16 %12, i16* inttoptr (i64 201329696 to i16*)
%13 = tail call i32 @udelay(i32 100)
%14 = or i16 %11, 12
store volatile i16 %14, i16* inttoptr (i64 201329696 to i16*)
%15 = tail call i32 @udelay(i32 100)
%16 = lshr i8 %0, 2
%17 = and i8 %16, 1
%18 = zext i8 %17 to i16
%19 = or i16 %18, 8
store volatile i16 %19, i16* inttoptr (i64 201329696 to i16*)
%20 = tail call i32 @udelay(i32 100)
%21 = or i16 %18, 12
store volatile i16 %21, i16* inttoptr (i64 201329696 to i16*)
%22 = tail call i32 @udelay(i32 100)
%23 = lshr i8 %0, 1
%24 = and i8 %23, 1
%25 = zext i8 %24 to i16
%26 = or i16 %25, 8
store volatile i16 %26, i16* inttoptr (i64 201329696 to i16*)
%27 = tail call i32 @udelay(i32 100)
%28 = or i16 %25, 12
store volatile i16 %28, i16* inttoptr (i64 201329696 to i16*)
%29 = tail call i32 @udelay(i32 100)
%30 = and i8 %0, 1
%31 = zext i8 %30 to i16
%32 = or i16 %31, 8
store volatile i16 %32, i16* inttoptr (i64 201329696 to i16*)
%33 = tail call i32 @udelay(i32 100)
%34 = or i16 %31, 12
store volatile i16 %34, i16* inttoptr (i64 201329696 to i16*)
%35 = tail call i32 @udelay(i32 100)
ret void
}