#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 *, ...);
void btruth(const char *name, bool (*f)(bool, bool)) {
  bool a, b;
  int i;
  printf("%s\n", name);
  for (i = 0; i < 4; i++) {
    a = (i >> 0) & 1;
    b = (i >> 1) & 1;
    printf("%d %d | %d\n", a, b, f(a, b));
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<btruth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    1197 <btruth+0x87>
mov    -0x1c(%rbp),%eax
sar    $0x0,%eax
and    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
sar    $0x1,%eax
and    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   *%rax
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    %eax,%ecx
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1139 <btruth+0x29>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btruth>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1040 <puts@plt>
xor    %edi,%edi
xor    %esi,%esi
call   *%rbx
lea    0xeb7(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   *%rbx
mov    %r14,%rdi
mov    $0x1,%esi
xor    %edx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   *%rbx
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   *%rbx
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [12 x i8] c"%d %d | %d\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @btruth(i8* %0, i32 (i32, i32)* %1) {
%3 = alloca i8*
%4 = alloca i32 (i32, i32)*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store i32 (i32, i32)* %1, i32 (i32, i32)** %4
%8 = load i8*, i8** %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %8)
store i32 0, i32* %7
br label %10
10: ; preds = %27, %2
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 4
br i1 %12, label %13, label %30
13: ; preds = %10
%14 = load i32, i32* %7
%15 = ashr i32 %14, 0
%16 = and i32 %15, 1
store i32 %16, i32* %5
%17 = load i32, i32* %7
%18 = ashr i32 %17, 1
%19 = and i32 %18, 1
store i32 %19, i32* %6
%20 = load i32, i32* %5
%21 = load i32, i32* %6
%22 = load i32 (i32, i32)*, i32 (i32, i32)** %4
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = call i32 %22(i32 %23, i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32 %21, i32 %25)
br label %27
27: ; preds = %13
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
br label %10
30: ; preds = %10
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"%d %d | %d\0A\00"
define void @btruth(i8* nocapture %0, i32 (i32, i32)* nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) %0)
%4 = tail call i32 %1(i32 0, i32 0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0, i32 %4)
%6 = tail call i32 %1(i32 1, i32 0)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 0, i32 %6)
%8 = tail call i32 %1(i32 0, i32 1)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 1, i32 %8)
%10 = tail call i32 %1(i32 1, i32 1)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 1, i32 %10)
%12 = tail call i32 @putchar(i32 10)
ret void
}