#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 /*<<< orphan*/ printf(char *, int);
scalar_t__ t(int);
void tt(int a, int b) {
  int r = t(a) && t(b);
  printf("\na && b = %d\n", r);
  r = t(a) || t(b);
  printf("\na || b = %d\n", r);
}


x86 assembly (clang, -O0):
<tt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <t@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0xd(%rbp)
je     115a <tt+0x3a>
mov    -0x8(%rbp),%edi
call   1030 <t@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <t@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0xe(%rbp)
jne    11a0 <tt+0x80>
mov    -0x8(%rbp),%edi
call   1030 <t@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xe(%rbp)
mov    -0xe(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe59(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tt>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <t@plt>
test   %rax,%rax
je     1143 <tt+0x23>
mov    %ebx,%edi
call   1030 <t@plt>
xor    %esi,%esi
test   %rax,%rax
setne  %sil
jmp    1145 <tt+0x25>
xor    %esi,%esi
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
mov    %ebp,%edi
call   1030 <t@plt>
mov    $0x1,%esi
test   %rax,%rax
jne    1172 <tt+0x52>
mov    %ebx,%edi
call   1030 <t@plt>
xor    %esi,%esi
test   %rax,%rax
setne  %sil
lea    0xe95(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"\0Aa && b = %d\0A\00"
@.str.1 = [14 x i8] c"\0Aa || b = %d\0A\00"
define void @tt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = call i64 @t(i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* %4
%11 = call i64 @t(i32 %10)
%12 = icmp ne i64 %11, 0
br label %13
13: ; preds = %9, %2
%14 = phi i1 [ false, %2 ], [ %12, %9 ]
%15 = zext i1 %14 to i32
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %3
%19 = call i64 @t(i32 %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %13
%22 = load i32, i32* %4
%23 = call i64 @t(i32 %22)
%24 = icmp ne i64 %23, 0
br label %25
25: ; preds = %21, %13
%26 = phi i1 [ true, %13 ], [ %24, %21 ]
%27 = zext i1 %26 to i32
store i32 %27, i32* %5
%28 = load i32, i32* %5
%29 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %28)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"\0Aa && b = %d\0A\00"
@.str.1 = [14 x i8] c"\0Aa || b = %d\0A\00"
define void @tt(i32 %0, i32 %1) {
%3 = tail call i64 @t(i32 %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i64 @t(i32 %1)
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %5, %2
%10 = phi i32 [ 0, %2 ], [ %8, %5 ]
%11 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = tail call i64 @t(i32 %0)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = tail call i64 @t(i32 %1)
%16 = icmp ne i64 %15, 0
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %14, %9
%19 = phi i32 [ 1, %9 ], [ %17, %14 ]
%20 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %19)
ret void
}