#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*/ R_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int system(char *);
int loadBackgroundImage() {
  int ret;
  if (access("/etc/enigma2/bootlogo.mvi", R_OK) != 0)
    if (access("/etc/enigma2/backdrop.mvi", R_OK) != 0)
      if (access("/usr/share/bootlogo.mvi", R_OK) != 0)
        if (access("/usr/share/backdrop.mvi", R_OK) != 0)
          return 0;
        else
          ret = system("/usr/bin/showiframe /usr/share/backdrop.mvi");
      else
        ret = system("/usr/bin/showiframe /usr/share/bootlogo.mvi");
    else
      ret = system("/usr/bin/showiframe /etc/enigma2/backdrop.mvi");
  else
    ret = system("/usr/bin/showiframe /etc/enigma2/bootlogo.mvi");
  if (ret != 0)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<loadBackgroundImage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
lea    0xf62(%rip),%rdi
call   1040 <access@plt>
cmp    $0x0,%rax
je     11ec <loadBackgroundImage+0xcc>
mov    0x2e92(%rip),%rax
mov    (%rax),%esi
lea    0xf15(%rip),%rdi
call   1040 <access@plt>
cmp    $0x0,%rax
je     11d8 <loadBackgroundImage+0xb8>
mov    0x2e73(%rip),%rax
mov    (%rax),%esi
lea    0xeca(%rip),%rdi
call   1040 <access@plt>
cmp    $0x0,%rax
je     11c4 <loadBackgroundImage+0xa4>
mov    0x2e54(%rip),%rax
mov    (%rax),%esi
lea    0xe7f(%rip),%rdi
call   1040 <access@plt>
cmp    $0x0,%rax
je     11b0 <loadBackgroundImage+0x90>
movl   $0x0,-0x4(%rbp)
jmp    1218 <loadBackgroundImage+0xf8>
lea    0xe49(%rip),%rdi
call   1030 <system@plt>
mov    %eax,-0x8(%rbp)
jmp    11d3 <loadBackgroundImage+0xb3>
lea    0xe61(%rip),%rdi
call   1030 <system@plt>
mov    %eax,-0x8(%rbp)
jmp    11e7 <loadBackgroundImage+0xc7>
lea    0xe79(%rip),%rdi
call   1030 <system@plt>
mov    %eax,-0x8(%rbp)
jmp    11fb <loadBackgroundImage+0xdb>
lea    0xe93(%rip),%rdi
call   1030 <system@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1211 <loadBackgroundImage+0xf1>
movl   $0x0,-0x4(%rbp)
jmp    1218 <loadBackgroundImage+0xf8>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loadBackgroundImage>:
push   %rbx
mov    0x2eb8(%rip),%rbx
mov    (%rbx),%esi
lea    0xf69(%rip),%rdi
call   1040 <access@plt>
test   %rax,%rax
je     117b <loadBackgroundImage+0x5b>
mov    (%rbx),%esi
lea    0xf28(%rip),%rdi
call   1040 <access@plt>
test   %rax,%rax
je     1184 <loadBackgroundImage+0x64>
mov    (%rbx),%esi
lea    0xee9(%rip),%rdi
call   1040 <access@plt>
test   %rax,%rax
je     118d <loadBackgroundImage+0x6d>
mov    (%rbx),%esi
lea    0xeaa(%rip),%rdi
call   1040 <access@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1196 <loadBackgroundImage+0x76>
pop    %rbx
ret
lea    0xf04(%rip),%rdi
jmp    119d <loadBackgroundImage+0x7d>
lea    0xecd(%rip),%rdi
jmp    119d <loadBackgroundImage+0x7d>
lea    0xe98(%rip),%rdi
jmp    119d <loadBackgroundImage+0x7d>
lea    0xe63(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"/etc/enigma2/bootlogo.mvi\00"
@R_OK = global i32 0
@.str.1 = [26 x i8] c"/etc/enigma2/backdrop.mvi\00"
@.str.2 = [24 x i8] c"/usr/share/bootlogo.mvi\00"
@.str.3 = [24 x i8] c"/usr/share/backdrop.mvi\00"
@.str.4 = [44 x i8] c"/usr/bin/showiframe /usr/share/backdrop.mvi\00"
@.str.5 = [44 x i8] c"/usr/bin/showiframe /usr/share/bootlogo.mvi\00"
@.str.6 = [46 x i8] c"/usr/bin/showiframe /etc/enigma2/backdrop.mvi\00"
@.str.7 = [46 x i8] c"/usr/bin/showiframe /etc/enigma2/bootlogo.mvi\00"
define i32 @loadBackgroundImage() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @R_OK
%4 = call i64 @access(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %28
6: ; preds = %0
%7 = load i32, i32* @R_OK
%8 = call i64 @access(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %25
10: ; preds = %6
%11 = load i32, i32* @R_OK
%12 = call i64 @access(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %22
14: ; preds = %10
%15 = load i32, i32* @R_OK
%16 = call i64 @access(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %14
store i32 0, i32* %1
br label %35
19: ; preds = %14
%20 = call i32 @system(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0))
store i32 %20, i32* %2
br label %21
21: ; preds = %19
br label %24
22: ; preds = %10
%23 = call i32 @system(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0))
store i32 %23, i32* %2
br label %24
24: ; preds = %22, %21
br label %27
25: ; preds = %6
%26 = call i32 @system(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
store i32 %26, i32* %2
br label %27
27: ; preds = %25, %24
br label %30
28: ; preds = %0
%29 = call i32 @system(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0))
store i32 %29, i32* %2
br label %30
30: ; preds = %28, %27
%31 = load i32, i32* %2
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %30
store i32 0, i32* %1
br label %35
34: ; preds = %30
store i32 1, i32* %1
br label %35
35: ; preds = %34, %33, %18
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
@.str = [26 x i8] c"/etc/enigma2/bootlogo.mvi\00"
@R_OK = global i32 0
@.str.1 = [26 x i8] c"/etc/enigma2/backdrop.mvi\00"
@.str.2 = [24 x i8] c"/usr/share/bootlogo.mvi\00"
@.str.3 = [24 x i8] c"/usr/share/backdrop.mvi\00"
@.str.4 = [44 x i8] c"/usr/bin/showiframe /usr/share/backdrop.mvi\00"
@.str.5 = [44 x i8] c"/usr/bin/showiframe /usr/share/bootlogo.mvi\00"
@.str.6 = [46 x i8] c"/usr/bin/showiframe /etc/enigma2/backdrop.mvi\00"
@.str.7 = [46 x i8] c"/usr/bin/showiframe /etc/enigma2/bootlogo.mvi\00"
define i32 @loadBackgroundImage() {
%1 = load i32, i32* @R_OK
%2 = tail call i64 @access(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %0
%5 = load i32, i32* @R_OK
%6 = tail call i64 @access(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %16, label %8
8: ; preds = %4
%9 = load i32, i32* @R_OK
%10 = tail call i64 @access(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = load i32, i32* @R_OK
%14 = tail call i64 @access(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %0, %4, %8, %12
%17 = phi i8* [ getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), %12 ], [ getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), %8 ], [ getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), %4 ], [ getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0), %0 ]
%18 = tail call i32 @system(i8* %17)
%19 = icmp eq i32 %18, 0
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %16, %12
%22 = phi i32 [ 0, %12 ], [ %20, %16 ]
ret i32 %22
}