#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*/ changebarnet(char *);
int /*<<< orphan*/ changecolon(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
void cardfaces(char *card, char *fr, char *bk) {
  char *colon;
  strcpy(fr, card);
  changebarnet(fr);
  strcpy(bk, fr);
  colon = fr;
  while (1) {
    colon = strchr(colon, ':');
    if (!colon) {
      fprintf(stderr, "\n------------------------------------------\n");
      fprintf(stderr, "Wrong card without '::' separator.\n%s\n", card);
      changecolon(fr);
      changecolon(bk);
      return;
    }
    colon++;
    if (*colon == ':')
      break;
  }
  *(colon - 1) = '\0';
  strcpy(bk, colon + 1);
  changecolon(fr);
  changecolon(bk);
  return;
}


x86 assembly (clang, -O0):
<cardfaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   1060 <changebarnet@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11f5 <cardfaces+0xa5>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
lea    0xe44(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe56(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <changecolon@plt>
mov    -0x18(%rbp),%rdi
call   1070 <changecolon@plt>
jmp    1246 <cardfaces+0xf6>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    1216 <cardfaces+0xc6>
jmp    121b <cardfaces+0xcb>
jmp    118f <cardfaces+0x3f>
mov    -0x20(%rbp),%rax
movb   $0x0,-0x1(%rax)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
add    $0x1,%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   1070 <changecolon@plt>
mov    -0x18(%rbp),%rdi
call   1070 <changecolon@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cardfaces>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    %rsi,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1060 <changebarnet@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x3a,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11bd <cardfaces+0x6d>
lea    0x1(%rax),%rdi
cmpb   $0x3a,0x1(%rax)
jne    1190 <cardfaces+0x40>
movb   $0x0,(%rax)
add    $0x2,%rax
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
jmp    11eb <cardfaces+0x9b>
mov    0x2e1c(%rip),%r12
mov    (%r12),%edi
lea    0xe31(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    (%r12),%edi
lea    0xe4c(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %rbx,%rdi
call   1070 <changecolon@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1070 <changecolon@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [45 x i8] c"\0A------------------------------------------\0A\00"
@.str.1 = [39 x i8] c"Wrong card without '::' separator.\0A%s\0A\00"
define void @cardfaces(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %5
%9 = load i8*, i8** %4
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = load i8*, i8** %5
%12 = call i32 @changebarnet(i8* %11)
%13 = load i8*, i8** %6
%14 = load i8*, i8** %5
%15 = call i32 @strcpy(i8* %13, i8* %14)
%16 = load i8*, i8** %5
store i8* %16, i8** %7
br label %17
17: ; preds = %3, %40
%18 = load i8*, i8** %7
%19 = call i8* @strchr(i8* %18, i8 signext 58)
store i8* %19, i8** %7
%20 = load i8*, i8** %7
%21 = icmp ne i8* %20, null
br i1 %21, label %32, label %22
22: ; preds = %17
%23 = load i32, i32* @stderr
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%25 = load i32, i32* @stderr
%26 = load i8*, i8** %4
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = load i8*, i8** %5
%29 = call i32 @changecolon(i8* %28)
%30 = load i8*, i8** %6
%31 = call i32 @changecolon(i8* %30)
br label %52
32: ; preds = %17
%33 = load i8*, i8** %7
%34 = getelementptr inbounds i8, i8* %33, i32 1
store i8* %34, i8** %7
%35 = load i8*, i8** %7
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 58
br i1 %38, label %39, label %40
39: ; preds = %32
br label %41
40: ; preds = %32
br label %17
41: ; preds = %39
%42 = load i8*, i8** %7
%43 = getelementptr inbounds i8, i8* %42, i64 -1
store i8 0, i8* %43
%44 = load i8*, i8** %6
%45 = load i8*, i8** %7
%46 = getelementptr inbounds i8, i8* %45, i64 1
%47 = call i32 @strcpy(i8* %44, i8* %46)
%48 = load i8*, i8** %5
%49 = call i32 @changecolon(i8* %48)
%50 = load i8*, i8** %6
%51 = call i32 @changecolon(i8* %50)
br label %52
52: ; preds = %41, %22
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [45 x i8] c"\0A------------------------------------------\0A\00"
@.str.1 = [39 x i8] c"Wrong card without '::' separator.\0A%s\0A\00"
define void @cardfaces(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @strcpy(i8* %1, i8* %0)
%5 = tail call i32 @changebarnet(i8* %1)
%6 = tail call i32 @strcpy(i8* %2, i8* %1)
br label %7
7: ; preds = %16, %3
%8 = phi i8* [ %1, %3 ], [ %17, %16 ]
%9 = tail call i8* @strchr(i8* dereferenceable(1) %8, i8 signext 58)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %23
16: ; preds = %7
%17 = getelementptr inbounds i8, i8* %9, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 58
br i1 %19, label %20, label %7
20: ; preds = %16
store i8 0, i8* %9
%21 = getelementptr inbounds i8, i8* %9, i64 2
%22 = tail call i32 @strcpy(i8* %2, i8* %21)
br label %23
23: ; preds = %20, %11
%24 = tail call i32 @changecolon(i8* %1)
%25 = tail call i32 @changecolon(i8* %2)
ret void
}