#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 */
unsigned char d51_init();
int /*<<< orphan*/ initParams(unsigned char);
unsigned char initSaps();
int /*<<< orphan*/ printf(char *);
unsigned char MAC_Init(unsigned char addr) {
  unsigned char status;
  initParams(addr);
  status = d51_init();
  if (status != 0) {
    printf("Core did not initialize properly\n");
    return 255;
  }
  status = initSaps();
  if (status != 0) {
    printf("Saps did not initialize properly\n");
    return 255;
  }
  return 0;
}


x86 assembly (clang, -O0):
<MAC_Init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%edi
call   1030 <initParams@plt>
mov    $0x0,%al
call   1050 <d51_init@plt>
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
cmp    $0x0,%eax
je     1183 <MAC_Init+0x43>
lea    0xe8b(%rip),%rdi
call   1040 <printf@plt>
movb   $0xff,-0x1(%rbp)
jmp    11b3 <MAC_Init+0x73>
mov    $0x0,%al
call   1060 <initSaps@plt>
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
cmp    $0x0,%eax
je     11af <MAC_Init+0x6f>
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
movb   $0xff,-0x1(%rbp)
jmp    11b3 <MAC_Init+0x73>
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MAC_Init>:
push   %rbx
call   1030 <initParams@plt>
xor    %eax,%eax
call   1050 <d51_init@plt>
test   %al,%al
je     115a <MAC_Init+0x1a>
lea    0xec9(%rip),%rdi
jmp    116e <MAC_Init+0x2e>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <initSaps@plt>
test   %al,%al
je     1175 <MAC_Init+0x35>
lea    0xe92(%rip),%rdi
call   1040 <puts@plt>
mov    $0xff,%bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Core did not initialize properly\0A\00"
@.str.1 = [34 x i8] c"Saps did not initialize properly\0A\00"
define zeroext i8 @MAC_Init(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
%5 = load i8, i8* %3
%6 = call i32 @initParams(i8 zeroext %5)
%7 = call zeroext i8 (...) @d51_init()
store i8 %7, i8* %4
%8 = load i8, i8* %4
%9 = zext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store i8 -1, i8* %2
br label %21
13: ; preds = %1
%14 = call zeroext i8 (...) @initSaps()
store i8 %14, i8* %4
%15 = load i8, i8* %4
%16 = zext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %13
%19 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
store i8 -1, i8* %2
br label %21
20: ; preds = %13
store i8 0, i8* %2
br label %21
21: ; preds = %20, %18, %11
%22 = load i8, i8* %2
ret i8 %22
}

LLVM IR (-O2):
@str = [33 x i8] c"Saps did not initialize properly\00"
@str.2 = [33 x i8] c"Core did not initialize properly\00"
define zeroext i8 @MAC_Init(i8 zeroext %0) {
%2 = tail call i32 @initParams(i8 zeroext %0)
%3 = tail call zeroext i8 (...) @d51_init()
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = tail call zeroext i8 (...) @initSaps()
%7 = icmp eq i8 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %5, %1
%9 = phi i8* [ getelementptr inbounds ([33 x i8], [33 x i8]* @str.2, i64 0, i64 0), %1 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0), %5 ]
%10 = tail call i32 @puts(i8* dereferenceable(1) %9)
br label %11
11: ; preds = %8, %5
%12 = phi i8 [ 0, %5 ], [ -1, %8 ]
ret i8 %12
}