#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*/ exit(int);
char get_letter();
int /*<<< orphan*/ printf(char *, ...);
void type_mismatch(const char *module) {
  char response = 0;
  printf("Error!\nType was not %s!\n", module);
  while (response == 0) {
    printf("Do you want to force mogconvert to decode the input");
    printf("file as an %s? (y/n) ", module);
    response = get_letter();
    if (response != 'y' && response != 'n')
      response = 0;
  }
  if (response == 'n') {
    printf("Cannot proceed, exiting!\n");
    exit(1);
  } else {
    printf("Warning! We are forcing mogconvert to decode the input file as %s! "
           "This may cause a segmentation fault!\n",
           module);
  }
}


x86 assembly (clang, -O0):
<type_mismatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x9(%rbp),%eax
cmp    $0x0,%eax
jne    11ac <type_mismatch+0x7c>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <get_letter@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x79,%eax
je     11a7 <type_mismatch+0x77>
movsbl -0x9(%rbp),%eax
cmp    $0x6e,%eax
je     11a7 <type_mismatch+0x77>
movb   $0x0,-0x9(%rbp)
jmp    1152 <type_mismatch+0x22>
movsbl -0x9(%rbp),%eax
cmp    $0x6e,%eax
jne    11d1 <type_mismatch+0xa1>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rsi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<type_mismatch>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%rbx
lea    0xeae(%rip),%rdi
xor    %ebp,%ebp
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb4(%rip),%r14
lea    0xee1(%rip),%r15
mov    $0x79,%r12d
jmp    1186 <type_mismatch+0x46>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x79,%al
cmove  %r12d,%ebp
test   %bpl,%bpl
jne    11b6 <type_mismatch+0x76>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <get_letter@plt>
mov    $0x6e,%ebp
cmp    $0x6e,%al
je     1180 <type_mismatch+0x40>
xor    %ebp,%ebp
jmp    1180 <type_mismatch+0x40>
cmp    $0x6e,%bpl
je     11d5 <type_mismatch+0x95>
lea    0xea0(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Error!\0AType was not %s!\0A\00"
@.str.1 = [52 x i8] c"Do you want to force mogconvert to decode the input\00"
@.str.2 = [22 x i8] c"file as an %s? (y/n) \00"
@.str.3 = [26 x i8] c"Cannot proceed, exiting!\0A\00"
@.str.4 = [105 x i8] c"Warning! We are forcing mogconvert to decode the input file as %s! This may cause a segmentation fault!\0A\00"
define void @type_mismatch(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
store i8 0, i8* %3
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %4)
br label %6
6: ; preds = %23, %1
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %24
10: ; preds = %6
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%12 = load i8*, i8** %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = call signext i8 (...) @get_letter()
store i8 %14, i8* %3
%15 = load i8, i8* %3
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 121
br i1 %17, label %18, label %23
18: ; preds = %10
%19 = load i8, i8* %3
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 110
br i1 %21, label %22, label %23
22: ; preds = %18
store i8 0, i8* %3
br label %23
23: ; preds = %22, %18, %10
br label %6
24: ; preds = %6
%25 = load i8, i8* %3
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 110
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %24
%32 = load i8*, i8** %2
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str.4, i64 0, i64 0), i8* %32)
br label %34
34: ; preds = %31
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Error!\0AType was not %s!\0A\00"
@.str.1 = [52 x i8] c"Do you want to force mogconvert to decode the input\00"
@.str.2 = [22 x i8] c"file as an %s? (y/n) \00"
@.str.4 = [105 x i8] c"Warning! We are forcing mogconvert to decode the input file as %s! This may cause a segmentation fault!\0A\00"
@str = [25 x i8] c"Cannot proceed, exiting!\00"
define void @type_mismatch(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %3
3: ; preds = %5, %1
%4 = phi i8 [ 0, %1 ], [ %12, %5 ]
switch i8 %4, label %16 [
i8 0, label %5
i8 110, label %13
]
5: ; preds = %3
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%8 = tail call signext i8 (...) @get_letter()
%9 = icmp eq i8 %8, 110
%10 = select i1 %9, i8 110, i8 0
%11 = icmp eq i8 %8, 121
%12 = select i1 %11, i8 121, i8 %10
br label %3
13: ; preds = %3
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %3
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([105 x i8], [105 x i8]* @.str.4, i64 0, i64 0), i8* %0)
ret void
}