#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ strcmp(char const *, char *);
int check_end_marker(const char *str, int sig_type) {
  switch (sig_type) {
  case (1 << 0):
    if (!strcmp(str, "-----END CERTIFICATE-----"))
      return 1;
    break;
  case (1 << 1):
    if (!strcmp(str, "-----END PRIVATE KEY-----"))
      return 1;
    break;
  case (1 << 2):
    if (!strcmp(str, "-----END RSA PRIVATE KEY-----"))
      return 1;
    break;
  default:
    assert(0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_end_marker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x1,%eax
je     1165 <check_end_marker+0x45>
jmp    1143 <check_end_marker+0x23>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
je     118f <check_end_marker+0x6f>
jmp    1154 <check_end_marker+0x34>
mov    -0x18(%rbp),%eax
sub    $0x4,%eax
je     11b9 <check_end_marker+0x99>
jmp    11e3 <check_end_marker+0xc3>
mov    -0x10(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    118a <check_end_marker+0x6a>
movl   $0x1,-0x4(%rbp)
jmp    11f1 <check_end_marker+0xd1>
jmp    11ea <check_end_marker+0xca>
mov    -0x10(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11b4 <check_end_marker+0x94>
movl   $0x1,-0x4(%rbp)
jmp    11f1 <check_end_marker+0xd1>
jmp    11ea <check_end_marker+0xca>
mov    -0x10(%rbp),%rdi
lea    0xe70(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11de <check_end_marker+0xbe>
movl   $0x1,-0x4(%rbp)
jmp    11f1 <check_end_marker+0xd1>
jmp    11ea <check_end_marker+0xca>
xor    %edi,%edi
call   1040 <assert@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_end_marker>:
push   %rax
cmp    $0x4,%esi
je     1139 <check_end_marker+0x19>
cmp    $0x2,%esi
je     1142 <check_end_marker+0x22>
cmp    $0x1,%esi
jne    1159 <check_end_marker+0x39>
lea    0xec9(%rip),%rsi
jmp    1149 <check_end_marker+0x29>
lea    0xef4(%rip),%rsi
jmp    1149 <check_end_marker+0x29>
lea    0xed1(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
jne    1160 <check_end_marker+0x40>
mov    $0x1,%eax
pop    %rcx
ret
xor    %edi,%edi
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"-----END CERTIFICATE-----\00"
@.str.1 = [26 x i8] c"-----END PRIVATE KEY-----\00"
@.str.2 = [30 x i8] c"-----END RSA PRIVATE KEY-----\00"
define i32 @check_end_marker(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
switch i32 %6, label %25 [
i32 1, label %7
i32 2, label %13
i32 4, label %19
]
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = call i32 @strcmp(i8* %8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %7
store i32 1, i32* %3
br label %28
12: ; preds = %7
br label %27
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %13
store i32 1, i32* %3
br label %28
18: ; preds = %13
br label %27
19: ; preds = %2
%20 = load i8*, i8** %4
%21 = call i32 @strcmp(i8* %20, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %19
store i32 1, i32* %3
br label %28
24: ; preds = %19
br label %27
25: ; preds = %2
%26 = call i32 @assert(i32 0)
br label %27
27: ; preds = %25, %24, %18, %12
store i32 0, i32* %3
br label %28
28: ; preds = %27, %23, %17, %11
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@.str = [26 x i8] c"-----END CERTIFICATE-----\00"
@.str.1 = [26 x i8] c"-----END PRIVATE KEY-----\00"
@.str.2 = [30 x i8] c"-----END RSA PRIVATE KEY-----\00"
define i32 @check_end_marker(i8* nocapture %0, i32 %1) {
switch i32 %1, label %12 [
i32 1, label %3
i32 2, label %6
i32 4, label %9
]
3: ; preds = %2
%4 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(26) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %15, label %14
6: ; preds = %2
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(26) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %15, label %14
9: ; preds = %2
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(30) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %15, label %14
12: ; preds = %2
%13 = tail call i32 @assert(i32 0)
br label %14
14: ; preds = %9, %6, %3, %12
br label %15
15: ; preds = %9, %6, %3, %14
%16 = phi i32 [ 0, %14 ], [ 1, %3 ], [ 1, %6 ], [ 1, %9 ]
ret i32 %16
}