#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*/ strcmp(char *, char *);
int pdf_guessfilterlength(int len, char *filter) {
  if (!strcmp(filter, "ASCIIHexDecode"))
    return len / 2;
  if (!strcmp(filter, "ASCII85Decode"))
    return len * 4 / 5;
  if (!strcmp(filter, "FlateDecode"))
    return len * 3;
  if (!strcmp(filter, "RunLengthDecode"))
    return len * 3;
  if (!strcmp(filter, "LZWDecode"))
    return len * 2;
  return len;
}


x86 assembly (clang, -O0):
<pdf_guessfilterlength>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed6(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    114b <pdf_guessfilterlength+0x3b>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    11f1 <pdf_guessfilterlength+0xe1>
mov    -0x10(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    117a <pdf_guessfilterlength+0x6a>
mov    -0x8(%rbp),%eax
shl    $0x2,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    11f1 <pdf_guessfilterlength+0xe1>
mov    -0x10(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    119f <pdf_guessfilterlength+0x8f>
imul   $0x3,-0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11f1 <pdf_guessfilterlength+0xe1>
mov    -0x10(%rbp),%rdi
lea    0xe7f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11c4 <pdf_guessfilterlength+0xb4>
imul   $0x3,-0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11f1 <pdf_guessfilterlength+0xe1>
mov    -0x10(%rbp),%rdi
lea    0xe6a(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11eb <pdf_guessfilterlength+0xdb>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11f1 <pdf_guessfilterlength+0xe1>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pdf_guessfilterlength>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%r14d
lea    0xedf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1182 <pdf_guessfilterlength+0x72>
lea    0xedb(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     118f <pdf_guessfilterlength+0x7f>
lea    0xed6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11ac <pdf_guessfilterlength+0x9c>
lea    0xecf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11ac <pdf_guessfilterlength+0x9c>
lea    0xecc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
sete   %cl
shl    %cl,%r14d
mov    %r14d,%eax
jmp    11b0 <pdf_guessfilterlength+0xa0>
mov    %r14d,%eax
shr    $0x1f,%eax
add    %r14d,%eax
sar    %eax
jmp    11b0 <pdf_guessfilterlength+0xa0>
shl    $0x2,%r14d
movslq %r14d,%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
jmp    11b0 <pdf_guessfilterlength+0xa0>
lea    (%r14,%r14,2),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"ASCIIHexDecode\00"
@.str.1 = [14 x i8] c"ASCII85Decode\00"
@.str.2 = [12 x i8] c"FlateDecode\00"
@.str.3 = [16 x i8] c"RunLengthDecode\00"
@.str.4 = [10 x i8] c"LZWDecode\00"
define i32 @pdf_guessfilterlength(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = call i32 @strcmp(i8* %6, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load i32, i32* %4
%11 = sdiv i32 %10, 2
store i32 %11, i32* %3
br label %43
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = call i32 @strcmp(i8* %13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = load i32, i32* %4
%18 = mul nsw i32 %17, 4
%19 = sdiv i32 %18, 5
store i32 %19, i32* %3
br label %43
20: ; preds = %12
%21 = load i8*, i8** %5
%22 = call i32 @strcmp(i8* %21, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp ne i32 %22, 0
br i1 %23, label %27, label %24
24: ; preds = %20
%25 = load i32, i32* %4
%26 = mul nsw i32 %25, 3
store i32 %26, i32* %3
br label %43
27: ; preds = %20
%28 = load i8*, i8** %5
%29 = call i32 @strcmp(i8* %28, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%30 = icmp ne i32 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %27
%32 = load i32, i32* %4
%33 = mul nsw i32 %32, 3
store i32 %33, i32* %3
br label %43
34: ; preds = %27
%35 = load i8*, i8** %5
%36 = call i32 @strcmp(i8* %35, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%37 = icmp ne i32 %36, 0
br i1 %37, label %41, label %38
38: ; preds = %34
%39 = load i32, i32* %4
%40 = mul nsw i32 %39, 2
store i32 %40, i32* %3
br label %43
41: ; preds = %34
%42 = load i32, i32* %4
store i32 %42, i32* %3
br label %43
43: ; preds = %41, %38, %31, %24, %16, %9
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@.str = [15 x i8] c"ASCIIHexDecode\00"
@.str.1 = [14 x i8] c"ASCII85Decode\00"
@.str.2 = [12 x i8] c"FlateDecode\00"
@.str.3 = [16 x i8] c"RunLengthDecode\00"
@.str.4 = [10 x i8] c"LZWDecode\00"
define i32 @pdf_guessfilterlength(i32 %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(15) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = sdiv i32 %0, 2
br label %28
7: ; preds = %2
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = shl nsw i32 %0, 2
%12 = sdiv i32 %11, 5
br label %28
13: ; preds = %7
%14 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = mul nsw i32 %0, 3
br label %28
18: ; preds = %13
%19 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(16) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = mul nsw i32 %0, 3
br label %28
23: ; preds = %18
%24 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
%26 = zext i1 %25 to i32
%27 = shl nsw i32 %0, %26
br label %28
28: ; preds = %23, %21, %16, %10, %5
%29 = phi i32 [ %22, %21 ], [ %17, %16 ], [ %12, %10 ], [ %6, %5 ], [ %27, %23 ]
ret i32 %29
}