#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*/ DEBUG_ASSERT(int);
int I2CSlaveBaseValid(unsigned long);
void I2CSlaveAddressSet(unsigned long ulBase, unsigned char ucAddrNum,
                        unsigned char ucSlaveAddr) {
  DEBUG_ASSERT(I2CSlaveBaseValid(ulBase));
  DEBUG_ASSERT(!(ucAddrNum > 1));
  DEBUG_ASSERT(!(ucSlaveAddr & 0x80));
  switch (ucAddrNum) {
  case 0: {
    (*((volatile unsigned long *)(ulBase + 0x00000000))) = ucSlaveAddr;
    break;
  }
  case 1: {
    (*((volatile unsigned long *)(ulBase + 0x0000001C))) =
        0x00000080 | ucSlaveAddr;
    break;
  }
  }
}


x86 assembly (clang, -O0):
<I2CSlaveAddressSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <I2CSlaveBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
movzbl -0x9(%rbp),%eax
sub    $0x2,%eax
setl   %al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
movzbl -0xa(%rbp),%eax
test   $0x80,%al
sete   %al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
movzbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     118f <I2CSlaveAddressSet+0x6f>
jmp    117e <I2CSlaveAddressSet+0x5e>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     11a1 <I2CSlaveAddressSet+0x81>
jmp    11b5 <I2CSlaveAddressSet+0x95>
movzbl -0xa(%rbp),%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
jmp    11b5 <I2CSlaveAddressSet+0x95>
movzbl -0xa(%rbp),%eax
or     $0x80,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x1c(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CSlaveAddressSet>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
call   1040 <I2CSlaveBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
xor    %edi,%edi
cmp    $0x2,%bpl
setb   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    %ebx,%edi
shr    $0x7,%edi
xor    $0x1,%edi
call   1030 <DEBUG_ASSERT@plt>
cmp    $0x1,%bpl
je     1163 <I2CSlaveAddressSet+0x43>
test   %bpl,%bpl
jne    1170 <I2CSlaveAddressSet+0x50>
movzbl %bl,%ebx
jmp    116d <I2CSlaveAddressSet+0x4d>
or     $0x80,%ebx
add    $0x1c,%r14
mov    %rbx,(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @I2CSlaveAddressSet(i64 %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i64
%5 = alloca i8
%6 = alloca i8
store i64 %0, i64* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%7 = load i64, i64* %4
%8 = call i32 @I2CSlaveBaseValid(i64 %7)
%9 = call i32 @DEBUG_ASSERT(i32 %8)
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = icmp sgt i32 %11, 1
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
%15 = call i32 @DEBUG_ASSERT(i32 %14)
%16 = load i8, i8* %6
%17 = zext i8 %16 to i32
%18 = and i32 %17, 128
%19 = icmp ne i32 %18, 0
%20 = xor i1 %19, true
%21 = zext i1 %20 to i32
%22 = call i32 @DEBUG_ASSERT(i32 %21)
%23 = load i8, i8* %5
%24 = zext i8 %23 to i32
switch i32 %24, label %39 [
i32 0, label %25
i32 1, label %31
]
25: ; preds = %3
%26 = load i8, i8* %6
%27 = zext i8 %26 to i64
%28 = load i64, i64* %4
%29 = add i64 %28, 0
%30 = inttoptr i64 %29 to i64*
store volatile i64 %27, i64* %30
br label %39
31: ; preds = %3
%32 = load i8, i8* %6
%33 = zext i8 %32 to i32
%34 = or i32 128, %33
%35 = sext i32 %34 to i64
%36 = load i64, i64* %4
%37 = add i64 %36, 28
%38 = inttoptr i64 %37 to i64*
store volatile i64 %35, i64* %38
br label %39
39: ; preds = %3, %31, %25
ret void
}

LLVM IR (-O2):
define void @I2CSlaveAddressSet(i64 %0, i8 zeroext %1, i8 zeroext %2) {
%4 = tail call i32 @I2CSlaveBaseValid(i64 %0)
%5 = tail call i32 @DEBUG_ASSERT(i32 %4)
%6 = icmp ult i8 %1, 2
%7 = zext i1 %6 to i32
%8 = tail call i32 @DEBUG_ASSERT(i32 %7)
%9 = zext i8 %2 to i32
%10 = lshr i32 %9, 7
%11 = xor i32 %10, 1
%12 = tail call i32 @DEBUG_ASSERT(i32 %11)
switch i8 %1, label %23 [
i8 0, label %13
i8 1, label %15
]
13: ; preds = %3
%14 = zext i8 %2 to i64
br label %19
15: ; preds = %3
%16 = or i32 %9, 128
%17 = zext i32 %16 to i64
%18 = add i64 %0, 28
br label %19
19: ; preds = %13, %15
%20 = phi i64 [ %18, %15 ], [ %0, %13 ]
%21 = phi i64 [ %17, %15 ], [ %14, %13 ]
%22 = inttoptr i64 %20 to i64*
store volatile i64 %21, i64* %22
br label %23
23: ; preds = %19, %3
ret void
}