#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 */
struct benchmark {
  int dummy;
};

/* Variables and functions */
scalar_t__ geteuid();
scalar_t__ strcmp(char const *, char *);
const char *pio_should_not_run(const char *virtdir, struct benchmark *b) {
  if ((strcmp((virtdir), ("lguest")) == 0))
    return "not valid for lguest";
  if (geteuid() != 0)
    return "can only be run as root";
  return NULL;
}


x86 assembly (clang, -O0):
<pio_should_not_run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed3(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    115a <pio_should_not_run+0x3a>
lea    0xeaf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1183 <pio_should_not_run+0x63>
mov    $0x0,%al
call   1030 <geteuid@plt>
cmp    $0x0,%rax
je     117b <pio_should_not_run+0x5b>
lea    0xea3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1183 <pio_should_not_run+0x63>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pio_should_not_run>:
push   %rax
lea    0xee6(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     114c <pio_should_not_run+0x2c>
xor    %eax,%eax
call   1030 <geteuid@plt>
mov    %rax,%rcx
test   %rax,%rax
lea    0xecf(%rip),%rax
cmove  %rcx,%rax
pop    %rcx
ret
lea    0xead(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.benchmark = type { i32 }
@.str = [7 x i8] c"lguest\00"
@.str.1 = [21 x i8] c"not valid for lguest\00"
@.str.2 = [24 x i8] c"can only be run as root\00"
define i8* @pio_should_not_run(i8* %0, %struct.benchmark* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca %struct.benchmark*
store i8* %0, i8** %4
store %struct.benchmark* %1, %struct.benchmark** %5
%6 = load i8*, i8** %4
%7 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %15
10: ; preds = %2
%11 = call i64 (...) @geteuid()
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %15
14: ; preds = %10
store i8* null, i8** %3
br label %15
15: ; preds = %14, %13, %9
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
%struct.benchmark = type { i32 }
@.str = [7 x i8] c"lguest\00"
@.str.1 = [21 x i8] c"not valid for lguest\00"
@.str.2 = [24 x i8] c"can only be run as root\00"
define i8* @pio_should_not_run(i8* %0, %struct.benchmark* nocapture readnone %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i64 (...) @geteuid()
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i8* null, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0)
br label %9
9: ; preds = %5, %2
%10 = phi i8* [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), %2 ], [ %8, %5 ]
ret i8* %10
}