#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*/ HSMMCSDIntrStatusClear(unsigned int, int);
int /*<<< orphan*/ HSMMCSDIntrStatusEnable(unsigned int, int);
unsigned int HSMMCSDIsCmdComplete(unsigned int, int);
int HSMMCSDInitStreamSend(unsigned int baseAddr) {
  unsigned int status;
  HSMMCSDIntrStatusEnable(baseAddr, ((0x00000001u)));
  (*((volatile unsigned int *)(baseAddr + (0x12C)))) |= (0x00000002u);
  (*((volatile unsigned int *)(baseAddr + (0x20C)))) = 0x00;
  status = HSMMCSDIsCmdComplete(baseAddr, 0xFFFF);
  (*((volatile unsigned int *)(baseAddr + (0x12C)))) &= ~(0x00000002u);
  HSMMCSDIntrStatusClear(baseAddr, 0xFFFFFFFF);
  return status;
}


x86 assembly (clang, -O0):
<HSMMCSDInitStreamSend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <HSMMCSDIntrStatusEnable@plt>
mov    -0x4(%rbp),%eax
add    $0x12c,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     $0x2,%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x20c,%eax
mov    %eax,%eax
movl   $0x0,(%rax)
mov    -0x4(%rbp),%edi
mov    $0xffff,%esi
call   1050 <HSMMCSDIsCmdComplete@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x12c,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xfffffffd,%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
mov    $0xffffffff,%esi
call   1040 <HSMMCSDIntrStatusClear@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HSMMCSDInitStreamSend>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    $0x1,%esi
call   1030 <HSMMCSDIntrStatusEnable@plt>
lea    0x12c(%rbx),%ebp
orl    $0x2,0x0(%rbp)
lea    0x20c(%rbx),%eax
movl   $0x0,(%rax)
mov    %ebx,%edi
mov    $0xffff,%esi
call   1050 <HSMMCSDIsCmdComplete@plt>
mov    %eax,%r14d
andl   $0xfffffffd,0x0(%rbp)
mov    %ebx,%edi
mov    $0xffffffff,%esi
call   1040 <HSMMCSDIntrStatusClear@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @HSMMCSDInitStreamSend(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @HSMMCSDIntrStatusEnable(i32 %4, i32 1)
%6 = load i32, i32* %2
%7 = add i32 %6, 300
%8 = zext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
%10 = load volatile i32, i32* %9
%11 = or i32 %10, 2
store volatile i32 %11, i32* %9
%12 = load i32, i32* %2
%13 = add i32 %12, 524
%14 = zext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
store volatile i32 0, i32* %15
%16 = load i32, i32* %2
%17 = call i32 @HSMMCSDIsCmdComplete(i32 %16, i32 65535)
store i32 %17, i32* %3
%18 = load i32, i32* %2
%19 = add i32 %18, 300
%20 = zext i32 %19 to i64
%21 = inttoptr i64 %20 to i32*
%22 = load volatile i32, i32* %21
%23 = and i32 %22, -3
store volatile i32 %23, i32* %21
%24 = load i32, i32* %2
%25 = call i32 @HSMMCSDIntrStatusClear(i32 %24, i32 -1)
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @HSMMCSDInitStreamSend(i32 %0) {
%2 = tail call i32 @HSMMCSDIntrStatusEnable(i32 %0, i32 1)
%3 = add i32 %0, 300
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = or i32 %6, 2
store volatile i32 %7, i32* %5
%8 = add i32 %0, 524
%9 = zext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
store volatile i32 0, i32* %10
%11 = tail call i32 @HSMMCSDIsCmdComplete(i32 %0, i32 65535)
%12 = load volatile i32, i32* %5
%13 = and i32 %12, -3
store volatile i32 %13, i32* %5
%14 = tail call i32 @HSMMCSDIntrStatusClear(i32 %0, i32 -1)
ret i32 %11
}