#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*/ printf(char *, int, int);
int testtype(int newmod, int type) {
  printf("Test: testtype newmod=%d, type=%d\n", newmod, type);
  if (newmod == 001) {
    if (type == 1) {
      return 1;
    } else {
      return 0;
    }
  }
  if (newmod == 017) {
    if (type == 4) {
      return 1;
    } else {
      return 0;
    }
  }
  if (newmod == 022) {
    if (type == 5) {
      return 1;
    } else {
      return 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<testtype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    115c <testtype+0x4c>
cmpl   $0x1,-0xc(%rbp)
jne    1150 <testtype+0x40>
movl   $0x1,-0x4(%rbp)
jmp    11bb <testtype+0xab>
movl   $0x0,-0x4(%rbp)
jmp    11bb <testtype+0xab>
cmpl   $0xf,-0x8(%rbp)
jne    1188 <testtype+0x78>
cmpl   $0x4,-0xc(%rbp)
jne    117c <testtype+0x6c>
movl   $0x1,-0x4(%rbp)
jmp    11bb <testtype+0xab>
movl   $0x0,-0x4(%rbp)
jmp    11bb <testtype+0xab>
cmpl   $0x12,-0x8(%rbp)
jne    11b4 <testtype+0xa4>
cmpl   $0x5,-0xc(%rbp)
jne    11a8 <testtype+0x98>
movl   $0x1,-0x4(%rbp)
jmp    11bb <testtype+0xab>
movl   $0x0,-0x4(%rbp)
jmp    11bb <testtype+0xab>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testtype>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xee2(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
cmp    $0x12,%ebp
je     113b <testtype+0x2b>
cmp    $0xf,%ebp
je     1140 <testtype+0x30>
cmp    $0x1,%ebp
jne    1148 <testtype+0x38>
cmp    $0x1,%ebx
jmp    1143 <testtype+0x33>
cmp    $0x5,%ebx
jmp    1143 <testtype+0x33>
cmp    $0x4,%ebx
sete   %al
jmp    114a <testtype+0x3a>
xor    %eax,%eax
movzbl %al,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Test: testtype newmod=%d, type=%d\0A\00"
define i32 @testtype(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i32, i32* %5
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 1, i32* %3
br label %33
15: ; preds = %11
store i32 0, i32* %3
br label %33
16: ; preds = %2
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 15
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load i32, i32* %5
%21 = icmp eq i32 %20, 4
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 1, i32* %3
br label %33
23: ; preds = %19
store i32 0, i32* %3
br label %33
24: ; preds = %16
%25 = load i32, i32* %4
%26 = icmp eq i32 %25, 18
br i1 %26, label %27, label %32
27: ; preds = %24
%28 = load i32, i32* %5
%29 = icmp eq i32 %28, 5
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 1, i32* %3
br label %33
31: ; preds = %27
store i32 0, i32* %3
br label %33
32: ; preds = %24
store i32 0, i32* %3
br label %33
33: ; preds = %32, %31, %30, %23, %22, %15, %14
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@.str = [35 x i8] c"Test: testtype newmod=%d, type=%d\0A\00"
define i32 @testtype(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
switch i32 %0, label %10 [
i32 1, label %4
i32 15, label %6
i32 18, label %8
]
4: ; preds = %2
%5 = icmp eq i32 %1, 1
br label %10
6: ; preds = %2
%7 = icmp eq i32 %1, 4
br label %10
8: ; preds = %2
%9 = icmp eq i32 %1, 5
br label %10
10: ; preds = %2, %8, %6, %4
%11 = phi i1 [ %5, %4 ], [ %7, %6 ], [ %9, %8 ], [ false, %2 ]
%12 = zext i1 %11 to i32
ret i32 %12
}