#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 config_lcd(int, unsigned char *);
int enable_lcd(int, unsigned char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int init_i2c_lcd(int, unsigned char *);
int /*<<< orphan*/ stderr;
int init_lcd(int fd, unsigned char *data) {
  if (init_i2c_lcd(fd, data) == -1) {
    fprintf(stderr, "could not init i2c lcd\n");
    return -1;
  }
  if (config_lcd(fd, data) == -1) {
    fprintf(stderr, "could not configure lcd\n");
    return -1;
  }
  if (enable_lcd(fd, data) == -1) {
    fprintf(stderr, "could not configure lcd\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<init_lcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <init_i2c_lcd@plt>
cmp    $0xffffffff,%eax
jne    1185 <init_lcd+0x45>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
lea    0xe8c(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f8 <init_lcd+0xb8>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <config_lcd@plt>
cmp    $0xffffffff,%eax
jne    11bb <init_lcd+0x7b>
mov    0x2e3f(%rip),%rax
mov    (%rax),%edi
lea    0xe6e(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f8 <init_lcd+0xb8>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <enable_lcd@plt>
cmp    $0xffffffff,%eax
jne    11f1 <init_lcd+0xb1>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
lea    0xe38(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f8 <init_lcd+0xb8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_lcd>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
call   1040 <init_i2c_lcd@plt>
cmp    $0xffffffff,%eax
je     117e <init_lcd+0x3e>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <config_lcd@plt>
lea    0xeb4(%rip),%r14
cmp    $0xffffffff,%eax
je     1185 <init_lcd+0x45>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1060 <enable_lcd@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
jne    119b <init_lcd+0x5b>
jmp    1185 <init_lcd+0x45>
lea    0xe7b(%rip),%r14
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"could not init i2c lcd\0A\00"
@.str.1 = [25 x i8] c"could not configure lcd\0A\00"
define i32 @init_lcd(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i32, i32* %4
%7 = load i8*, i8** %5
%8 = call i32 @init_i2c_lcd(i32 %6, i8* %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %30
13: ; preds = %2
%14 = load i32, i32* %4
%15 = load i8*, i8** %5
%16 = call i32 @config_lcd(i32 %14, i8* %15)
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %21
18: ; preds = %13
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %30
21: ; preds = %13
%22 = load i32, i32* %4
%23 = load i8*, i8** %5
%24 = call i32 @enable_lcd(i32 %22, i8* %23)
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %30
29: ; preds = %21
store i32 0, i32* %3
br label %30
30: ; preds = %29, %26, %18, %10
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"could not init i2c lcd\0A\00"
@.str.1 = [25 x i8] c"could not configure lcd\0A\00"
define i32 @init_lcd(i32 %0, i8* %1) {
%3 = tail call i32 @init_i2c_lcd(i32 %0, i8* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = tail call i32 @config_lcd(i32 %0, i8* %1)
%7 = icmp eq i32 %6, -1
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = tail call i32 @enable_lcd(i32 %0, i8* %1)
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %15
11: ; preds = %8, %5, %2
%12 = phi i8* [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), %8 ]
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* %12)
br label %15
15: ; preds = %11, %8
%16 = phi i32 [ 0, %8 ], [ -1, %11 ]
ret i32 %16
}