#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 */
scalar_t__ isActive(int /*<<< orphan*/);
int /*<<< orphan*/ readPidFile(char *);
int isChildActive(void) {
  int ret_val = 0;
  if (isActive(readPidFile("/tmp/.pidlbr-1")) == 0) {
    ret_val = 0;
  } else if (isActive(readPidFile("/tmp/.pidlbr-2")) == 0) {
    ret_val = 0;
  } else {
    ret_val = ret_val + 1;
  }
  return ret_val;
}


x86 assembly (clang, -O0):
<isChildActive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <readPidFile@plt>
mov    %eax,%edi
call   1030 <isActive@plt>
cmp    $0x0,%rax
jne    1158 <isChildActive+0x38>
movl   $0x0,-0x4(%rbp)
jmp    118f <isChildActive+0x6f>
lea    0xeb0(%rip),%rdi
call   1040 <readPidFile@plt>
mov    %eax,%edi
call   1030 <isActive@plt>
cmp    $0x0,%rax
jne    1181 <isChildActive+0x61>
movl   $0x0,-0x4(%rbp)
jmp    118a <isChildActive+0x6a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    118f <isChildActive+0x6f>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isChildActive>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <readPidFile@plt>
mov    %eax,%edi
call   1030 <isActive@plt>
test   %rax,%rax
je     1159 <isChildActive+0x39>
lea    0xecf(%rip),%rdi
call   1040 <readPidFile@plt>
mov    %eax,%edi
call   1030 <isActive@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"/tmp/.pidlbr-1\00"
@.str.1 = [15 x i8] c"/tmp/.pidlbr-2\00"
define i32 @isChildActive() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @readPidFile(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = call i64 @isActive(i32 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 0, i32* %1
br label %15
6: ; preds = %0
%7 = call i32 @readPidFile(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%8 = call i64 @isActive(i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %6
store i32 0, i32* %1
br label %14
11: ; preds = %6
%12 = load i32, i32* %1
%13 = add nsw i32 %12, 1
store i32 %13, i32* %1
br label %14
14: ; preds = %11, %10
br label %15
15: ; preds = %14, %5
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@.str = [15 x i8] c"/tmp/.pidlbr-1\00"
@.str.1 = [15 x i8] c"/tmp/.pidlbr-2\00"
define i32 @isChildActive() {
%1 = tail call i32 @readPidFile(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = tail call i64 @isActive(i32 %1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %0
%5 = tail call i32 @readPidFile(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i64 @isActive(i32 %5)
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %4, %0
%10 = phi i32 [ 0, %0 ], [ %8, %4 ]
ret i32 %10
}