#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 list_stale_users();
scalar_t__ logout(char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i = list_stale_users();
  int j;
  for (j = 0; logout("???"); j++) {
  }
  if (i || j)
    printf("Logged out %i stale user(s)\n", j);
  return (j == 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <list_stale_users@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xea9(%rip),%rdi
call   1030 <logout@plt>
cmp    $0x0,%rax
je     1179 <main+0x49>
jmp    116b <main+0x3b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1150 <main+0x20>
cmpl   $0x0,-0x8(%rbp)
jne    118d <main+0x5d>
cmpl   $0x0,-0xc(%rbp)
je     119c <main+0x6c>
mov    -0xc(%rbp),%esi
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <list_stale_users@plt>
mov    %eax,%r14d
mov    $0x1,%ebp
lea    0xeb6(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <logout@plt>
add    $0xffffffff,%ebp
test   %rax,%rax
jne    1150 <main+0x20>
or     %ebp,%r14d
je     1175 <main+0x45>
mov    %ebp,%esi
neg    %esi
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
test   %ebp,%ebp
sete   %al
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"???\00"
@.str.1 = [29 x i8] c"Logged out %i stale user(s)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @list_stale_users()
store i32 %4, i32* %2
store i32 0, i32* %3
br label %5
5: ; preds = %9, %0
%6 = call i64 @logout(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %5
br label %9
9: ; preds = %8
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
br label %5
12: ; preds = %5
%13 = load i32, i32* %2
%14 = icmp ne i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* %3
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %15, %12
%19 = load i32, i32* %3
%20 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %18, %15
%22 = load i32, i32* %3
%23 = icmp eq i32 %22, 0
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
@.str = [4 x i8] c"???\00"
@.str.1 = [29 x i8] c"Logged out %i stale user(s)\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @list_stale_users()
br label %2
2: ; preds = %2, %0
%3 = phi i32 [ 0, %0 ], [ %6, %2 ]
%4 = tail call i64 @logout(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
%6 = add nuw nsw i32 %3, 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = icmp ne i32 %1, 0
%9 = icmp ne i32 %3, 0
%10 = select i1 %8, i1 true, i1 %9
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %3)
br label %13
13: ; preds = %7, %11
%14 = icmp eq i32 %3, 0
%15 = zext i1 %14 to i32
ret i32 %15
}