#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__ cg_read_strcmp(char const *, char *, char *);
int /*<<< orphan*/ usleep(int);
int cg_test_proc_killed(const char *cgroup) {
  int limit;
  for (limit = 10; limit > 0; limit--) {
    if (cg_read_strcmp(cgroup, "cgroup.procs", "") == 0)
      return 0;
    usleep(100000);
  }
  return -1;
}


x86 assembly (clang, -O0):
<cg_test_proc_killed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1182 <cg_test_proc_killed+0x62>
mov    -0x10(%rbp),%rdi
lea    0xeb8(%rip),%rsi
lea    0xebd(%rip),%rdx
call   1030 <cg_read_strcmp@plt>
cmp    $0x0,%rax
jne    116a <cg_test_proc_killed+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    1189 <cg_test_proc_killed+0x69>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1133 <cg_test_proc_killed+0x13>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cg_test_proc_killed>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed3(%rip),%rsi
lea    0xed8(%rip),%rdx
call   1030 <cg_read_strcmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     12b4 <cg_test_proc_killed+0x194>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
lea    0xeab(%rip),%rsi
lea    0xeb0(%rip),%rdx
mov    %rbx,%rdi
call   1030 <cg_read_strcmp@plt>
test   %rax,%rax
je     12b4 <cg_test_proc_killed+0x194>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
lea    0xe82(%rip),%rsi
lea    0xe87(%rip),%rdx
mov    %rbx,%rdi
call   1030 <cg_read_strcmp@plt>
test   %rax,%rax
je     12b4 <cg_test_proc_killed+0x194>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
lea    0xe59(%rip),%rsi
lea    0xe5e(%rip),%rdx
mov    %rbx,%rdi
call   1030 <cg_read_strcmp@plt>
test   %rax,%rax
je     12b4 <cg_test_proc_killed+0x194>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
lea    0xe30(%rip),%rsi
lea    0xe35(%rip),%rdx
mov    %rbx,%rdi
call   1030 <cg_read_strcmp@plt>
test   %rax,%rax
je     12b4 <cg_test_proc_killed+0x194>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
lea    0xe07(%rip),%rsi
lea    0xe0c(%rip),%rdx
mov    %rbx,%rdi
call   1030 <cg_read_strcmp@plt>
test   %rax,%rax
je     12b4 <cg_test_proc_killed+0x194>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
lea    0xdde(%rip),%rsi
lea    0xde3(%rip),%rdx
mov    %rbx,%rdi
call   1030 <cg_read_strcmp@plt>
test   %rax,%rax
je     12b4 <cg_test_proc_killed+0x194>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
lea    0xdb9(%rip),%rsi
lea    0xdbe(%rip),%rdx
mov    %rbx,%rdi
call   1030 <cg_read_strcmp@plt>
test   %rax,%rax
je     12b4 <cg_test_proc_killed+0x194>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
lea    0xd94(%rip),%rsi
lea    0xd99(%rip),%rdx
mov    %rbx,%rdi
call   1030 <cg_read_strcmp@plt>
test   %rax,%rax
je     12b4 <cg_test_proc_killed+0x194>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
lea    0xd6f(%rip),%rsi
lea    0xd74(%rip),%rdx
mov    %rbx,%rdi
call   1030 <cg_read_strcmp@plt>
test   %rax,%rax
je     12b4 <cg_test_proc_killed+0x194>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"cgroup.procs\00"
@.str.1 = [1 x i8] zeroinitializer
define i32 @cg_test_proc_killed(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 10, i32* %4
br label %5
5: ; preds = %15, %1
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %18
8: ; preds = %5
%9 = load i8*, i8** %3
%10 = call i64 @cg_read_strcmp(i8* %9, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 0, i32* %2
br label %19
13: ; preds = %8
%14 = call i32 @usleep(i32 100000)
br label %15
15: ; preds = %13
%16 = load i32, i32* %4
%17 = add nsw i32 %16, -1
store i32 %17, i32* %4
br label %5
18: ; preds = %5
store i32 -1, i32* %2
br label %19
19: ; preds = %18, %12
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
@.str = [13 x i8] c"cgroup.procs\00"
@.str.1 = [1 x i8] zeroinitializer
define i32 @cg_test_proc_killed(i8* %0) {
%2 = tail call i64 @cg_read_strcmp(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %42, label %4
4: ; preds = %1
%5 = tail call i32 @usleep(i32 100000)
%6 = tail call i64 @cg_read_strcmp(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %42, label %8
8: ; preds = %4
%9 = tail call i32 @usleep(i32 100000)
%10 = tail call i64 @cg_read_strcmp(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %42, label %12
12: ; preds = %8
%13 = tail call i32 @usleep(i32 100000)
%14 = tail call i64 @cg_read_strcmp(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %42, label %16
16: ; preds = %12
%17 = tail call i32 @usleep(i32 100000)
%18 = tail call i64 @cg_read_strcmp(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %42, label %20
20: ; preds = %16
%21 = tail call i32 @usleep(i32 100000)
%22 = tail call i64 @cg_read_strcmp(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %42, label %24
24: ; preds = %20
%25 = tail call i32 @usleep(i32 100000)
%26 = tail call i64 @cg_read_strcmp(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %42, label %28
28: ; preds = %24
%29 = tail call i32 @usleep(i32 100000)
%30 = tail call i64 @cg_read_strcmp(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %42, label %32
32: ; preds = %28
%33 = tail call i32 @usleep(i32 100000)
%34 = tail call i64 @cg_read_strcmp(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %42, label %36
36: ; preds = %32
%37 = tail call i32 @usleep(i32 100000)
%38 = tail call i64 @cg_read_strcmp(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %36
%41 = tail call i32 @usleep(i32 100000)
br label %42
42: ; preds = %40, %36, %32, %28, %24, %20, %16, %12, %8, %4, %1
%43 = phi i32 [ 0, %1 ], [ 0, %4 ], [ 0, %8 ], [ 0, %12 ], [ 0, %16 ], [ 0, %20 ], [ 0, %24 ], [ 0, %28 ], [ 0, %32 ], [ 0, %36 ], [ -1, %40 ]
ret i32 %43
}