#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 *, char *, ...);
void parse(char *cc, int j, char temp[250]) {
  sprintf(temp, "%s", "");
  while (cc[j] != '|') {
    sprintf(temp, "%s%c", temp, cc[j]);
    j++;
  }
}


x86 assembly (clang, -O0):
<parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xed2(%rip),%rsi
lea    0xed2(%rip),%rdx
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7c,%eax
je     1181 <parse+0x71>
mov    -0x18(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
lea    0xe97(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113c <parse+0x2c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse>:
push   %r15
push   %r14
push   %rbx
movb   $0x0,(%rdx)
movslq %esi,%rcx
mov    (%rdi,%rcx,1),%al
cmp    $0x7c,%al
je     115e <parse+0x4e>
mov    %rdx,%r15
lea    (%rcx,%rdi,1),%rbx
add    $0x1,%rbx
lea    0xecc(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1030 <sprintf@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
cmp    $0x7c,%al
jne    1140 <parse+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [5 x i8] c"%s%c\00"
define void @parse(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %17, %3
%10 = load i8*, i8** %4
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 124
br i1 %16, label %17, label %29
17: ; preds = %9
%18 = load i8*, i8** %6
%19 = load i8*, i8** %6
%20 = load i8*, i8** %4
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %19, i32 %25)
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %9
29: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str.2 = [5 x i8] c"%s%c\00"
define void @parse(i8* nocapture %0, i32 %1, i8* %2) {
store i8 0, i8* %2
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 124
br i1 %7, label %17, label %8
8: ; preds = %3, %8
%9 = phi i64 [ %13, %8 ], [ %4, %3 ]
%10 = phi i8 [ %15, %8 ], [ %6, %3 ]
%11 = sext i8 %10 to i32
%12 = tail call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %2, i32 %11)
%13 = add i64 %9, 1
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 124
br i1 %16, label %17, label %8
17: ; preds = %8, %3
ret void
}