#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ geteuid();
scalar_t__ getuid();
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int unlink(char *);
int main(int argc, char *argv[]) {
  int rc;
  if (getuid() != 0 || geteuid() != 0) {
    fprintf(stderr, "This program can only be used using pkexec\n");
    return EXIT_FAILURE;
  }
  rc = unlink("/var/lib/PackageKit/offline-update-competed");
  if (rc < 0) {
    fprintf(stderr, "Failed to remove file: %s\n", strerror(errno));
    return EXIT_FAILURE;
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getuid@plt>
cmp    $0x0,%rax
jne    1188 <main+0x38>
mov    $0x0,%al
call   1050 <geteuid@plt>
cmp    $0x0,%rax
je     11b0 <main+0x60>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1214 <main+0xc4>
lea    0xe75(%rip),%rdi
call   1030 <unlink@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1208 <main+0xb8>
mov    0x2e10(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x18(%rbp),%edi
mov    %rax,%rdx
lea    0xe68(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2dd2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1214 <main+0xc4>
mov    0x2db9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <getuid@plt>
test   %rax,%rax
jne    1169 <main+0x19>
xor    %eax,%eax
call   1050 <geteuid@plt>
test   %rax,%rax
je     118b <main+0x3b>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
lea    0xe87(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x2e49(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret
lea    0xe9a(%rip),%rdi
call   1030 <unlink@plt>
test   %eax,%eax
js     11a4 <main+0x54>
mov    0x2e26(%rip),%rax
jmp    1187 <main+0x37>
mov    0x2e35(%rip),%rax
mov    (%rax),%ebx
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
lea    0xe96(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    1180 <main+0x30>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [44 x i8] c"This program can only be used using pkexec\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [44 x i8] c"/var/lib/PackageKit/offline-update-competed\00"
@.str.2 = [27 x i8] c"Failed to remove file: %s\0A\00"
@errno = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i64 (...) @getuid()
%8 = icmp ne i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = call i64 (...) @geteuid()
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9, %2
%13 = load i32, i32* @stderr
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
store i32 %15, i32* %3
br label %28
16: ; preds = %9
%17 = call i32 @unlink(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %16
%21 = load i32, i32* @stderr
%22 = load i32, i32* @errno
%23 = call i8* @strerror(i32 %22)
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %23)
%25 = load i32, i32* @EXIT_FAILURE
store i32 %25, i32* %3
br label %28
26: ; preds = %16
%27 = load i32, i32* @EXIT_SUCCESS
store i32 %27, i32* %3
br label %28
28: ; preds = %26, %20, %12
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"This program can only be used using pkexec\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [44 x i8] c"/var/lib/PackageKit/offline-update-competed\00"
@.str.2 = [27 x i8] c"Failed to remove file: %s\0A\00"
@errno = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @getuid()
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i64 (...) @geteuid()
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %5, %2
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %19
11: ; preds = %5
%12 = tail call i32 @unlink(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = load i32, i32* @stderr
%16 = load i32, i32* @errno
%17 = tail call i8* @strerror(i32 %16)
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %11, %14, %8
%20 = phi i32* [ @EXIT_FAILURE, %8 ], [ @EXIT_FAILURE, %14 ], [ @EXIT_SUCCESS, %11 ]
%21 = load i32, i32* %20
ret i32 %21
}