#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*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strtok(int /*<<< orphan*/ *, char *);
void store_string(char *tgt, char *src, char *special) {
  char *p;
  if (strcmp(src, special) == 0) {
    *tgt = '\0';
  } else if (*src != '{') {
    strcpy(tgt, src);
  } else {
    strcpy(tgt, src);
    strcat(tgt, " ");
    p = strtok(NULL, "}");
    strcat(tgt, p);
    strcat(tgt, "}");
  }
}


x86 assembly (clang, -O0):
<store_string>:
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    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1177 <store_string+0x37>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
jmp    11ec <store_string+0xac>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7b,%eax
je     1199 <store_string+0x59>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    11e7 <store_string+0xa7>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1060 <strcat@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe41(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xe20(%rip),%rsi
call   1060 <strcat@plt>
jmp    11ec <store_string+0xac>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<store_string>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11a8 <store_string+0x68>
mov    (%rbx),%bpl
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
cmp    $0x7b,%bpl
jne    11ac <store_string+0x6c>
lea    0xe8b(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcat@plt>
lea    0xe7e(%rip),%rbx
xor    %edi,%edi
mov    %rbx,%rsi
call   1050 <strtok@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1060 <strcat@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <strcat@plt>
movb   $0x0,(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"}\00"
define void @store_string(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** %6
%10 = call i64 @strcmp(i8* %8, i8* %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = load i8*, i8** %4
store i8 0, i8* %13
br label %36
14: ; preds = %3
%15 = load i8*, i8** %5
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 123
br i1 %18, label %19, label %23
19: ; preds = %14
%20 = load i8*, i8** %4
%21 = load i8*, i8** %5
%22 = call i32 @strcpy(i8* %20, i8* %21)
br label %35
23: ; preds = %14
%24 = load i8*, i8** %4
%25 = load i8*, i8** %5
%26 = call i32 @strcpy(i8* %24, i8* %25)
%27 = load i8*, i8** %4
%28 = call i32 @strcat(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%29 = call i8* @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %29, i8** %7
%30 = load i8*, i8** %4
%31 = load i8*, i8** %7
%32 = call i32 @strcat(i8* %30, i8* %31)
%33 = load i8*, i8** %4
%34 = call i32 @strcat(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %35
35: ; preds = %23, %19
br label %36
36: ; preds = %35, %12
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"}\00"
define void @store_string(i8* %0, i8* %1, i8* %2) {
%4 = tail call i64 @strcmp(i8* %1, i8* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %3
store i8 0, i8* %0
br label %16
7: ; preds = %3
%8 = load i8, i8* %1
%9 = icmp eq i8 %8, 123
%10 = tail call i32 @strcpy(i8* %0, i8* %1)
br i1 %9, label %11, label %16
11: ; preds = %7
%12 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = tail call i8* @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = tail call i32 @strcat(i8* %0, i8* %13)
%15 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %7, %11, %6
ret void
}