#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__ test19_aux1();
scalar_t__ test19_aux2();
scalar_t__ test19_aux3(int *);
int test22() {
  int z;
  while (test19_aux1() + test19_aux2() && test19_aux1() && test19_aux3(&z))
    return z;
  return 0;
}


x86 assembly (clang, -O0):
<test22>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1040 <test19_aux1@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <test19_aux2@plt>
mov    -0x18(%rbp),%rcx
add    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     118c <test22+0x5c>
mov    $0x0,%al
call   1040 <test19_aux1@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     118c <test22+0x5c>
lea    -0x8(%rbp),%rdi
call   1050 <test19_aux3@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    119c <test22+0x6c>
jmp    11a7 <test22+0x77>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11ae <test22+0x7e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test22>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <test19_aux1@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <test19_aux2@plt>
add    %rbx,%rax
je     116e <test22+0x3e>
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <test19_aux1@plt>
test   %rax,%rax
je     116e <test22+0x3e>
lea    0x4(%rsp),%rdi
call   1050 <test19_aux3@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     116e <test22+0x3e>
mov    0x4(%rsp),%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @test22() {
%1 = alloca i32
%2 = alloca i32
br label %3
3: ; preds = %0
%4 = call i64 (...) @test19_aux1()
%5 = call i64 (...) @test19_aux2()
%6 = add nsw i64 %4, %5
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %3
%9 = call i64 (...) @test19_aux1()
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = call i64 @test19_aux3(i32* %2)
%13 = icmp ne i64 %12, 0
br label %14
14: ; preds = %11, %8, %3
%15 = phi i1 [ false, %8 ], [ false, %3 ], [ %13, %11 ]
br i1 %15, label %16, label %18
16: ; preds = %14
%17 = load i32, i32* %2
store i32 %17, i32* %1
br label %19
18: ; preds = %14
store i32 0, i32* %1
br label %19
19: ; preds = %18, %16
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
define i32 @test22() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i64 (...) @test19_aux1()
%4 = tail call i64 (...) @test19_aux2()
%5 = sub i64 0, %4
%6 = icmp eq i64 %3, %5
br i1 %6, label %15, label %7
7: ; preds = %0
%8 = tail call i64 (...) @test19_aux1()
%9 = icmp eq i64 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %7
%11 = call i64 @test19_aux3(i32* %1)
%12 = icmp eq i64 %11, 0
%13 = load i32, i32* %1
%14 = select i1 %12, i32 0, i32 %13
br label %15
15: ; preds = %10, %7, %0
%16 = phi i32 [ 0, %0 ], [ 0, %7 ], [ %14, %10 ]
ret i32 %16
}