#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);
int /*<<< orphan*/ printf(char *);
void print_error_and_quit(char mode) {
  printf("tcc_service : ");
  switch (mode) {
  case 'd': {
    printf("Failed to open the device. Quitting.\n");
    break;
  }
  case 'f': {
    printf("Failed to open file. Quitting.\n");
    break;
  }
  }
  exit(-1);
}


x86 assembly (clang, -O0):
<print_error_and_quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x64,%eax
je     1160 <print_error_and_quit+0x40>
jmp    114f <print_error_and_quit+0x2f>
mov    -0x8(%rbp),%eax
sub    $0x66,%eax
je     1171 <print_error_and_quit+0x51>
jmp    117d <print_error_and_quit+0x5d>
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
jmp    117d <print_error_and_quit+0x5d>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<print_error_and_quit>:
push   %rbx
mov    %edi,%ebx
lea    0xec6(%rip),%rdi
call   1040 <printf@plt>
cmp    $0x64,%ebx
je     1152 <print_error_and_quit+0x22>
cmp    $0x66,%ebx
jne    115e <print_error_and_quit+0x2e>
lea    0xebf(%rip),%rdi
jmp    1159 <print_error_and_quit+0x29>
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"tcc_service : \00"
@.str.1 = [38 x i8] c"Failed to open the device. Quitting.\0A\00"
@.str.2 = [32 x i8] c"Failed to open file. Quitting.\0A\00"
define void @print_error_and_quit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
switch i32 %5, label %10 [
i32 100, label %6
i32 102, label %8
]
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
br label %10
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %1, %8, %6
%11 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [15 x i8] c"tcc_service : \00"
@str = [31 x i8] c"Failed to open file. Quitting.\00"
@str.3 = [37 x i8] c"Failed to open the device. Quitting.\00"
define void @print_error_and_quit(i8 signext %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = sext i8 %0 to i32
switch i32 %3, label %8 [
i32 100, label %5
i32 102, label %4
]
4: ; preds = %1
br label %5
5: ; preds = %1, %4
%6 = phi i8* [ getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0), %4 ], [ getelementptr inbounds ([37 x i8], [37 x i8]* @str.3, i64 0, i64 0), %1 ]
%7 = tail call i32 @puts(i8* dereferenceable(1) %6)
br label %8
8: ; preds = %5, %1
%9 = tail call i32 @exit(i32 -1)
unreachable
}