#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 */
typedef int /*<<< orphan*/ intmax_t;

/* Variables and functions */
scalar_t__ getpid();
int /*<<< orphan*/ issd_compute(char *, char *, int);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
int /*<<< orphan*/ snprintf(char *, int, char *, int /*<<< orphan*/, int);
void *producer(void *arg) {
  int thIdx = (int)arg;
  int i;
  char ifname[1024];
  char ofname[1024];
  for (i = 0; i < 10; i++) {
    snprintf(ifname, 1024, "ifile-%jd-%d", (intmax_t)getpid(), thIdx);
    snprintf(ofname, 1024, "ofile-%jd-%d", (intmax_t)getpid(), thIdx);
    int opType = i;
    issd_compute(ifname, ofname, opType);
  }
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<producer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x840,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jge    11fd <producer+0xbd>
lea    -0x420(%rbp),%rax
mov    %rax,-0x838(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x838(%rbp),%rdi
mov    %eax,%ecx
mov    -0x14(%rbp),%r8d
mov    $0x400,%esi
lea    0xe6b(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x820(%rbp),%rax
mov    %rax,-0x830(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x830(%rbp),%rdi
mov    %eax,%ecx
mov    -0x14(%rbp),%r8d
mov    $0x400,%esi
lea    0xe45(%rip),%rdx
call   1040 <snprintf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x824(%rbp)
lea    -0x420(%rbp),%rdi
lea    -0x820(%rbp),%rsi
mov    -0x824(%rbp),%edx
call   1060 <issd_compute@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115d <producer+0x1d>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x840,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<producer>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x808,%rsp
mov    %rdi,%rbx
lea    0xea5(%rip),%r14
lea    0x400(%rsp),%r15
lea    0xea3(%rip),%r12
mov    %rsp,%r13
xor    %ebp,%ebp
nop
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %r15,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
mov    %eax,%ecx
mov    %ebx,%r8d
call   1040 <snprintf@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %r13,%rdi
mov    $0x400,%esi
mov    %r12,%rdx
mov    %eax,%ecx
mov    %ebx,%r8d
call   1040 <snprintf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
mov    %ebp,%edx
call   1060 <issd_compute@plt>
add    $0x1,%ebp
cmp    $0xa,%ebp
jne    1170 <producer+0x30>
xor    %edi,%edi
call   1050 <pthread_exit@plt>
add    $0x808,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"ifile-%jd-%d\00"
@.str.1 = [13 x i8] c"ofile-%jd-%d\00"
define i8* @producer(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca [1024 x i8]
%7 = alloca [1024 x i8]
%8 = alloca i32
store i8* %0, i8** %3
%9 = load i8*, i8** %3
%10 = ptrtoint i8* %9 to i32
store i32 %10, i32* %4
store i32 0, i32* %5
br label %11
11: ; preds = %30, %1
%12 = load i32, i32* %5
%13 = icmp slt i32 %12, 10
br i1 %13, label %14, label %33
14: ; preds = %11
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%16 = call i64 (...) @getpid()
%17 = trunc i64 %16 to i32
%18 = load i32, i32* %4
%19 = call i32 @snprintf(i8* %15, i32 1024, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18)
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%21 = call i64 (...) @getpid()
%22 = trunc i64 %21 to i32
%23 = load i32, i32* %4
%24 = call i32 @snprintf(i8* %20, i32 1024, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %23)
%25 = load i32, i32* %5
store i32 %25, i32* %8
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%28 = load i32, i32* %8
%29 = call i32 @issd_compute(i8* %26, i8* %27, i32 %28)
br label %30
30: ; preds = %14
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %11
33: ; preds = %11
%34 = call i32 @pthread_exit(i32* null)
%35 = load i8*, i8** %2
ret i8* %35
}

LLVM IR (-O2):
@.str = [13 x i8] c"ifile-%jd-%d\00"
@.str.1 = [13 x i8] c"ofile-%jd-%d\00"
define noalias i8* @producer(i8* %0) {
%2 = alloca [1024 x i8]
%3 = alloca [1024 x i8]
%4 = ptrtoint i8* %0 to i64
%5 = trunc i64 %4 to i32
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
br label %8
8: ; preds = %1, %8
%9 = phi i32 [ 0, %1 ], [ %17, %8 ]
%10 = call i64 (...) @getpid()
%11 = trunc i64 %10 to i32
%12 = call i32 @snprintf(i8* %6, i32 1024, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %5)
%13 = call i64 (...) @getpid()
%14 = trunc i64 %13 to i32
%15 = call i32 @snprintf(i8* %7, i32 1024, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %5)
%16 = call i32 @issd_compute(i8* %6, i8* %7, i32 %9)
%17 = add nuw nsw i32 %9, 1
%18 = icmp eq i32 %17, 10
br i1 %18, label %19, label %8
19: ; preds = %8
%20 = call i32 @pthread_exit(i32* null)
ret i8* undef
}