#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 *action_reverse_print_test(void *carry, void *data, void *param) {
  static int max;
  if (!carry) {
    max = 1000;
  }
  if (param) {

    ;
  }
  assert(max == *(int *)data);
  --max;
  return data;
}


x86 assembly (clang, -O0):
<action_reverse_print_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1139 <action_reverse_print_test+0x29>
movl   $0x3e8,0x2ef3(%rip)
cmpq   $0x0,-0x18(%rbp)
je     1149 <action_reverse_print_test+0x39>
jmp    1149 <action_reverse_print_test+0x39>
mov    0x2edd(%rip),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    0x2ec4(%rip),%eax
add    $0xffffffff,%eax
mov    %eax,0x2ebb(%rip)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<action_reverse_print_test>:
push   %rbx
mov    %rsi,%rbx
test   %rdi,%rdi
je     1121 <action_reverse_print_test+0x11>
mov    0x2f0d(%rip),%eax
jmp    1130 <action_reverse_print_test+0x20>
movl   $0x3e8,0x2f01(%rip)
mov    $0x3e8,%eax
xor    %edi,%edi
cmp    (%rbx),%eax
sete   %dil
call   1030 <assert@plt>
addl   $0xffffffff,0x2ee8(%rip)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@action_reverse_print_test.max = internal global i32 0
define i8* @action_reverse_print_test(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %3
store i32 1000, i32* @action_reverse_print_test.max
br label %10
10: ; preds = %9, %3
%11 = load i8*, i8** %6
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %14
13: ; preds = %10
br label %14
14: ; preds = %13, %10
%15 = load i32, i32* @action_reverse_print_test.max
%16 = load i8*, i8** %5
%17 = bitcast i8* %16 to i32*
%18 = load i32, i32* %17
%19 = icmp eq i32 %15, %18
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load i32, i32* @action_reverse_print_test.max
%23 = add nsw i32 %22, -1
store i32 %23, i32* @action_reverse_print_test.max
%24 = load i8*, i8** %5
ret i8* %24
}

LLVM IR (-O2):
@action_reverse_print_test.max = internal unnamed_addr global i32 0
define i8* @action_reverse_print_test(i8* readnone %0, i8* returned %1, i8* nocapture readnone %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = load i32, i32* @action_reverse_print_test.max
br label %8
7: ; preds = %3
store i32 1000, i32* @action_reverse_print_test.max
br label %8
8: ; preds = %5, %7
%9 = phi i32 [ %6, %5 ], [ 1000, %7 ]
%10 = bitcast i8* %1 to i32*
%11 = load i32, i32* %10
%12 = icmp eq i32 %9, %11
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = load i32, i32* @action_reverse_print_test.max
%16 = add nsw i32 %15, -1
store i32 %16, i32* @action_reverse_print_test.max
ret i8* %1
}