#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*/ UNREFERENCED_PARAMETER(char *);
int ILibFragmentTextLength(char *text, int textLength, char *delimiter,
                           int delimiterLength, int tokenLength) {
  int RetVal;
  UNREFERENCED_PARAMETER(text);
  UNREFERENCED_PARAMETER(delimiter);
  RetVal = textLength +
           (((textLength / tokenLength) == 1 ? 0 : (textLength / tokenLength)) *
            delimiterLength);
  return (RetVal);
}


x86 assembly (clang, -O0):
<ILibFragmentTextLength>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <UNREFERENCED_PARAMETER@plt>
mov    -0x18(%rbp),%rdi
call   1030 <UNREFERENCED_PARAMETER@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
cltd
idivl  -0x20(%rbp)
cmp    $0x1,%eax
jne    115c <ILibFragmentTextLength+0x4c>
xor    %eax,%eax
mov    %eax,-0x2c(%rbp)
jmp    1166 <ILibFragmentTextLength+0x56>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x20(%rbp)
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x2c(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ILibFragmentTextLength>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%r15d
mov    %ecx,%r14d
mov    %rdx,%rbp
mov    %esi,%ebx
call   1030 <UNREFERENCED_PARAMETER@plt>
mov    %rbp,%rdi
call   1030 <UNREFERENCED_PARAMETER@plt>
mov    %ebx,%eax
cltd
idiv   %r15d
xor    %ecx,%ecx
cmp    $0x1,%eax
cmove  %ecx,%eax
imul   %r14d,%eax
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ILibFragmentTextLength(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = load i8*, i8** %6
%13 = call i32 @UNREFERENCED_PARAMETER(i8* %12)
%14 = load i8*, i8** %8
%15 = call i32 @UNREFERENCED_PARAMETER(i8* %14)
%16 = load i32, i32* %7
%17 = load i32, i32* %7
%18 = load i32, i32* %10
%19 = sdiv i32 %17, %18
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %22
21: ; preds = %5
br label %26
22: ; preds = %5
%23 = load i32, i32* %7
%24 = load i32, i32* %10
%25 = sdiv i32 %23, %24
br label %26
26: ; preds = %22, %21
%27 = phi i32 [ 0, %21 ], [ %25, %22 ]
%28 = load i32, i32* %9
%29 = mul nsw i32 %27, %28
%30 = add nsw i32 %16, %29
store i32 %30, i32* %11
%31 = load i32, i32* %11
ret i32 %31
}

LLVM IR (-O2):
define i32 @ILibFragmentTextLength(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4) {
%6 = tail call i32 @UNREFERENCED_PARAMETER(i8* %0)
%7 = tail call i32 @UNREFERENCED_PARAMETER(i8* %2)
%8 = sdiv i32 %1, %4
%9 = icmp eq i32 %8, 1
%10 = select i1 %9, i32 0, i32 %8
%11 = mul nsw i32 %10, %3
%12 = add nsw i32 %11, %1
ret i32 %12
}