#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 Abc_MaxInt(int, int);
int /*<<< orphan*/ assert(int);
int If_LogCounterDelayXor(int *pTimes, int nTimes) {
  int i;
  assert(nTimes > 0);
  for (i = nTimes - 1; i > 0; i--)
    pTimes[i - 1] = 2 + Abc_MaxInt(pTimes[i], pTimes[i - 1]);
  return pTimes[0];
}


x86 assembly (clang, -O0):
<If_LogCounterDelayXor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1196 <If_LogCounterDelayXor+0x76>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
call   1030 <Abc_MaxInt@plt>
mov    %eax,%edx
add    $0x2,%edx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1149 <If_LogCounterDelayXor+0x29>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<If_LogCounterDelayXor>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%r14
xor    %edi,%edi
test   %esi,%esi
setg   %dil
call   1040 <assert@plt>
cmp    $0x2,%ebp
jl     117e <If_LogCounterDelayXor+0x5e>
mov    %ebp,%ebp
mov    $0xfffffffe,%ebx
add    %rbp,%rbx
add    $0xffffffffffffffff,%rbp
nopl   0x0(%rax)
mov    %ebp,%eax
mov    (%r14,%rax,4),%edi
mov    %ebx,%r15d
mov    (%r14,%r15,4),%esi
call   1030 <Abc_MaxInt@plt>
add    $0x2,%eax
mov    %eax,(%r14,%r15,4)
add    $0xffffffffffffffff,%rbx
lea    -0x1(%rbp),%rax
add    $0x1,%rbp
cmp    $0x2,%rbp
mov    %rax,%rbp
ja     1150 <If_LogCounterDelayXor+0x30>
mov    (%r14),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @If_LogCounterDelayXor(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %5
br label %12
12: ; preds = %34, %2
%13 = load i32, i32* %5
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %37
15: ; preds = %12
%16 = load i32*, i32** %3
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
%20 = load i32, i32* %19
%21 = load i32*, i32** %3
%22 = load i32, i32* %5
%23 = sub nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %21, i64 %24
%26 = load i32, i32* %25
%27 = call i32 @Abc_MaxInt(i32 %20, i32 %26)
%28 = add nsw i32 2, %27
%29 = load i32*, i32** %3
%30 = load i32, i32* %5
%31 = sub nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %29, i64 %32
store i32 %28, i32* %33
br label %34
34: ; preds = %15
%35 = load i32, i32* %5
%36 = add nsw i32 %35, -1
store i32 %36, i32* %5
br label %12
37: ; preds = %12
%38 = load i32*, i32** %3
%39 = getelementptr inbounds i32, i32* %38, i64 0
%40 = load i32, i32* %39
ret i32 %40
}

LLVM IR (-O2):
define i32 @If_LogCounterDelayXor(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp sgt i32 %1, 1
br i1 %6, label %7, label %22
7: ; preds = %2
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ %8, %7 ], [ %11, %9 ]
%11 = add nsw i64 %10, -1
%12 = and i64 %11, 4294967295
%13 = getelementptr inbounds i32, i32* %0, i64 %12
%14 = load i32, i32* %13
%15 = add nuw i64 %10, 4294967294
%16 = and i64 %15, 4294967295
%17 = getelementptr inbounds i32, i32* %0, i64 %16
%18 = load i32, i32* %17
%19 = tail call i32 @Abc_MaxInt(i32 %14, i32 %18)
%20 = add nsw i32 %19, 2
store i32 %20, i32* %17
%21 = icmp ugt i64 %10, 2
br i1 %21, label %9, label %22
22: ; preds = %9, %2
%23 = load i32, i32* %0
ret i32 %23
}