#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 */
scalar_t__ I2C_IF_Write(int, unsigned char *, int, int);
int /*<<< orphan*/ Report(char *);
int SetRegisterValue(unsigned char ucRegAddr, unsigned char ucRegValue) {
  unsigned char ucData[2];
  ucData[0] = ucRegAddr;
  ucData[1] = ucRegValue;
  if (I2C_IF_Write(0x18, ucData, 2, 1) == 0) {
    return 0;
  } else {
    Report("I2C write failed\n\r");
  }
  return -1;
}


x86 assembly (clang, -O0):
<SetRegisterValue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    -0x5(%rbp),%al
mov    %al,-0x8(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x7(%rbp)
lea    -0x8(%rbp),%rsi
mov    $0x18,%edi
mov    $0x2,%edx
mov    $0x1,%ecx
call   1030 <I2C_IF_Write@plt>
cmp    $0x0,%rax
jne    116e <SetRegisterValue+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    1181 <SetRegisterValue+0x61>
lea    0xe8b(%rip),%rdi
call   1040 <Report@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetRegisterValue>:
push   %rax
mov    %dil,0x6(%rsp)
mov    %sil,0x7(%rsp)
lea    0x6(%rsp),%rsi
mov    $0x18,%edi
mov    $0x2,%edx
mov    $0x1,%ecx
call   1030 <I2C_IF_Write@plt>
test   %rax,%rax
je     115c <SetRegisterValue+0x3c>
lea    0xeb0(%rip),%rdi
call   1040 <Report@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"I2C write failed\0A\0D\00"
define i32 @SetRegisterValue(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
%6 = alloca [2 x i8]
store i8 %0, i8* %4
store i8 %1, i8* %5
%7 = load i8, i8* %4
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
store i8 %7, i8* %8
%9 = load i8, i8* %5
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 1
store i8 %9, i8* %10
%11 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%12 = call i64 @I2C_IF_Write(i32 24, i8* %11, i32 2, i32 1)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %2
store i32 0, i32* %3
br label %18
15: ; preds = %2
%16 = call i32 @Report(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15
store i32 -1, i32* %3
br label %18
18: ; preds = %17, %14
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@.str = [19 x i8] c"I2C write failed\0A\0D\00"
define i32 @SetRegisterValue(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca [2 x i8]
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
store i8 %0, i8* %4
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
store i8 %1, i8* %5
%6 = call i64 @I2C_IF_Write(i32 24, i8* %4, i32 2, i32 1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 @Report(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %2, %8
%11 = phi i32 [ -1, %8 ], [ 0, %2 ]
ret i32 %11
}