#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 analysis_or_forecast_generating_process_identifier(unsigned char **);
int background_generating_process_identifier(unsigned char **);
int observation_generating_process_identifier(unsigned char **);
int /*<<< orphan*/ sprintf(char *, char *, char const *, int);
int /*<<< orphan*/ strlen(char *);
int f_processid(int mode, unsigned char **sec, float *data, unsigned int ndata,
                char *inv_out, void **local) {
  int i;
  const char *space;
  if (mode >= 0) {
    space = "";
    i = observation_generating_process_identifier(sec);
    if (i >= 0) {
      sprintf(inv_out, "%sobservation generating process=%d", space, i);
      inv_out += strlen(inv_out);
      space = " ";
    }
    i = background_generating_process_identifier(sec);
    if (i >= 0) {
      sprintf(inv_out, "%sbackground generating process=%d", space, i);
      inv_out += strlen(inv_out);
      space = " ";
    }
    i = analysis_or_forecast_generating_process_identifier(sec);
    if (i >= 0) {
      sprintf(inv_out, "%sforecast generating process=%d", space, i);
      inv_out += strlen(inv_out);
      space = " ";
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<f_processid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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     127b <f_processid+0x12b>
lea    0xea6(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <observation_generating_process_identifier@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jl     11d4 <f_processid+0x84>
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%rdx
mov    -0x34(%rbp),%ecx
lea    0xe55(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
lea    0xe54(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <background_generating_process_identifier@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jl     1225 <f_processid+0xd5>
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%rdx
mov    -0x34(%rbp),%ecx
lea    0xe2a(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
lea    0xe03(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <analysis_or_forecast_generating_process_identifier@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jl     1276 <f_processid+0x126>
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%rdx
mov    -0x34(%rbp),%ecx
lea    0xdfc(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
lea    0xdb2(%rip),%rax
mov    %rax,-0x40(%rbp)
jmp    127b <f_processid+0x12b>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_processid>:
push   %r15
push   %r14
push   %rbx
test   %edi,%edi
js     1200 <f_processid+0xb0>
mov    %r8,%rbx
mov    %rsi,%r14
mov    %rsi,%rdi
call   1050 <observation_generating_process_identifier@plt>
test   %eax,%eax
js     119d <f_processid+0x4d>
lea    0xe8a(%rip),%rsi
lea    0xea8(%rip),%rdx
mov    %rbx,%rdi
mov    %eax,%ecx
call   1070 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
add    %rax,%rbx
lea    0xe89(%rip),%r15
jmp    11a4 <f_processid+0x54>
lea    0xe81(%rip),%r15
mov    %r14,%rdi
call   1060 <background_generating_process_identifier@plt>
test   %eax,%eax
js     11d8 <f_processid+0x88>
lea    0xe6f(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %eax,%ecx
call   1070 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
add    %rax,%rbx
lea    0xe4c(%rip),%r15
mov    %r14,%rdi
call   1040 <analysis_or_forecast_generating_process_identifier@plt>
test   %eax,%eax
js     1200 <f_processid+0xb0>
lea    0xe5e(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %eax,%ecx
call   1070 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [36 x i8] c"%sobservation generating process=%d\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [35 x i8] c"%sbackground generating process=%d\00"
@.str.4 = [33 x i8] c"%sforecast generating process=%d\00"
define i32 @f_processid(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
%14 = 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
%15 = load i32, i32* %7
%16 = icmp sge i32 %15, 0
br i1 %16, label %17, label %63
17: ; preds = %6
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %14
%18 = load i8**, i8*** %8
%19 = call i32 @observation_generating_process_identifier(i8** %18)
store i32 %19, i32* %13
%20 = load i32, i32* %13
%21 = icmp sge i32 %20, 0
br i1 %21, label %22, label %32
22: ; preds = %17
%23 = load i8*, i8** %11
%24 = load i8*, i8** %14
%25 = load i32, i32* %13
%26 = call i32 @sprintf(i8* %23, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %24, i32 %25)
%27 = load i8*, i8** %11
%28 = call i32 @strlen(i8* %27)
%29 = load i8*, i8** %11
%30 = sext i32 %28 to i64
%31 = getelementptr inbounds i8, i8* %29, i64 %30
store i8* %31, i8** %11
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %14
br label %32
32: ; preds = %22, %17
%33 = load i8**, i8*** %8
%34 = call i32 @background_generating_process_identifier(i8** %33)
store i32 %34, i32* %13
%35 = load i32, i32* %13
%36 = icmp sge i32 %35, 0
br i1 %36, label %37, label %47
37: ; preds = %32
%38 = load i8*, i8** %11
%39 = load i8*, i8** %14
%40 = load i32, i32* %13
%41 = call i32 @sprintf(i8* %38, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i8* %39, i32 %40)
%42 = load i8*, i8** %11
%43 = call i32 @strlen(i8* %42)
%44 = load i8*, i8** %11
%45 = sext i32 %43 to i64
%46 = getelementptr inbounds i8, i8* %44, i64 %45
store i8* %46, i8** %11
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %14
br label %47
47: ; preds = %37, %32
%48 = load i8**, i8*** %8
%49 = call i32 @analysis_or_forecast_generating_process_identifier(i8** %48)
store i32 %49, i32* %13
%50 = load i32, i32* %13
%51 = icmp sge i32 %50, 0
br i1 %51, label %52, label %62
52: ; preds = %47
%53 = load i8*, i8** %11
%54 = load i8*, i8** %14
%55 = load i32, i32* %13
%56 = call i32 @sprintf(i8* %53, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* %54, i32 %55)
%57 = load i8*, i8** %11
%58 = call i32 @strlen(i8* %57)
%59 = load i8*, i8** %11
%60 = sext i32 %58 to i64
%61 = getelementptr inbounds i8, i8* %59, i64 %60
store i8* %61, i8** %11
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %14
br label %62
62: ; preds = %52, %47
br label %63
63: ; preds = %62, %6
ret i32 0
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [36 x i8] c"%sobservation generating process=%d\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [35 x i8] c"%sbackground generating process=%d\00"
@.str.4 = [33 x i8] c"%sforecast generating process=%d\00"
define i32 @f_processid(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 @observation_generating_process_identifier(i8** %1)
%10 = icmp sgt i32 %9, -1
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = tail call i32 @sprintf(i8* dereferenceable(1) %4, i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %9)
%13 = tail call i32 @strlen(i8* %4)
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %4, i64 %14
br label %16
16: ; preds = %11, %8
%17 = phi i8* [ %15, %11 ], [ %4, %8 ]
%18 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), %11 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %8 ]
%19 = tail call i32 @background_generating_process_identifier(i8** %1)
%20 = icmp sgt i32 %19, -1
br i1 %20, label %21, label %26
21: ; preds = %16
%22 = tail call i32 @sprintf(i8* dereferenceable(1) %17, i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i8* %18, i32 %19)
%23 = tail call i32 @strlen(i8* %17)
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %17, i64 %24
br label %26
26: ; preds = %21, %16
%27 = phi i8* [ %25, %21 ], [ %17, %16 ]
%28 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), %21 ], [ %18, %16 ]
%29 = tail call i32 @analysis_or_forecast_generating_process_identifier(i8** %1)
%30 = icmp sgt i32 %29, -1
br i1 %30, label %31, label %34
31: ; preds = %26
%32 = tail call i32 @sprintf(i8* dereferenceable(1) %27, i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* %28, i32 %29)
%33 = tail call i32 @strlen(i8* %27)
br label %34
34: ; preds = %26, %31, %6
ret i32 0
}