#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void print_state(char nids_state) {
  fprintf(stderr, "\n------a_tcp->nids_state = ");
  switch (nids_state) {
  case 1:
    fprintf(stderr, "NIDS_JUST_EST");
    break;
  case 2:
    fprintf(stderr, "NIDS_DATA");
    break;
  case 3:
    fprintf(stderr, "NIDS_CLOSE");
    break;
  case 4:
    fprintf(stderr, "NIDS_RESET");
    break;
  case 5:
    fprintf(stderr, "NIDS_TIMED_OUT");
    break;
  case 6:
    fprintf(stderr, "NIDS_EXITING");
    fprintf(stderr, "\n");
    ;
    break;
  default:
    fprintf(stderr, "%d", (int)nids_state);
    break;
  }
  fprintf(stderr, "------");
  fprintf(stderr, "\n");
  ;
}


x86 assembly (clang, -O0):
<print_state>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    0x2ebb(%rip),%rax
mov    (%rax),%edi
lea    0xeea(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
movsbl -0x1(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x5,%eax
ja     121e <print_state+0x10e>
mov    -0x10(%rbp),%rax
lea    0xeaa(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1239 <print_state+0x129>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
lea    0xeb7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1239 <print_state+0x129>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
lea    0xea5(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1239 <print_state+0x129>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1239 <print_state+0x129>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
lea    0xe83(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1239 <print_state+0x129>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
lea    0xe76(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
lea    0xe6c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1239 <print_state+0x129>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
movsbl -0x1(%rbp),%edx
lea    0xe4e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
lea    0xe3a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d89(%rip),%rax
mov    (%rax),%edi
lea    0xe1e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_state>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    0x2ec3(%rip),%r14
mov    (%r14),%edi
lea    0xef1(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    -0x1(%rbx),%eax
cmp    $0x5,%eax
ja     1152 <print_state+0x42>
lea    0xec3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    (%r14),%edi
lea    0xee4(%rip),%rsi
jmp    11b2 <print_state+0xa2>
mov    (%r14),%edi
lea    0xf24(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    11b9 <print_state+0xa9>
mov    (%r14),%edi
lea    0xed1(%rip),%rsi
jmp    11b2 <print_state+0xa2>
mov    (%r14),%edi
lea    0xecf(%rip),%rsi
jmp    11b2 <print_state+0xa2>
mov    (%r14),%edi
lea    0xece(%rip),%rsi
jmp    11b2 <print_state+0xa2>
mov    (%r14),%edi
lea    0xecd(%rip),%rsi
jmp    11b2 <print_state+0xa2>
mov    (%r14),%edi
lea    0xed0(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xecc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xec0(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xeaa(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"\0A------a_tcp->nids_state = \00"
@.str.1 = [14 x i8] c"NIDS_JUST_EST\00"
@.str.2 = [10 x i8] c"NIDS_DATA\00"
@.str.3 = [11 x i8] c"NIDS_CLOSE\00"
@.str.4 = [11 x i8] c"NIDS_RESET\00"
@.str.5 = [15 x i8] c"NIDS_TIMED_OUT\00"
@.str.6 = [13 x i8] c"NIDS_EXITING\00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [7 x i8] c"------\00"
define void @print_state(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i32, i32* @stderr
%4 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
switch i32 %6, label %27 [
i32 1, label %7
i32 2, label %10
i32 3, label %13
i32 4, label %16
i32 5, label %19
i32 6, label %22
]
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %32
10: ; preds = %1
%11 = load i32, i32* @stderr
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %32
13: ; preds = %1
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %32
16: ; preds = %1
%17 = load i32, i32* @stderr
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %32
19: ; preds = %1
%20 = load i32, i32* @stderr
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %32
22: ; preds = %1
%23 = load i32, i32* @stderr
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%25 = load i32, i32* @stderr
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %32
27: ; preds = %1
%28 = load i32, i32* @stderr
%29 = load i8, i8* %2
%30 = sext i8 %29 to i32
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %27, %22, %19, %16, %13, %10, %7
%33 = load i32, i32* @stderr
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%35 = load i32, i32* @stderr
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"\0A------a_tcp->nids_state = \00"
@.str.1 = [14 x i8] c"NIDS_JUST_EST\00"
@.str.2 = [10 x i8] c"NIDS_DATA\00"
@.str.3 = [11 x i8] c"NIDS_CLOSE\00"
@.str.4 = [11 x i8] c"NIDS_RESET\00"
@.str.5 = [15 x i8] c"NIDS_TIMED_OUT\00"
@.str.6 = [13 x i8] c"NIDS_EXITING\00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [7 x i8] c"------\00"
define void @print_state(i8 signext %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%4 = sext i8 %0 to i32
switch i32 %4, label %25 [
i32 1, label %5
i32 2, label %8
i32 3, label %11
i32 4, label %14
i32 5, label %17
i32 6, label %20
]
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %28
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %28
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %28
14: ; preds = %1
%15 = load i32, i32* @stderr
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %28
17: ; preds = %1
%18 = load i32, i32* @stderr
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %28
20: ; preds = %1
%21 = load i32, i32* @stderr
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%23 = load i32, i32* @stderr
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %28
25: ; preds = %1
%26 = load i32, i32* @stderr
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 %4)
br label %28
28: ; preds = %25, %20, %17, %14, %11, %8, %5
%29 = load i32, i32* @stderr
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%31 = load i32, i32* @stderr
%32 = tail call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
ret void
}