#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*/ assert(int);
void test(int (*fn)(size_t)) {
  assert(1 == fn(1));
  assert(2 == fn(2));
  assert(3 == fn(3));
  assert(1 == fn(4));
  assert(2 == fn(5));
  assert(3 == fn(6));
  assert(4 == fn(7));
  assert(2 == fn(8));
  assert(1 == fn(9));
  assert(2 == fn(10));
  assert(3 == fn(11));
  assert(3 == fn(12));
  assert(2 == fn(13));
  assert(3 == fn(14));
  assert(4 == fn(15));
  assert(1 == fn(16));
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   *-0x8(%rbp)
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x2,%edi
call   *-0x8(%rbp)
mov    %eax,%ecx
mov    $0x2,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x3,%edi
call   *-0x8(%rbp)
mov    %eax,%ecx
mov    $0x3,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x4,%edi
call   *-0x8(%rbp)
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x5,%edi
call   *-0x8(%rbp)
mov    %eax,%ecx
mov    $0x2,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x6,%edi
call   *-0x8(%rbp)
mov    %eax,%ecx
mov    $0x3,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x7,%edi
call   *-0x8(%rbp)
mov    %eax,%ecx
mov    $0x4,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x8,%edi
call   *-0x8(%rbp)
mov    %eax,%ecx
mov    $0x2,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x9,%edi
call   *-0x8(%rbp)
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0xa,%edi
call   *-0x8(%rbp)
mov    %eax,%ecx
mov    $0x2,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0xb,%edi
call   *-0x8(%rbp)
mov    %eax,%ecx
mov    $0x3,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0xc,%edi
call   *-0x8(%rbp)
mov    %eax,%ecx
mov    $0x3,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0xd,%edi
call   *-0x8(%rbp)
mov    %eax,%ecx
mov    $0x2,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0xe,%edi
call   *-0x8(%rbp)
mov    %eax,%ecx
mov    $0x3,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0xf,%edi
call   *-0x8(%rbp)
mov    %eax,%ecx
mov    $0x4,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x10,%edi
call   *-0x8(%rbp)
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1,%edi
call   *%rbx
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0x2,%edi
call   *%rbx
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0x3,%edi
call   *%rbx
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0x4,%edi
call   *%rbx
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0x5,%edi
call   *%rbx
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0x6,%edi
call   *%rbx
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0x7,%edi
call   *%rbx
xor    %edi,%edi
cmp    $0x4,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0x8,%edi
call   *%rbx
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0x9,%edi
call   *%rbx
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0xa,%edi
call   *%rbx
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0xb,%edi
call   *%rbx
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0xc,%edi
call   *%rbx
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0xd,%edi
call   *%rbx
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0xe,%edi
call   *%rbx
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0xf,%edi
call   *%rbx
xor    %edi,%edi
cmp    $0x4,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0x10,%edi
call   *%rbx
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
pop    %rbx
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @test(i32 (i64)* %0) {
%2 = alloca i32 (i64)*
store i32 (i64)* %0, i32 (i64)** %2
%3 = load i32 (i64)*, i32 (i64)** %2
%4 = call i32 %3(i64 1)
%5 = icmp eq i32 1, %4
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load i32 (i64)*, i32 (i64)** %2
%9 = call i32 %8(i64 2)
%10 = icmp eq i32 2, %9
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32 (i64)*, i32 (i64)** %2
%14 = call i32 %13(i64 3)
%15 = icmp eq i32 3, %14
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i32 (i64)*, i32 (i64)** %2
%19 = call i32 %18(i64 4)
%20 = icmp eq i32 1, %19
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = load i32 (i64)*, i32 (i64)** %2
%24 = call i32 %23(i64 5)
%25 = icmp eq i32 2, %24
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = load i32 (i64)*, i32 (i64)** %2
%29 = call i32 %28(i64 6)
%30 = icmp eq i32 3, %29
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = load i32 (i64)*, i32 (i64)** %2
%34 = call i32 %33(i64 7)
%35 = icmp eq i32 4, %34
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
%38 = load i32 (i64)*, i32 (i64)** %2
%39 = call i32 %38(i64 8)
%40 = icmp eq i32 2, %39
%41 = zext i1 %40 to i32
%42 = call i32 @assert(i32 %41)
%43 = load i32 (i64)*, i32 (i64)** %2
%44 = call i32 %43(i64 9)
%45 = icmp eq i32 1, %44
%46 = zext i1 %45 to i32
%47 = call i32 @assert(i32 %46)
%48 = load i32 (i64)*, i32 (i64)** %2
%49 = call i32 %48(i64 10)
%50 = icmp eq i32 2, %49
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
%53 = load i32 (i64)*, i32 (i64)** %2
%54 = call i32 %53(i64 11)
%55 = icmp eq i32 3, %54
%56 = zext i1 %55 to i32
%57 = call i32 @assert(i32 %56)
%58 = load i32 (i64)*, i32 (i64)** %2
%59 = call i32 %58(i64 12)
%60 = icmp eq i32 3, %59
%61 = zext i1 %60 to i32
%62 = call i32 @assert(i32 %61)
%63 = load i32 (i64)*, i32 (i64)** %2
%64 = call i32 %63(i64 13)
%65 = icmp eq i32 2, %64
%66 = zext i1 %65 to i32
%67 = call i32 @assert(i32 %66)
%68 = load i32 (i64)*, i32 (i64)** %2
%69 = call i32 %68(i64 14)
%70 = icmp eq i32 3, %69
%71 = zext i1 %70 to i32
%72 = call i32 @assert(i32 %71)
%73 = load i32 (i64)*, i32 (i64)** %2
%74 = call i32 %73(i64 15)
%75 = icmp eq i32 4, %74
%76 = zext i1 %75 to i32
%77 = call i32 @assert(i32 %76)
%78 = load i32 (i64)*, i32 (i64)** %2
%79 = call i32 %78(i64 16)
%80 = icmp eq i32 1, %79
%81 = zext i1 %80 to i32
%82 = call i32 @assert(i32 %81)
ret void
}

LLVM IR (-O2):
define void @test(i32 (i64)* nocapture %0) {
%2 = tail call i32 %0(i64 1)
%3 = icmp eq i32 %2, 1
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 %0(i64 2)
%7 = icmp eq i32 %6, 2
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = tail call i32 %0(i64 3)
%11 = icmp eq i32 %10, 3
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = tail call i32 %0(i64 4)
%15 = icmp eq i32 %14, 1
%16 = zext i1 %15 to i32
%17 = tail call i32 @assert(i32 %16)
%18 = tail call i32 %0(i64 5)
%19 = icmp eq i32 %18, 2
%20 = zext i1 %19 to i32
%21 = tail call i32 @assert(i32 %20)
%22 = tail call i32 %0(i64 6)
%23 = icmp eq i32 %22, 3
%24 = zext i1 %23 to i32
%25 = tail call i32 @assert(i32 %24)
%26 = tail call i32 %0(i64 7)
%27 = icmp eq i32 %26, 4
%28 = zext i1 %27 to i32
%29 = tail call i32 @assert(i32 %28)
%30 = tail call i32 %0(i64 8)
%31 = icmp eq i32 %30, 2
%32 = zext i1 %31 to i32
%33 = tail call i32 @assert(i32 %32)
%34 = tail call i32 %0(i64 9)
%35 = icmp eq i32 %34, 1
%36 = zext i1 %35 to i32
%37 = tail call i32 @assert(i32 %36)
%38 = tail call i32 %0(i64 10)
%39 = icmp eq i32 %38, 2
%40 = zext i1 %39 to i32
%41 = tail call i32 @assert(i32 %40)
%42 = tail call i32 %0(i64 11)
%43 = icmp eq i32 %42, 3
%44 = zext i1 %43 to i32
%45 = tail call i32 @assert(i32 %44)
%46 = tail call i32 %0(i64 12)
%47 = icmp eq i32 %46, 3
%48 = zext i1 %47 to i32
%49 = tail call i32 @assert(i32 %48)
%50 = tail call i32 %0(i64 13)
%51 = icmp eq i32 %50, 2
%52 = zext i1 %51 to i32
%53 = tail call i32 @assert(i32 %52)
%54 = tail call i32 %0(i64 14)
%55 = icmp eq i32 %54, 3
%56 = zext i1 %55 to i32
%57 = tail call i32 @assert(i32 %56)
%58 = tail call i32 %0(i64 15)
%59 = icmp eq i32 %58, 4
%60 = zext i1 %59 to i32
%61 = tail call i32 @assert(i32 %60)
%62 = tail call i32 %0(i64 16)
%63 = icmp eq i32 %62, 1
%64 = zext i1 %63 to i32
%65 = tail call i32 @assert(i32 %64)
ret void
}