#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 *, char *, char *);
void EC_ext(unsigned char *pds, char *prefix, char *suffix) {
  if ((pds[4]) == 98 &&
      ((int)((pds[0] << 16) + (pds[1] << 8) + pds[2])) >= 45) {
    switch ((((int)((pds[0] << 16) + (pds[1] << 8) + pds[2])) >= 45
                 ? (((1 - (int)((unsigned)(pds[43] & 0x80) >> 6)) *
                     (int)(((pds[43] & 0x7f) << 8) + pds[44])))
                 : 0)) {
    case 1043:
      printf("%smon mean%s", prefix, suffix);
      break;
    case 1070:
      printf("%smon (co)var%s", prefix, suffix);
      break;
    case 1071:
      printf("%smon mean from daily%s", prefix, suffix);
      break;
    default:
      printf("%sECMWF stream?%s", prefix, suffix);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<EC_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x4(%rax),%eax
cmp    $0x62,%eax
jne    126e <EC_ext+0x15e>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x10,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
add    %ecx,%eax
cmp    $0x2d,%eax
jl     126e <EC_ext+0x15e>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x10,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
add    %ecx,%eax
cmp    $0x2d,%eax
jl     11c4 <EC_ext+0xb4>
mov    -0x8(%rbp),%rax
movzbl 0x2b(%rax),%ecx
and    $0x80,%ecx
shr    $0x6,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2b(%rcx),%ecx
and    $0x7f,%ecx
shl    $0x8,%ecx
mov    -0x8(%rbp),%rdx
movzbl 0x2c(%rdx),%edx
add    %edx,%ecx
imul   %ecx,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ce <EC_ext+0xbe>
xor    %eax,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ce <EC_ext+0xbe>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x413,%eax
je     120a <EC_ext+0xfa>
jmp    11e4 <EC_ext+0xd4>
mov    -0x20(%rbp),%eax
sub    $0x42e,%eax
je     1223 <EC_ext+0x113>
jmp    11f7 <EC_ext+0xe7>
mov    -0x20(%rbp),%eax
sub    $0x42f,%eax
je     123c <EC_ext+0x12c>
jmp    1255 <EC_ext+0x145>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xde7(%rip),%rdi
call   1030 <printf@plt>
jmp    1269 <EC_ext+0x159>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xddb(%rip),%rdi
call   1030 <printf@plt>
jmp    1269 <EC_ext+0x159>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xdd2(%rip),%rdi
call   1030 <printf@plt>
jmp    1269 <EC_ext+0x159>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xdd1(%rip),%rdi
call   1030 <printf@plt>
jmp    126e <EC_ext+0x15e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EC_ext>:
cmpb   $0x62,0x4(%rdi)
jne    1176 <EC_ext+0x66>
movzbl (%rdi),%eax
shl    $0x10,%eax
movzbl 0x1(%rdi),%ecx
shl    $0x8,%ecx
or     %eax,%ecx
movzbl 0x2(%rdi),%eax
or     %ecx,%eax
cmp    $0x2d,%eax
jb     1176 <EC_ext+0x66>
movzbl 0x2b(%rdi),%ecx
mov    %ecx,%eax
shr    $0x6,%eax
and    $0xfffffffe,%eax
mov    $0x1,%r8d
sub    %eax,%r8d
and    $0x7f,%ecx
shl    $0x8,%ecx
movzbl 0x2c(%rdi),%eax
or     %ecx,%eax
imul   %r8d,%eax
cmp    $0x413,%eax
je     1177 <EC_ext+0x67>
cmp    $0x42f,%eax
je     1183 <EC_ext+0x73>
cmp    $0x42e,%eax
jne    118f <EC_ext+0x7f>
lea    0xe9c(%rip),%rdi
jmp    1030 <printf@plt>
ret
lea    0xe82(%rip),%rdi
jmp    1030 <printf@plt>
lea    0xe93(%rip),%rdi
jmp    1030 <printf@plt>
lea    0xe9f(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"%smon mean%s\00"
@.str.1 = [16 x i8] c"%smon (co)var%s\00"
@.str.2 = [24 x i8] c"%smon mean from daily%s\00"
@.str.3 = [18 x i8] c"%sECMWF stream?%s\00"
define void @EC_ext(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = getelementptr inbounds i8, i8* %7, i64 4
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = icmp eq i32 %10, 98
br i1 %11, label %12, label %88
12: ; preds = %3
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = shl i32 %16, 16
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = shl i32 %21, 8
%23 = add nsw i32 %17, %22
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i64 2
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = add nsw i32 %23, %27
%29 = icmp sge i32 %28, 45
br i1 %29, label %30, label %88
30: ; preds = %12
%31 = load i8*, i8** %4
%32 = getelementptr inbounds i8, i8* %31, i64 0
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = shl i32 %34, 16
%36 = load i8*, i8** %4
%37 = getelementptr inbounds i8, i8* %36, i64 1
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = shl i32 %39, 8
%41 = add nsw i32 %35, %40
%42 = load i8*, i8** %4
%43 = getelementptr inbounds i8, i8* %42, i64 2
%44 = load i8, i8* %43
%45 = zext i8 %44 to i32
%46 = add nsw i32 %41, %45
%47 = icmp sge i32 %46, 45
br i1 %47, label %48, label %68
48: ; preds = %30
%49 = load i8*, i8** %4
%50 = getelementptr inbounds i8, i8* %49, i64 43
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = and i32 %52, 128
%54 = lshr i32 %53, 6
%55 = sub nsw i32 1, %54
%56 = load i8*, i8** %4
%57 = getelementptr inbounds i8, i8* %56, i64 43
%58 = load i8, i8* %57
%59 = zext i8 %58 to i32
%60 = and i32 %59, 127
%61 = shl i32 %60, 8
%62 = load i8*, i8** %4
%63 = getelementptr inbounds i8, i8* %62, i64 44
%64 = load i8, i8* %63
%65 = zext i8 %64 to i32
%66 = add nsw i32 %61, %65
%67 = mul nsw i32 %55, %66
br label %69
68: ; preds = %30
br label %69
69: ; preds = %68, %48
%70 = phi i32 [ %67, %48 ], [ 0, %68 ]
switch i32 %70, label %83 [
i32 1043, label %71
i32 1070, label %75
i32 1071, label %79
]
71: ; preds = %69
%72 = load i8*, i8** %5
%73 = load i8*, i8** %6
%74 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %72, i8* %73)
br label %87
75: ; preds = %69
%76 = load i8*, i8** %5
%77 = load i8*, i8** %6
%78 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %76, i8* %77)
br label %87
79: ; preds = %69
%80 = load i8*, i8** %5
%81 = load i8*, i8** %6
%82 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %80, i8* %81)
br label %87
83: ; preds = %69
%84 = load i8*, i8** %5
%85 = load i8*, i8** %6
%86 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %84, i8* %85)
br label %87
87: ; preds = %83, %79, %75, %71
br label %88
88: ; preds = %87, %12, %3
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"%smon mean%s\00"
@.str.1 = [16 x i8] c"%smon (co)var%s\00"
@.str.2 = [24 x i8] c"%smon mean from daily%s\00"
@.str.3 = [18 x i8] c"%sECMWF stream?%s\00"
define void @EC_ext(i8* nocapture %0, i8* %1, i8* %2) {
%4 = getelementptr inbounds i8, i8* %0, i64 4
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 98
br i1 %6, label %7, label %41
7: ; preds = %3
%8 = load i8, i8* %0
%9 = zext i8 %8 to i32
%10 = shl nuw nsw i32 %9, 16
%11 = getelementptr inbounds i8, i8* %0, i64 1
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = shl nuw nsw i32 %13, 8
%15 = or i32 %14, %10
%16 = getelementptr inbounds i8, i8* %0, i64 2
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = or i32 %15, %18
%20 = icmp ugt i32 %19, 44
br i1 %20, label %21, label %41
21: ; preds = %7
%22 = getelementptr inbounds i8, i8* %0, i64 43
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = lshr i32 %24, 6
%26 = and i32 %25, 2
%27 = sub nsw i32 1, %26
%28 = shl nuw nsw i32 %24, 8
%29 = and i32 %28, 32512
%30 = getelementptr inbounds i8, i8* %0, i64 44
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = or i32 %29, %32
%34 = mul nsw i32 %27, %33
switch i32 %34, label %37 [
i32 1043, label %38
i32 1070, label %35
i32 1071, label %36
]
35: ; preds = %21
br label %38
36: ; preds = %21
br label %38
37: ; preds = %21
br label %38
38: ; preds = %21, %37, %36, %35
%39 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), %35 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), %36 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), %37 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), %21 ]
%40 = tail call i32 @printf(i8* %39, i8* %1, i8* %2)
br label %41
41: ; preds = %38, %7, %3
ret void
}