#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 report_param_error(int error, int doexit) {
  switch (error) {
  case 0:
    break;
  case 1:
    printf("PARAMETER ERROR - Parameter not found\n");
    break;
  case 2:
    printf("PARAMETER ERROR - Duplicate parameter found\n");
    break;
  default:
    printf("PARAMETER ERROR - unspecified problem\n");
    break;
  }
  if (error && doexit) {
    exit(error);
  }
}


x86 assembly (clang, -O0):
<report_param_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     1163 <report_param_error+0x43>
jmp    1141 <report_param_error+0x21>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     1168 <report_param_error+0x48>
jmp    1152 <report_param_error+0x32>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1179 <report_param_error+0x59>
jmp    118a <report_param_error+0x6a>
jmp    1196 <report_param_error+0x76>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
jmp    1196 <report_param_error+0x76>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
jmp    1196 <report_param_error+0x76>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x4(%rbp)
je     11b2 <report_param_error+0x92>
cmpl   $0x0,-0x8(%rbp)
je     11b2 <report_param_error+0x92>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report_param_error>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
je     1157 <report_param_error+0x37>
mov    %esi,%ebp
mov    %edi,%ebx
cmp    $0x1,%edi
je     113e <report_param_error+0x1e>
cmp    $0x2,%ebx
jne    1147 <report_param_error+0x27>
lea    0xec4(%rip),%rdi
jmp    114e <report_param_error+0x2e>
lea    0xee7(%rip),%rdi
jmp    114e <report_param_error+0x2e>
lea    0xf04(%rip),%rdi
call   1030 <puts@plt>
test   %ebp,%ebp
jne    115e <report_param_error+0x3e>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"PARAMETER ERROR - Parameter not found\0A\00"
@.str.1 = [45 x i8] c"PARAMETER ERROR - Duplicate parameter found\0A\00"
@.str.2 = [39 x i8] c"PARAMETER ERROR - unspecified problem\0A\00"
define void @report_param_error(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
switch i32 %5, label %11 [
i32 0, label %6
i32 1, label %7
i32 2, label %9
]
6: ; preds = %2
br label %13
7: ; preds = %2
%8 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %13
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
br label %13
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
br label %13
13: ; preds = %11, %9, %7, %6
%14 = load i32, i32* %3
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %3
%21 = call i32 @exit(i32 %20)
unreachable
22: ; preds = %16, %13
ret void
}

LLVM IR (-O2):
@str = [44 x i8] c"PARAMETER ERROR - Duplicate parameter found\00"
@str.3 = [38 x i8] c"PARAMETER ERROR - Parameter not found\00"
@str.4 = [38 x i8] c"PARAMETER ERROR - unspecified problem\00"
define void @report_param_error(i32 %0, i32 %1) {
switch i32 %0, label %4 [
i32 0, label %11
i32 1, label %5
i32 2, label %3
]
3: ; preds = %2
br label %5
4: ; preds = %2
br label %5
5: ; preds = %2, %4, %3
%6 = phi i8* [ getelementptr inbounds ([38 x i8], [38 x i8]* @str.4, i64 0, i64 0), %4 ], [ getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0), %3 ], [ getelementptr inbounds ([38 x i8], [38 x i8]* @str.3, i64 0, i64 0), %2 ]
%7 = tail call i32 @puts(i8* dereferenceable(1) %6)
%8 = icmp eq i32 %1, 0
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = tail call i32 @exit(i32 %0)
unreachable
11: ; preds = %2, %5
ret void
}