#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;
int /*<<< orphan*/ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ lprintf(char *);
int system(char *);
void maybe_start_screensaver(void) {
  int ret;
  ret = system("/usr/bin/gnome-screensaver");
  if (!ret)
    lprintf("Failed to launch /usr/bin/gnome-screensaver");
  if (!access("/etc/sysconfig/lock-screen", R_OK)) {
    ret = system("/usr/bin/gnome-screensaver-command --lock");
    if (!ret)
      lprintf("Failed to launch /usr/bin/gnome-screensaver-command");
  }
}


x86 assembly (clang, -O0):
<maybe_start_screensaver>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed2(%rip),%rdi
call   1030 <system@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    115d <maybe_start_screensaver+0x2d>
lea    0xea8(%rip),%rdi
call   1050 <lprintf@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%esi
lea    0xebf(%rip),%rdi
call   1040 <access@plt>
cmp    $0x0,%eax
jne    11a5 <maybe_start_screensaver+0x75>
lea    0xec5(%rip),%rdi
call   1030 <system@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    11a0 <maybe_start_screensaver+0x70>
lea    0xed6(%rip),%rdi
call   1050 <lprintf@plt>
jmp    11a5 <maybe_start_screensaver+0x75>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maybe_start_screensaver>:
push   %rax
lea    0xed9(%rip),%rdi
call   1030 <system@plt>
test   %eax,%eax
jne    114d <maybe_start_screensaver+0x1d>
lea    0xeb8(%rip),%rdi
call   1050 <lprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1040 <access@plt>
test   %eax,%eax
jne    1176 <maybe_start_screensaver+0x46>
lea    0xeda(%rip),%rdi
call   1030 <system@plt>
test   %eax,%eax
je     1178 <maybe_start_screensaver+0x48>
pop    %rax
ret
lea    0xef2(%rip),%rdi
pop    %rax
jmp    1050 <lprintf@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"/usr/bin/gnome-screensaver\00"
@.str.1 = [44 x i8] c"Failed to launch /usr/bin/gnome-screensaver\00"
@.str.2 = [27 x i8] c"/etc/sysconfig/lock-screen\00"
@R_OK = global i32 0
@.str.3 = [42 x i8] c"/usr/bin/gnome-screensaver-command --lock\00"
@.str.4 = [52 x i8] c"Failed to launch /usr/bin/gnome-screensaver-command\00"
define void @maybe_start_screensaver() {
%1 = alloca i32
%2 = call i32 @system(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp ne i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i32 @lprintf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = load i32, i32* @R_OK
%9 = call i32 @access(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %18, label %11
11: ; preds = %7
%12 = call i32 @system(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
store i32 %12, i32* %1
%13 = load i32, i32* %1
%14 = icmp ne i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %11
%16 = call i32 @lprintf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
br label %17
17: ; preds = %15, %11
br label %18
18: ; preds = %17, %7
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"/usr/bin/gnome-screensaver\00"
@.str.1 = [44 x i8] c"Failed to launch /usr/bin/gnome-screensaver\00"
@.str.2 = [27 x i8] c"/etc/sysconfig/lock-screen\00"
@R_OK = global i32 0
@.str.3 = [42 x i8] c"/usr/bin/gnome-screensaver-command --lock\00"
@.str.4 = [52 x i8] c"Failed to launch /usr/bin/gnome-screensaver-command\00"
define void @maybe_start_screensaver() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @lprintf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = load i32, i32* @R_OK
%7 = tail call i32 @access(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = tail call i32 @system(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 @lprintf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
br label %14
14: ; preds = %9, %12, %5
ret void
}