#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);
int next_number(int *, int, int);
void next_number_test(void) {
  int num[] = {1, 2, 8};
  assert(next_number(num, 3, 10));
  assert(num[0] == 1);
  assert(num[1] == 2);
  assert(num[2] == 9);
  assert(next_number(num, 3, 10));
  assert(num[0] == 1);
  assert(num[1] == 3);
  assert(num[2] == 0);
  int max_num[] = {9, 9, 9};
  assert(!next_number(max_num, 3, 10));
}


x86 assembly (clang, -O0):
<next_number_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xecf(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    -0xc(%rbp),%rdi
mov    $0x3,%esi
mov    $0xa,%edx
call   1030 <next_number@plt>
mov    %eax,%edi
call   1040 <assert@plt>
cmpl   $0x1,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x2,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x9,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    -0xc(%rbp),%rdi
mov    $0x3,%esi
mov    $0xa,%edx
call   1030 <next_number@plt>
mov    %eax,%edi
call   1040 <assert@plt>
cmpl   $0x1,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x3,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x0,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0xe2f(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe2d(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
mov    $0x3,%esi
mov    $0xa,%edx
call   1030 <next_number@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_number_test>:
push   %rbx
sub    $0x20,%rsp
mov    0xedd(%rip),%eax
mov    %eax,0x8(%rsp)
mov    0xeca(%rip),%rax
mov    %rax,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0xa,%edx
call   1030 <next_number@plt>
mov    %eax,%edi
call   1040 <assert@plt>
xor    %edi,%edi
cmpl   $0x1,(%rsp)
sete   %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmpl   $0x2,0x4(%rsp)
sete   %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmpl   $0x9,0x8(%rsp)
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0xa,%edx
call   1030 <next_number@plt>
mov    %eax,%edi
call   1040 <assert@plt>
xor    %edi,%edi
cmpl   $0x1,(%rsp)
sete   %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmpl   $0x3,0x4(%rsp)
sete   %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmpl   $0x0,0x8(%rsp)
sete   %dil
call   1040 <assert@plt>
mov    0xe41(%rip),%eax
mov    %eax,0x18(%rsp)
mov    0xe2e(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x3,%esi
mov    $0xa,%edx
call   1030 <next_number@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.next_number_test.num = [3 x i32] [i32 1, i32 2, i32 8]
@__const.next_number_test.max_num = [3 x i32] [i32 9, i32 9, i32 9]
define void @next_number_test() {
%1 = alloca [3 x i32]
%2 = alloca [3 x i32]
%3 = bitcast [3 x i32]* %1 to i8*
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%5 = call i32 @next_number(i32* %4, i32 3, i32 10)
%6 = call i32 @assert(i32 %5)
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 1
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 2
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, 9
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%23 = call i32 @next_number(i32* %22, i32 3, i32 10)
%24 = call i32 @assert(i32 %23)
%25 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, 1
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%31 = load i32, i32* %30
%32 = icmp eq i32 %31, 3
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
%35 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
%36 = load i32, i32* %35
%37 = icmp eq i32 %36, 0
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = bitcast [3 x i32]* %2 to i8*
%41 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%42 = call i32 @next_number(i32* %41, i32 3, i32 10)
%43 = icmp ne i32 %42, 0
%44 = xor i1 %43, true
%45 = zext i1 %44 to i32
%46 = call i32 @assert(i32 %45)
ret void
}

LLVM IR (-O2):
@__const.next_number_test.num = [3 x i32] [i32 1, i32 2, i32 8]
@__const.next_number_test.max_num = [3 x i32] [i32 9, i32 9, i32 9]
define void @next_number_test() {
%1 = alloca [3 x i32]
%2 = alloca [3 x i32]
%3 = bitcast [3 x i32]* %1 to i8*
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%5 = call i32 @next_number(i32* %4, i32 3, i32 10)
%6 = call i32 @assert(i32 %5)
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 2
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, 9
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = call i32 @next_number(i32* %4, i32 3, i32 10)
%22 = call i32 @assert(i32 %21)
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 1
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = load i32, i32* %11
%28 = icmp eq i32 %27, 3
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = load i32, i32* %16
%32 = icmp eq i32 %31, 0
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
%35 = bitcast [3 x i32]* %2 to i8*
%36 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%37 = call i32 @next_number(i32* %36, i32 3, i32 10)
%38 = icmp eq i32 %37, 0
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
ret void
}