#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 prod_def_temp_size(unsigned char **);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int, int, int);
int /*<<< orphan*/ strlen(char *);
int uint2(unsigned char *);
int uint4(unsigned char *);
int f_Sec4(int mode, unsigned char **sec, float *data, unsigned int ndata,
           char *inv_out, void **local) {
  int pdtsize;
  if (mode >= 0) {
    pdtsize = prod_def_temp_size(sec);
    sprintf(inv_out,
            "Sec4 len=%u #vert coordinate=%u Product Defn Template=4.%d "
            "size=%d free=%d",
            uint4(&(sec[4][0])), uint2(&(sec[4][5])),
            (((int)((sec[4][7] << 8) + (sec[4][8])))), pdtsize,
            uint4(&(sec[4][0])) - pdtsize - 8 * uint2(&(sec[4][5])));
    inv_out += strlen(inv_out);
  }
  return 0;
}


x86 assembly (clang, -O0):
<f_Sec4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     123e <f_Sec4+0xee>
mov    -0x10(%rbp),%rdi
call   1060 <prod_def_temp_size@plt>
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1040 <uint4@plt>
mov    %eax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
add    $0x5,%rdi
call   1030 <uint2@plt>
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
movzbl 0x7(%rax),%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%rcx
mov    0x20(%rcx),%rcx
movzbl 0x8(%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x40(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1040 <uint4@plt>
sub    -0x34(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
add    $0x5,%rdi
call   1030 <uint2@plt>
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%edx
mov    -0x44(%rbp),%ecx
mov    -0x40(%rbp),%r8d
mov    -0x3c(%rbp),%r9d
mov    %eax,%esi
mov    -0x38(%rbp),%eax
shl    $0x3,%esi
sub    %esi,%eax
lea    0xde3(%rip),%rsi
mov    %eax,(%rsp)
call   1070 <sprintf@plt>
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_Sec4>:
test   %edi,%edi
js     11f5 <f_Sec4+0xa5>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,%r15
mov    %rsi,%rbx
mov    %rsi,%rdi
call   1060 <prod_def_temp_size@plt>
mov    %eax,%r13d
mov    0x20(%rbx),%rdi
call   1040 <uint4@plt>
mov    %eax,0x14(%rsp)
mov    0x20(%rbx),%rdi
add    $0x5,%rdi
call   1030 <uint2@plt>
mov    %eax,%r12d
mov    0x20(%rbx),%rdi
movzwl 0x7(%rdi),%ebp
shl    $0x10,%ebp
bswap  %ebp
call   1040 <uint4@plt>
mov    %eax,%r14d
sub    %r13d,%r14d
mov    0x20(%rbx),%rdi
add    $0x5,%rdi
call   1030 <uint2@plt>
shl    $0x3,%eax
sub    %eax,%r14d
mov    %r14d,(%rsp)
lea    0xe36(%rip),%rsi
mov    %r15,%rdi
mov    0x14(%rsp),%edx
mov    %r12d,%ecx
mov    %ebp,%r8d
mov    %r13d,%r9d
call   1070 <sprintf@plt>
mov    %r15,%rdi
call   1050 <strlen@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [75 x i8] c"Sec4 len=%u #vert coordinate=%u Product Defn Template=4.%d size=%d free=%d\00"
define i32 @f_Sec4(i32 %0, i8** %1, float* %2, i32 %3, i8* %4, i8** %5) {
%7 = alloca i32
%8 = alloca i8**
%9 = alloca float*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8**
%13 = alloca i32
store i32 %0, i32* %7
store i8** %1, i8*** %8
store float* %2, float** %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i8** %5, i8*** %12
%14 = load i32, i32* %7
%15 = icmp sge i32 %14, 0
br i1 %15, label %16, label %65
16: ; preds = %6
%17 = load i8**, i8*** %8
%18 = call i32 @prod_def_temp_size(i8** %17)
store i32 %18, i32* %13
%19 = load i8*, i8** %11
%20 = load i8**, i8*** %8
%21 = getelementptr inbounds i8*, i8** %20, i64 4
%22 = load i8*, i8** %21
%23 = getelementptr inbounds i8, i8* %22, i64 0
%24 = call i32 @uint4(i8* %23)
%25 = load i8**, i8*** %8
%26 = getelementptr inbounds i8*, i8** %25, i64 4
%27 = load i8*, i8** %26
%28 = getelementptr inbounds i8, i8* %27, i64 5
%29 = call i32 @uint2(i8* %28)
%30 = load i8**, i8*** %8
%31 = getelementptr inbounds i8*, i8** %30, i64 4
%32 = load i8*, i8** %31
%33 = getelementptr inbounds i8, i8* %32, i64 7
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = shl i32 %35, 8
%37 = load i8**, i8*** %8
%38 = getelementptr inbounds i8*, i8** %37, i64 4
%39 = load i8*, i8** %38
%40 = getelementptr inbounds i8, i8* %39, i64 8
%41 = load i8, i8* %40
%42 = zext i8 %41 to i32
%43 = add nsw i32 %36, %42
%44 = load i32, i32* %13
%45 = load i8**, i8*** %8
%46 = getelementptr inbounds i8*, i8** %45, i64 4
%47 = load i8*, i8** %46
%48 = getelementptr inbounds i8, i8* %47, i64 0
%49 = call i32 @uint4(i8* %48)
%50 = load i32, i32* %13
%51 = sub nsw i32 %49, %50
%52 = load i8**, i8*** %8
%53 = getelementptr inbounds i8*, i8** %52, i64 4
%54 = load i8*, i8** %53
%55 = getelementptr inbounds i8, i8* %54, i64 5
%56 = call i32 @uint2(i8* %55)
%57 = mul nsw i32 8, %56
%58 = sub nsw i32 %51, %57
%59 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i32 %24, i32 %29, i32 %43, i32 %44, i32 %58)
%60 = load i8*, i8** %11
%61 = call i32 @strlen(i8* %60)
%62 = load i8*, i8** %11
%63 = sext i32 %61 to i64
%64 = getelementptr inbounds i8, i8* %62, i64 %63
store i8* %64, i8** %11
br label %65
65: ; preds = %16, %6
ret i32 0
}

LLVM IR (-O2):
@.str = [75 x i8] c"Sec4 len=%u #vert coordinate=%u Product Defn Template=4.%d size=%d free=%d\00"
define i32 @f_Sec4(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 %34
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 = tail call i32 @uint4(i8* %11)
%13 = load i8*, i8** %10
%14 = getelementptr inbounds i8, i8* %13, i64 5
%15 = tail call i32 @uint2(i8* %14)
%16 = load i8*, i8** %10
%17 = getelementptr inbounds i8, i8* %16, i64 7
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = shl nuw nsw i32 %19, 8
%21 = getelementptr inbounds i8, i8* %16, i64 8
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = or i32 %20, %23
%25 = tail call i32 @uint4(i8* %16)
%26 = sub i32 %25, %9
%27 = load i8*, i8** %10
%28 = getelementptr inbounds i8, i8* %27, i64 5
%29 = tail call i32 @uint2(i8* %28)
%30 = mul i32 %29, -8
%31 = add i32 %26, %30
%32 = tail call i32 @sprintf(i8* dereferenceable(1) %4, i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %15, i32 %24, i32 %9, i32 %31)
%33 = tail call i32 @strlen(i8* %4)
br label %34
34: ; preds = %8, %6
ret i32 0
}