#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 next_largest(int);
int test_next_largest() {
  return 0b1100 == next_largest(0b1010) && 0b11001 == next_largest(0b10110) &&
         0b11010 == next_largest(0b11001) && 0 == next_largest(0) &&
         ~0 == next_largest(~0);
}


x86 assembly (clang, -O0):
<test_next_largest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xa,%edi
call   1030 <next_largest@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0xc,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    11a3 <test_next_largest+0x93>
mov    $0x16,%edi
call   1030 <next_largest@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x19,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    11a3 <test_next_largest+0x93>
mov    $0x19,%edi
call   1030 <next_largest@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x1a,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    11a3 <test_next_largest+0x93>
xor    %edi,%edi
call   1030 <next_largest@plt>
mov    %eax,%edx
xor    %eax,%eax
xor    %ecx,%ecx
cmp    %edx,%ecx
mov    %al,-0x1(%rbp)
jne    11a3 <test_next_largest+0x93>
mov    $0xffffffff,%edi
call   1030 <next_largest@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_next_largest>:
push   %rbx
mov    $0xa,%edi
call   1030 <next_largest@plt>
xor    %ebx,%ebx
cmp    $0xc,%eax
jne    115f <test_next_largest+0x4f>
mov    $0x16,%edi
call   1030 <next_largest@plt>
cmp    $0x19,%eax
jne    115f <test_next_largest+0x4f>
mov    $0x19,%edi
call   1030 <next_largest@plt>
cmp    $0x1a,%eax
jne    115f <test_next_largest+0x4f>
xor    %ebx,%ebx
xor    %edi,%edi
call   1030 <next_largest@plt>
test   %eax,%eax
jne    115f <test_next_largest+0x4f>
mov    $0xffffffff,%edi
call   1030 <next_largest@plt>
xor    %ebx,%ebx
cmp    $0xffffffff,%eax
sete   %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @test_next_largest() {
%1 = call i32 @next_largest(i32 10)
%2 = icmp eq i32 12, %1
br i1 %2, label %3, label %15
3: ; preds = %0
%4 = call i32 @next_largest(i32 22)
%5 = icmp eq i32 25, %4
br i1 %5, label %6, label %15
6: ; preds = %3
%7 = call i32 @next_largest(i32 25)
%8 = icmp eq i32 26, %7
br i1 %8, label %9, label %15
9: ; preds = %6
%10 = call i32 @next_largest(i32 0)
%11 = icmp eq i32 0, %10
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = call i32 @next_largest(i32 -1)
%14 = icmp eq i32 -1, %13
br label %15
15: ; preds = %12, %9, %6, %3, %0
%16 = phi i1 [ false, %9 ], [ false, %6 ], [ false, %3 ], [ false, %0 ], [ %14, %12 ]
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @test_next_largest() {
%1 = tail call i32 @next_largest(i32 10)
%2 = icmp eq i32 %1, 12
br i1 %2, label %3, label %16
3: ; preds = %0
%4 = tail call i32 @next_largest(i32 22)
%5 = icmp eq i32 %4, 25
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = tail call i32 @next_largest(i32 25)
%8 = icmp eq i32 %7, 26
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = tail call i32 @next_largest(i32 0)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = tail call i32 @next_largest(i32 -1)
%14 = icmp eq i32 %13, -1
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %12, %9, %6, %3, %0
%17 = phi i32 [ 0, %9 ], [ 0, %6 ], [ 0, %3 ], [ 0, %0 ], [ %15, %12 ]
ret i32 %17
}