#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*/ printf(char *, ...);
int pstreamInqByteorder(int);
int pstreamInqFiletype(int);
void filedes(int streamID) {
  int filetype;
  printf("\n");
  filetype = pstreamInqFiletype(streamID);
  switch (filetype) {
  case 1:
    printf("  GRIB data\n");
    break;
  case 2:
    printf("  GRIB2 data\n");
    break;
  case 3:
    printf("  netCDF data\n");
    break;
  case 4:
    printf("  netCDF2 data\n");
    break;
  case 5:
    printf("  netCDF4 data\n");
    break;
  case 6:
    printf("  netCDF4 classic data\n");
    break;
  case 7:
    printf("  SERVICE data\n");
    switch (pstreamInqByteorder(streamID)) {
    case 0:
      printf("  byteorder is BIGENDIAN\n");
      break;
    case 1:
      printf("  byteorder is LITTLEENDIAN\n");
      break;
    default:
      printf("  byteorder %d undefined\n", pstreamInqByteorder(streamID));
      break;
    }
    break;
  case 8:
    printf("  EXTRA data\n");
    switch (pstreamInqByteorder(streamID)) {
    case 0:
      printf("  byteorder is BIGENDIAN\n");
      break;
    case 1:
      printf("  byteorder is LITTLEENDIAN\n");
      break;
    default:
      printf("  byteorder %d undefined\n", pstreamInqByteorder(streamID));
      break;
    }
    break;
  case 9:
    printf("  IEG data\n");
    switch (pstreamInqByteorder(streamID)) {
    case 0:
      printf("  byteorder is BIGENDIAN\n");
      break;
    case 1:
      printf("  byteorder is LITTLEENDIAN\n");
      break;
    default:
      printf("  byteorder %d undefined\n", pstreamInqByteorder(streamID));
      break;
    }
    break;
  default:
    printf("  unsupported filetype %d\n", filetype);
    break;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<filedes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    0xf89(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1050 <pstreamInqFiletype@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x8,%eax
ja     1363 <filedes+0x233>
mov    -0x10(%rbp),%rax
lea    0xe8c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1374 <filedes+0x244>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1374 <filedes+0x244>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1374 <filedes+0x244>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1374 <filedes+0x244>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1374 <filedes+0x244>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1374 <filedes+0x244>
lea    0xe90(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <pstreamInqByteorder@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
test   %eax,%eax
je     1228 <filedes+0xf8>
jmp    1217 <filedes+0xe7>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
je     123b <filedes+0x10b>
jmp    124e <filedes+0x11e>
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1266 <filedes+0x136>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1266 <filedes+0x136>
mov    -0x4(%rbp),%edi
call   1040 <pstreamInqByteorder@plt>
mov    %eax,%esi
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1374 <filedes+0x244>
lea    0xe75(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <pstreamInqByteorder@plt>
mov    %eax,%ecx
mov    %ecx,-0x18(%rbp)
test   %eax,%eax
je     12a4 <filedes+0x174>
jmp    1293 <filedes+0x163>
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
je     12b7 <filedes+0x187>
jmp    12ca <filedes+0x19a>
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e2 <filedes+0x1b2>
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e2 <filedes+0x1b2>
mov    -0x4(%rbp),%edi
call   1040 <pstreamInqByteorder@plt>
mov    %eax,%esi
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1374 <filedes+0x244>
lea    0xe07(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <pstreamInqByteorder@plt>
mov    %eax,%ecx
mov    %ecx,-0x1c(%rbp)
test   %eax,%eax
je     1320 <filedes+0x1f0>
jmp    130f <filedes+0x1df>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
je     1333 <filedes+0x203>
jmp    1346 <filedes+0x216>
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    135e <filedes+0x22e>
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    135e <filedes+0x22e>
mov    -0x4(%rbp),%edi
call   1040 <pstreamInqByteorder@plt>
mov    %eax,%esi
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1374 <filedes+0x244>
mov    -0x8(%rbp),%esi
lea    0xd94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filedes>:
push   %rbx
mov    %edi,%ebx
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
call   1070 <pstreamInqFiletype@plt>
lea    -0x1(%rax),%ecx
cmp    $0x8,%ecx
ja     118d <filedes+0x3d>
lea    0xe8d(%rip),%rax
movslq (%rax,%rcx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xf82(%rip),%rdi
call   1040 <puts@plt>
jmp    1248 <filedes+0xf8>
lea    0xeaa(%rip),%rdi
mov    %eax,%esi
jmp    1241 <filedes+0xf1>
lea    0xf56(%rip),%rdi
call   1040 <puts@plt>
jmp    1248 <filedes+0xf8>
lea    0xf37(%rip),%rdi
call   1040 <puts@plt>
jmp    1248 <filedes+0xf8>
lea    0xf17(%rip),%rdi
call   1040 <puts@plt>
jmp    1248 <filedes+0xf8>
lea    0xefa(%rip),%rdi
call   1040 <puts@plt>
jmp    1248 <filedes+0xf8>
lea    0xed5(%rip),%rdi
call   1040 <puts@plt>
jmp    1248 <filedes+0xf8>
lea    0xe83(%rip),%rdi
jmp    1200 <filedes+0xb0>
lea    0xe6d(%rip),%rdi
jmp    1200 <filedes+0xb0>
lea    0xe59(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%edi
call   1060 <pstreamInqByteorder@plt>
cmp    $0x1,%eax
je     1223 <filedes+0xd3>
test   %eax,%eax
jne    1231 <filedes+0xe1>
lea    0xe80(%rip),%rdi
call   1040 <puts@plt>
jmp    1248 <filedes+0xf8>
lea    0xe56(%rip),%rdi
call   1040 <puts@plt>
jmp    1248 <filedes+0xf8>
mov    %ebx,%edi
call   1060 <pstreamInqByteorder@plt>
lea    0xde5(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [13 x i8] c" GRIB data\0A\00"
@.str.2 = [14 x i8] c" GRIB2 data\0A\00"
@.str.3 = [15 x i8] c" netCDF data\0A\00"
@.str.4 = [16 x i8] c" netCDF2 data\0A\00"
@.str.5 = [16 x i8] c" netCDF4 data\0A\00"
@.str.6 = [24 x i8] c" netCDF4 classic data\0A\00"
@.str.7 = [16 x i8] c" SERVICE data\0A\00"
@.str.8 = [26 x i8] c" byteorder is BIGENDIAN\0A\00"
@.str.9 = [29 x i8] c" byteorder is LITTLEENDIAN\0A\00"
@.str.10 = [26 x i8] c" byteorder %d undefined\0A\00"
@.str.11 = [14 x i8] c" EXTRA data\0A\00"
@.str.12 = [12 x i8] c" IEG data\0A\00"
@.str.13 = [27 x i8] c" unsupported filetype %d\0A\00"
define void @filedes(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
%6 = call i32 @pstreamInqFiletype(i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
switch i32 %7, label %59 [
i32 1, label %8
i32 2, label %10
i32 3, label %12
i32 4, label %14
i32 5, label %16
i32 6, label %18
i32 7, label %20
i32 8, label %33
i32 9, label %46
]
8: ; preds = %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %62
10: ; preds = %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %62
12: ; preds = %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %62
14: ; preds = %1
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %62
16: ; preds = %1
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
br label %62
18: ; preds = %1
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
br label %62
20: ; preds = %1
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%22 = load i32, i32* %2
%23 = call i32 @pstreamInqByteorder(i32 %22)
switch i32 %23, label %28 [
i32 0, label %24
i32 1, label %26
]
24: ; preds = %20
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
br label %32
26: ; preds = %20
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
br label %32
28: ; preds = %20
%29 = load i32, i32* %2
%30 = call i32 @pstreamInqByteorder(i32 %29)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %28, %26, %24
br label %62
33: ; preds = %1
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0))
%35 = load i32, i32* %2
%36 = call i32 @pstreamInqByteorder(i32 %35)
switch i32 %36, label %41 [
i32 0, label %37
i32 1, label %39
]
37: ; preds = %33
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
br label %45
39: ; preds = %33
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
br label %45
41: ; preds = %33
%42 = load i32, i32* %2
%43 = call i32 @pstreamInqByteorder(i32 %42)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %41, %39, %37
br label %62
46: ; preds = %1
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%48 = load i32, i32* %2
%49 = call i32 @pstreamInqByteorder(i32 %48)
switch i32 %49, label %54 [
i32 0, label %50
i32 1, label %52
]
50: ; preds = %46
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
br label %58
52: ; preds = %46
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
br label %58
54: ; preds = %46
%55 = load i32, i32* %2
%56 = call i32 @pstreamInqByteorder(i32 %55)
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i32 %56)
br label %58
58: ; preds = %54, %52, %50
br label %62
59: ; preds = %1
%60 = load i32, i32* %3
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0), i32 %60)
br label %62
62: ; preds = %59, %58, %45, %32, %18, %16, %14, %12, %10, %8
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.10 = [26 x i8] c" byteorder %d undefined\0A\00"
@.str.13 = [27 x i8] c" unsupported filetype %d\0A\00"
@str = [11 x i8] c" IEG data\00"
@str.16 = [13 x i8] c" EXTRA data\00"
@str.19 = [15 x i8] c" SERVICE data\00"
@str.20 = [28 x i8] c" byteorder is LITTLEENDIAN\00"
@str.21 = [25 x i8] c" byteorder is BIGENDIAN\00"
@str.22 = [23 x i8] c" netCDF4 classic data\00"
@str.23 = [15 x i8] c" netCDF4 data\00"
@str.24 = [15 x i8] c" netCDF2 data\00"
@str.25 = [14 x i8] c" netCDF data\00"
@str.26 = [13 x i8] c" GRIB2 data\00"
@str.27 = [12 x i8] c" GRIB data\00"
define void @filedes(i32 %0) {
%2 = tail call i32 @putchar(i32 10)
%3 = tail call i32 @pstreamInqFiletype(i32 %0)
switch i32 %3, label %46 [
i32 1, label %4
i32 2, label %6
i32 3, label %8
i32 4, label %10
i32 5, label %12
i32 6, label %14
i32 7, label %16
i32 8, label %26
i32 9, label %36
]
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.27, i64 0, i64 0))
br label %48
6: ; preds = %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.26, i64 0, i64 0))
br label %48
8: ; preds = %1
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.25, i64 0, i64 0))
br label %48
10: ; preds = %1
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.24, i64 0, i64 0))
br label %48
12: ; preds = %1
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.23, i64 0, i64 0))
br label %48
14: ; preds = %1
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.22, i64 0, i64 0))
br label %48
16: ; preds = %1
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.19, i64 0, i64 0))
%18 = tail call i32 @pstreamInqByteorder(i32 %0)
switch i32 %18, label %23 [
i32 0, label %19
i32 1, label %21
]
19: ; preds = %16
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.21, i64 0, i64 0))
br label %48
21: ; preds = %16
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.20, i64 0, i64 0))
br label %48
23: ; preds = %16
%24 = tail call i32 @pstreamInqByteorder(i32 %0)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i32 %24)
br label %48
26: ; preds = %1
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.16, i64 0, i64 0))
%28 = tail call i32 @pstreamInqByteorder(i32 %0)
switch i32 %28, label %33 [
i32 0, label %29
i32 1, label %31
]
29: ; preds = %26
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.21, i64 0, i64 0))
br label %48
31: ; preds = %26
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.20, i64 0, i64 0))
br label %48
33: ; preds = %26
%34 = tail call i32 @pstreamInqByteorder(i32 %0)
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i32 %34)
br label %48
36: ; preds = %1
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%38 = tail call i32 @pstreamInqByteorder(i32 %0)
switch i32 %38, label %43 [
i32 0, label %39
i32 1, label %41
]
39: ; preds = %36
%40 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.21, i64 0, i64 0))
br label %48
41: ; preds = %36
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.20, i64 0, i64 0))
br label %48
43: ; preds = %36
%44 = tail call i32 @pstreamInqByteorder(i32 %0)
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i32 %44)
br label %48
46: ; preds = %1
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0), i32 %3)
br label %48
48: ; preds = %39, %41, %43, %29, %31, %33, %19, %21, %23, %46, %14, %12, %10, %8, %6, %4
%49 = tail call i32 @putchar(i32 10)
ret void
}