#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*/ fatal_error(char *, char *);
int /*<<< orphan*/ fatal_error_i(char *, int);
scalar_t__ ieee2flt(unsigned char *);
int prod_def_temp_size(unsigned char **);
int /*<<< orphan*/ sprintf(char *, char *, int, ...);
int /*<<< orphan*/ strlen(char *);
int uint2(unsigned char *);
int uint4(unsigned char *);
int f_hybrid(int mode, unsigned char **sec, float *data, unsigned int ndata,
             char *inv_out, void **local) {
  int pdtsize, n, secsize, k;
  if (mode >= 0) {
    pdtsize = prod_def_temp_size(sec);
    secsize = (sec[4] ? uint4(sec[4] + 0) : 0);
    n = uint2(&(sec[4][5]));
    if (n % 2 != 0)
      fatal_error_i("vertical coordinate parameters should be in pairs, n=%d",
                    n);
    if (n == 0)
      return 0;
    if (pdtsize + 4 * n > secsize)
      fatal_error("not enough space allocated for vertical coordinate data",
                  "");
    sprintf(inv_out, "Hybrid levels=%d", n / 2);
    inv_out += strlen(inv_out);
    for (k = 1; k <= n / 2; k++) {
      sprintf(inv_out, " %d=(%9.6f,%9.6f)", k,
              (double)ieee2flt(sec[4] + pdtsize + k * 8 - 8),
              (double)ieee2flt(sec[4] + pdtsize + k * 8 - 4));
      inv_out += strlen(inv_out);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<f_hybrid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1362 <f_hybrid+0x1e2>
mov    -0x10(%rbp),%rdi
call   1080 <prod_def_temp_size@plt>
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x20(%rax)
je     11d8 <f_hybrid+0x58>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1050 <uint4@plt>
mov    %eax,-0x44(%rbp)
jmp    11e2 <f_hybrid+0x62>
xor    %eax,%eax
mov    %eax,-0x44(%rbp)
jmp    11e2 <f_hybrid+0x62>
mov    -0x44(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
add    $0x5,%rdi
call   1040 <uint2@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     121f <f_hybrid+0x9f>
mov    -0x38(%rbp),%esi
lea    0xde6(%rip),%rdi
call   1030 <fatal_error_i@plt>
cmpl   $0x0,-0x38(%rbp)
jne    1235 <f_hybrid+0xb5>
movl   $0x0,-0x4(%rbp)
jmp    1369 <f_hybrid+0x1e9>
mov    -0x34(%rbp),%eax
mov    -0x38(%rbp),%ecx
shl    $0x2,%ecx
add    %ecx,%eax
cmp    -0x3c(%rbp),%eax
jle    125c <f_hybrid+0xdc>
lea    0xde8(%rip),%rdi
lea    0xe3b(%rip),%rsi
call   1090 <fatal_error@plt>
mov    -0x28(%rbp),%rdi
mov    -0x38(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xdfc(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
mov    -0x28(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
movl   $0x1,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x38(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
cmp    %ecx,%eax
jg     135d <f_hybrid+0x1dd>
mov    -0x28(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
movslq -0x34(%rbp),%rax
add    %rax,%rdi
mov    -0x40(%rbp),%eax
shl    $0x3,%eax
cltq
add    %rax,%rdi
add    $0xfffffffffffffff8,%rdi
call   1070 <ieee2flt@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
movslq -0x34(%rbp),%rax
add    %rax,%rdi
mov    -0x40(%rbp),%eax
shl    $0x3,%eax
cltq
add    %rax,%rdi
add    $0xfffffffffffffffc,%rdi
call   1070 <ieee2flt@plt>
mov    -0x60(%rbp),%rdi
mov    -0x54(%rbp),%edx
movsd  -0x50(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
lea    0xd52(%rip),%rsi
mov    $0x2,%al
call   10a0 <sprintf@plt>
mov    -0x28(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    129b <f_hybrid+0x11b>
jmp    1362 <f_hybrid+0x1e2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_hybrid>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
js     12b0 <f_hybrid+0x130>
mov    %r8,%r13
mov    %rsi,%r14
mov    %rsi,%rdi
call   1080 <prod_def_temp_size@plt>
mov    %eax,%r15d
mov    0x20(%r14),%rdi
test   %rdi,%rdi
je     11ba <f_hybrid+0x3a>
call   1050 <uint4@plt>
mov    %eax,%ebx
mov    0x20(%r14),%rdi
jmp    11be <f_hybrid+0x3e>
xor    %edi,%edi
xor    %ebx,%ebx
add    $0x5,%rdi
call   1040 <uint2@plt>
mov    %eax,%ebp
test   $0x1,%bpl
jne    11d8 <f_hybrid+0x58>
test   %ebp,%ebp
jne    11e6 <f_hybrid+0x66>
jmp    12b0 <f_hybrid+0x130>
lea    0xe21(%rip),%rdi
mov    %ebp,%esi
call   1030 <fatal_error_i@plt>
lea    (%r15,%rbp,4),%eax
cmp    %ebx,%eax
jle    1201 <f_hybrid+0x81>
lea    0xe43(%rip),%rdi
lea    0xe96(%rip),%rsi
call   1090 <fatal_error@plt>
mov    %ebp,%r12d
shr    $0x1f,%r12d
add    %ebp,%r12d
sar    %r12d
lea    0xe5b(%rip),%rsi
mov    %r13,%rdi
mov    %r12d,%edx
xor    %eax,%eax
call   10a0 <sprintf@plt>
mov    %r13,%rdi
call   1060 <strlen@plt>
cmp    $0x2,%ebp
jl     12b0 <f_hybrid+0x130>
cltq
add    %rax,%r13
movslq %r15d,%rbp
add    $0x1,%r12d
mov    $0x1,%ebx
lea    0xe36(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    0x20(%r14),%rdi
add    %rbp,%rdi
call   1070 <ieee2flt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,(%rsp)
mov    0x20(%r14),%rax
lea    (%rax,%rbp,1),%rdi
add    $0x4,%rdi
call   1070 <ieee2flt@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
mov    %r13,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
movsd  (%rsp),%xmm0
mov    $0x2,%al
call   10a0 <sprintf@plt>
mov    %r13,%rdi
call   1060 <strlen@plt>
cltq
add    %rax,%r13
add    $0x1,%rbx
add    $0x8,%rbp
cmp    %rbx,%r12
jne    1250 <f_hybrid+0xd0>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [56 x i8] c"vertical coordinate parameters should be in pairs, n=%d\00"
@.str.1 = [56 x i8] c"not enough space allocated for vertical coordinate data\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [17 x i8] c"Hybrid levels=%d\00"
@.str.4 = [18 x i8] c" %d=(%9.6f,%9.6f)\00"
define i32 @f_hybrid(i32 %0, i8** %1, float* %2, i32 %3, i8* %4, i8** %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8**
%10 = alloca float*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8**
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i32 %0, i32* %8
store i8** %1, i8*** %9
store float* %2, float** %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i8** %5, i8*** %13
%18 = load i32, i32* %8
%19 = icmp sge i32 %18, 0
br i1 %19, label %20, label %114
20: ; preds = %6
%21 = load i8**, i8*** %9
%22 = call i32 @prod_def_temp_size(i8** %21)
store i32 %22, i32* %14
%23 = load i8**, i8*** %9
%24 = getelementptr inbounds i8*, i8** %23, i64 4
%25 = load i8*, i8** %24
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %33
27: ; preds = %20
%28 = load i8**, i8*** %9
%29 = getelementptr inbounds i8*, i8** %28, i64 4
%30 = load i8*, i8** %29
%31 = getelementptr inbounds i8, i8* %30, i64 0
%32 = call i32 @uint4(i8* %31)
br label %34
33: ; preds = %20
br label %34
34: ; preds = %33, %27
%35 = phi i32 [ %32, %27 ], [ 0, %33 ]
store i32 %35, i32* %16
%36 = load i8**, i8*** %9
%37 = getelementptr inbounds i8*, i8** %36, i64 4
%38 = load i8*, i8** %37
%39 = getelementptr inbounds i8, i8* %38, i64 5
%40 = call i32 @uint2(i8* %39)
store i32 %40, i32* %15
%41 = load i32, i32* %15
%42 = srem i32 %41, 2
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %34
%45 = load i32, i32* %15
%46 = call i32 @fatal_error_i(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %45)
br label %47
47: ; preds = %44, %34
%48 = load i32, i32* %15
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %51
50: ; preds = %47
store i32 0, i32* %7
br label %115
51: ; preds = %47
%52 = load i32, i32* %14
%53 = load i32, i32* %15
%54 = mul nsw i32 4, %53
%55 = add nsw i32 %52, %54
%56 = load i32, i32* %16
%57 = icmp sgt i32 %55, %56
br i1 %57, label %58, label %60
58: ; preds = %51
%59 = call i32 @fatal_error(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %60
60: ; preds = %58, %51
%61 = load i8*, i8** %12
%62 = load i32, i32* %15
%63 = sdiv i32 %62, 2
%64 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %61, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %63)
%65 = load i8*, i8** %12
%66 = call i32 @strlen(i8* %65)
%67 = load i8*, i8** %12
%68 = sext i32 %66 to i64
%69 = getelementptr inbounds i8, i8* %67, i64 %68
store i8* %69, i8** %12
store i32 1, i32* %17
br label %70
70: ; preds = %110, %60
%71 = load i32, i32* %17
%72 = load i32, i32* %15
%73 = sdiv i32 %72, 2
%74 = icmp sle i32 %71, %73
br i1 %74, label %75, label %113
75: ; preds = %70
%76 = load i8*, i8** %12
%77 = load i32, i32* %17
%78 = load i8**, i8*** %9
%79 = getelementptr inbounds i8*, i8** %78, i64 4
%80 = load i8*, i8** %79
%81 = load i32, i32* %14
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8, i8* %80, i64 %82
%84 = load i32, i32* %17
%85 = mul nsw i32 %84, 8
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8, i8* %83, i64 %86
%88 = getelementptr inbounds i8, i8* %87, i64 -8
%89 = call i64 @ieee2flt(i8* %88)
%90 = sitofp i64 %89 to double
%91 = load i8**, i8*** %9
%92 = getelementptr inbounds i8*, i8** %91, i64 4
%93 = load i8*, i8** %92
%94 = load i32, i32* %14
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i8, i8* %93, i64 %95
%97 = load i32, i32* %17
%98 = mul nsw i32 %97, 8
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i8, i8* %96, i64 %99
%101 = getelementptr inbounds i8, i8* %100, i64 -4
%102 = call i64 @ieee2flt(i8* %101)
%103 = sitofp i64 %102 to double
%104 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %76, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %77, double %90, double %103)
%105 = load i8*, i8** %12
%106 = call i32 @strlen(i8* %105)
%107 = load i8*, i8** %12
%108 = sext i32 %106 to i64
%109 = getelementptr inbounds i8, i8* %107, i64 %108
store i8* %109, i8** %12
br label %110
110: ; preds = %75
%111 = load i32, i32* %17
%112 = add nsw i32 %111, 1
store i32 %112, i32* %17
br label %70
113: ; preds = %70
br label %114
114: ; preds = %113, %6
store i32 0, i32* %7
br label %115
115: ; preds = %114, %50
%116 = load i32, i32* %7
ret i32 %116
}

LLVM IR (-O2):
@.str = [56 x i8] c"vertical coordinate parameters should be in pairs, n=%d\00"
@.str.1 = [56 x i8] c"not enough space allocated for vertical coordinate data\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [17 x i8] c"Hybrid levels=%d\00"
@.str.4 = [18 x i8] c" %d=(%9.6f,%9.6f)\00"
define i32 @f_hybrid(i32 %0, i8** %1, float* nocapture readnone %2, i32 %3, i8* %4, i8** nocapture readnone %5) {
%7 = icmp sgt i32 %0, -1
br i1 %7, label %8, label %67
8: ; preds = %6
%9 = tail call i32 @prod_def_temp_size(i8** %1)
%10 = getelementptr inbounds i8*, i8** %1, i64 4
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %16, label %13
13: ; preds = %8
%14 = tail call i32 @uint4(i8* %11)
%15 = load i8*, i8** %10
br label %16
16: ; preds = %8, %13
%17 = phi i8* [ %15, %13 ], [ null, %8 ]
%18 = phi i32 [ %14, %13 ], [ 0, %8 ]
%19 = getelementptr inbounds i8, i8* %17, i64 5
%20 = tail call i32 @uint2(i8* %19)
%21 = and i32 %20, 1
%22 = icmp eq i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %16
%24 = tail call i32 @fatal_error_i(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %20)
br label %27
25: ; preds = %16
%26 = icmp eq i32 %20, 0
br i1 %26, label %67, label %27
27: ; preds = %23, %25
%28 = shl nsw i32 %20, 2
%29 = add nsw i32 %28, %9
%30 = icmp sgt i32 %29, %18
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = tail call i32 @fatal_error(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %33
33: ; preds = %31, %27
%34 = sdiv i32 %20, 2
%35 = tail call i32 (i8*, i8*, i32, ...) @sprintf(i8* dereferenceable(1) %4, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %34)
%36 = tail call i32 @strlen(i8* %4)
%37 = icmp slt i32 %20, 2
br i1 %37, label %67, label %38
38: ; preds = %33
%39 = sext i32 %36 to i64
%40 = getelementptr inbounds i8, i8* %4, i64 %39
%41 = sext i32 %9 to i64
%42 = add nsw i32 %34, 1
%43 = zext i32 %42 to i64
br label %44
44: ; preds = %38, %44
%45 = phi i64 [ 1, %38 ], [ %65, %44 ]
%46 = phi i8* [ %40, %38 ], [ %64, %44 ]
%47 = load i8*, i8** %10
%48 = getelementptr inbounds i8, i8* %47, i64 %41
%49 = shl nsw i64 %45, 3
%50 = getelementptr inbounds i8, i8* %48, i64 -8
%51 = getelementptr inbounds i8, i8* %50, i64 %49
%52 = tail call i64 @ieee2flt(i8* %51)
%53 = sitofp i64 %52 to double
%54 = load i8*, i8** %10
%55 = getelementptr inbounds i8, i8* %54, i64 %41
%56 = getelementptr inbounds i8, i8* %55, i64 -4
%57 = getelementptr inbounds i8, i8* %56, i64 %49
%58 = tail call i64 @ieee2flt(i8* %57)
%59 = sitofp i64 %58 to double
%60 = trunc i64 %45 to i32
%61 = tail call i32 (i8*, i8*, i32, ...) @sprintf(i8* dereferenceable(1) %46, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %60, double %53, double %59)
%62 = tail call i32 @strlen(i8* %46)
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8, i8* %46, i64 %63
%65 = add nuw nsw i64 %45, 1
%66 = icmp eq i64 %65, %43
br i1 %66, label %67, label %44
67: ; preds = %44, %33, %6, %25
ret i32 0
}