#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*/ sprintf(char *, char *, int, int, int, int, int, int);
int uint2(unsigned char *);
unsigned char *year_of_model_version_date_location(unsigned char **);
int f_model_version_date(int mode, unsigned char **sec, float *data,
                         unsigned int ndata, char *inv_out, void **local) {
  unsigned char *p;
  if (mode >= 0) {
    p = year_of_model_version_date_location(sec);
    if (p != NULL) {
      sprintf(inv_out,
              "model_version_date=%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d:", uint2(p),
              (int)p[2], (int)p[3], (int)p[4], (int)p[5], (int)p[6]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<f_model_version_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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     11cb <f_model_version_date+0x9b>
mov    -0x10(%rbp),%rdi
call   1040 <year_of_model_version_date_location@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     11c6 <f_model_version_date+0x96>
mov    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rdi
call   1030 <uint2@plt>
mov    -0x40(%rbp),%rdi
mov    %eax,%edx
mov    -0x38(%rbp),%rax
movzbl 0x2(%rax),%ecx
mov    -0x38(%rbp),%rax
movzbl 0x3(%rax),%r8d
mov    -0x38(%rbp),%rax
movzbl 0x4(%rax),%r9d
mov    -0x38(%rbp),%rax
movzbl 0x5(%rax),%r10d
mov    -0x38(%rbp),%rax
movzbl 0x6(%rax),%eax
lea    0xe47(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1050 <sprintf@plt>
jmp    11cb <f_model_version_date+0x9b>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_model_version_date>:
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
js     1182 <f_model_version_date+0x52>
mov    %r8,%r14
mov    %rsi,%rdi
call   1040 <year_of_model_version_date_location@plt>
test   %rax,%rax
je     1182 <f_model_version_date+0x52>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <uint2@plt>
movzbl 0x2(%rbx),%ecx
movzbl 0x3(%rbx),%r8d
movzbl 0x4(%rbx),%r9d
movzbl 0x5(%rbx),%r10d
movzbl 0x6(%rbx),%ebx
lea    0xe8f(%rip),%rsi
mov    %r14,%rdi
mov    %eax,%edx
push   %rbx
push   %r10
call   1050 <sprintf@plt>
add    $0x10,%rsp
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [51 x i8] c"model_version_date=%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d:\00"
define i32 @f_model_version_date(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 i8*
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 %47
16: ; preds = %6
%17 = load i8**, i8*** %8
%18 = call i8* @year_of_model_version_date_location(i8** %17)
store i8* %18, i8** %13
%19 = load i8*, i8** %13
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %46
21: ; preds = %16
%22 = load i8*, i8** %11
%23 = load i8*, i8** %13
%24 = call i32 @uint2(i8* %23)
%25 = load i8*, i8** %13
%26 = getelementptr inbounds i8, i8* %25, i64 2
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = load i8*, i8** %13
%30 = getelementptr inbounds i8, i8* %29, i64 3
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = load i8*, i8** %13
%34 = getelementptr inbounds i8, i8* %33, i64 4
%35 = load i8, i8* %34
%36 = zext i8 %35 to i32
%37 = load i8*, i8** %13
%38 = getelementptr inbounds i8, i8* %37, i64 5
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = load i8*, i8** %13
%42 = getelementptr inbounds i8, i8* %41, i64 6
%43 = load i8, i8* %42
%44 = zext i8 %43 to i32
%45 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %24, i32 %28, i32 %32, i32 %36, i32 %40, i32 %44)
br label %46
46: ; preds = %21, %16
br label %47
47: ; preds = %46, %6
ret i32 0
}

LLVM IR (-O2):
@.str = [51 x i8] c"model_version_date=%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d:\00"
define i32 @f_model_version_date(i32 %0, i8** %1, float* nocapture readnone %2, i32 %3, i8* nocapture writeonly %4, i8** nocapture readnone %5) {
%7 = icmp sgt i32 %0, -1
br i1 %7, label %8, label %29
8: ; preds = %6
%9 = tail call i8* @year_of_model_version_date_location(i8** %1)
%10 = icmp eq i8* %9, null
br i1 %10, label %29, label %11
11: ; preds = %8
%12 = tail call i32 @uint2(i8* %9)
%13 = getelementptr inbounds i8, i8* %9, i64 2
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = getelementptr inbounds i8, i8* %9, i64 3
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = getelementptr inbounds i8, i8* %9, i64 4
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = getelementptr inbounds i8, i8* %9, i64 5
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = getelementptr inbounds i8, i8* %9, i64 6
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = tail call i32 @sprintf(i8* dereferenceable(1) %4, i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %15, i32 %18, i32 %21, i32 %24, i32 %27)
br label %29
29: ; preds = %8, %11, %6
ret i32 0
}