#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 */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ instr_out(int *, int, unsigned int, char *, char const *,
                             ...);
void state_max_out(uint32_t *data, uint32_t hw_offset, unsigned int index,
                   const char *name) {
  if (data[index] & 1) {
    if (data[index] == 1) {
      instr_out(data, hw_offset, index, "%s state upper bound disabled\n",
                name);
    } else {
      instr_out(data, hw_offset, index, "%s state upper bound 0x%08x\n", name,
                data[index] & ~1);
    }
  } else {
    instr_out(data, hw_offset, index, "%s state upper bound not updated\n",
              name);
  }
}


x86 assembly (clang, -O0):
<state_max_out>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     119e <state_max_out+0x8e>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
cmpl   $0x1,(%rax,%rcx,4)
jne    116e <state_max_out+0x5e>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%r8
lea    0xe9e(%rip),%rcx
mov    $0x0,%al
call   1030 <instr_out@plt>
jmp    1199 <state_max_out+0x89>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%r8
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    (%rax,%rcx,4),%r9d
and    $0xfffffffe,%r9d
lea    0xe8d(%rip),%rcx
mov    $0x0,%al
call   1030 <instr_out@plt>
jmp    11ba <state_max_out+0xaa>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%r8
lea    0xe89(%rip),%rcx
mov    $0x0,%al
call   1030 <instr_out@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<state_max_out>:
mov    %rcx,%r8
mov    %edx,%eax
mov    (%rdi,%rax,4),%r9d
test   $0x1,%r9b
jne    112d <state_max_out+0x1d>
lea    0xf16(%rip),%rcx
xor    %eax,%eax
jmp    1030 <instr_out@plt>
cmp    $0x1,%r9d
jne    1141 <state_max_out+0x31>
lea    0xec6(%rip),%rcx
xor    %eax,%eax
jmp    1030 <instr_out@plt>
and    $0xfffffffe,%r9d
lea    0xed3(%rip),%rcx
xor    %eax,%eax
jmp    1030 <instr_out@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"%s state upper bound disabled\0A\00"
@.str.1 = [29 x i8] c"%s state upper bound 0x%08x\0A\00"
@.str.2 = [34 x i8] c"%s state upper bound not updated\0A\00"
define void @state_max_out(i32* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load i32*, i32** %5
%10 = load i32, i32* %7
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %9, i64 %11
%13 = load i32, i32* %12
%14 = and i32 %13, 1
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %42
16: ; preds = %4
%17 = load i32*, i32** %5
%18 = load i32, i32* %7
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = load i32, i32* %20
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %29
23: ; preds = %16
%24 = load i32*, i32** %5
%25 = load i32, i32* %6
%26 = load i32, i32* %7
%27 = load i8*, i8** %8
%28 = call i32 (i32*, i32, i32, i8*, i8*, ...) @instr_out(i32* %24, i32 %25, i32 %26, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %27)
br label %41
29: ; preds = %16
%30 = load i32*, i32** %5
%31 = load i32, i32* %6
%32 = load i32, i32* %7
%33 = load i8*, i8** %8
%34 = load i32*, i32** %5
%35 = load i32, i32* %7
%36 = zext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %34, i64 %36
%38 = load i32, i32* %37
%39 = and i32 %38, -2
%40 = call i32 (i32*, i32, i32, i8*, i8*, ...) @instr_out(i32* %30, i32 %31, i32 %32, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %33, i32 %39)
br label %41
41: ; preds = %29, %23
br label %48
42: ; preds = %4
%43 = load i32*, i32** %5
%44 = load i32, i32* %6
%45 = load i32, i32* %7
%46 = load i8*, i8** %8
%47 = call i32 (i32*, i32, i32, i8*, i8*, ...) @instr_out(i32* %43, i32 %44, i32 %45, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %46)
br label %48
48: ; preds = %42, %41
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"%s state upper bound disabled\0A\00"
@.str.1 = [29 x i8] c"%s state upper bound 0x%08x\0A\00"
@.str.2 = [34 x i8] c"%s state upper bound not updated\0A\00"
define void @state_max_out(i32* %0, i32 %1, i32 %2, i8* %3) {
%5 = zext i32 %2 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = load i32, i32* %6
%8 = and i32 %7, 1
%9 = icmp eq i32 %8, 0
br i1 %9, label %17, label %10
10: ; preds = %4
%11 = icmp eq i32 %7, 1
br i1 %11, label %12, label %14
12: ; preds = %10
%13 = tail call i32 (i32*, i32, i32, i8*, i8*, ...) @instr_out(i32* %0, i32 %1, i32 %2, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %19
14: ; preds = %10
%15 = and i32 %7, -2
%16 = tail call i32 (i32*, i32, i32, i8*, i8*, ...) @instr_out(i32* %0, i32 %1, i32 %2, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %3, i32 %15)
br label %19
17: ; preds = %4
%18 = tail call i32 (i32*, i32, i32, i8*, i8*, ...) @instr_out(i32* %0, i32 %1, i32 %2, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %3)
br label %19
19: ; preds = %12, %14, %17
ret void
}