#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 */
scalar_t__ disposeUrl(char *);
scalar_t__ getTDK(char *);
scalar_t__ price(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
scalar_t__ sizeColor(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
scalar_t__ writeRest(char *);
int single(char *id) {
  char id_bak[32];
  sprintf(id_bak, "%s", id);
  printf("single() begin\n");
  if (0 != getTDK(id)) {
    puts("getTDK error!");
    return -1;
  }
  sprintf(id, "%s", id_bak);
  if (0 != disposeUrl(id)) {
    printf("\ndisposeUrl error!\n");
    return -1;
  }
  sprintf(id, "%s", id_bak);
  if (0 != sizeColor(id)) {
    printf("\nget size|color error!\n");
    return -1;
  }
  sprintf(id, "%s", id_bak);
  if (0 != price(id)) {
    printf("\nmain: price error!\n");
    return -1;
  }
  sprintf(id, "%s", id_bak);
  if (0 != writeRest(id)) {
    printf("\nwriteRest error!\n");
    return -1;
  }
  printf("\nsingle() end\n");
  puts("one single finished\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<single>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe65(%rip),%rsi
call   1080 <sprintf@plt>
lea    0xe5c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1090 <getTDK@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     11db <single+0x5b>
lea    0xe49(%rip),%rdi
call   1030 <puts@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1306 <single+0x186>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    0xe16(%rip),%rsi
call   1080 <sprintf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <disposeUrl@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     121e <single+0x9e>
lea    0xe14(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1306 <single+0x186>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    0xdd3(%rip),%rsi
call   1080 <sprintf@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <sizeColor@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1261 <single+0xe1>
lea    0xde5(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1306 <single+0x186>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    0xd90(%rip),%rsi
call   1080 <sprintf@plt>
mov    -0x10(%rbp),%rdi
call   1060 <price@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     12a4 <single+0x124>
lea    0xdba(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1306 <single+0x186>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    0xd4d(%rip),%rsi
call   1080 <sprintf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <writeRest@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     12e7 <single+0x167>
lea    0xd8c(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1306 <single+0x186>
lea    0xd87(%rip),%rdi
call   1040 <printf@plt>
lea    0xd8a(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<single>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xe9a(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1080 <getTDK@plt>
test   %rax,%rax
je     11a8 <single+0x38>
lea    0xe5d(%rip),%rdi
jmp    122a <single+0xba>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <disposeUrl@plt>
test   %rax,%rax
je     11c9 <single+0x59>
lea    0xeb7(%rip),%rdi
jmp    122a <single+0xba>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1090 <sizeColor@plt>
test   %rax,%rax
je     11ea <single+0x7a>
lea    0xe7f(%rip),%rdi
jmp    122a <single+0xba>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1060 <price@plt>
test   %rax,%rax
je     120b <single+0x9b>
lea    0xe4a(%rip),%rdi
jmp    122a <single+0xba>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1070 <writeRest@plt>
test   %rax,%rax
je     123a <single+0xca>
lea    0xe17(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbx
ret
lea    0xdf2(%rip),%rdi
call   1040 <puts@plt>
lea    0xdc1(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
jmp    1234 <single+0xc4>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [16 x i8] c"single() begin\0A\00"
@.str.2 = [14 x i8] c"getTDK error!\00"
@.str.3 = [20 x i8] c"\0AdisposeUrl error!\0A\00"
@.str.4 = [24 x i8] c"\0Aget size|color error!\0A\00"
@.str.5 = [21 x i8] c"\0Amain: price error!\0A\00"
@.str.6 = [19 x i8] c"\0AwriteRest error!\0A\00"
@.str.7 = [15 x i8] c"\0Asingle() end\0A\00"
@.str.8 = [22 x i8] c"one single finished\0A\0A\00"
define i32 @single(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [32 x i8]
store i8* %0, i8** %3
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%6 = load i8*, i8** %3
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%9 = load i8*, i8** %3
%10 = call i64 @getTDK(i8* %9)
%11 = icmp ne i64 0, %10
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %2
br label %53
14: ; preds = %1
%15 = load i8*, i8** %3
%16 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%17 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i8*, i8** %3
%19 = call i64 @disposeUrl(i8* %18)
%20 = icmp ne i64 0, %19
br i1 %20, label %21, label %23
21: ; preds = %14
%22 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %2
br label %53
23: ; preds = %14
%24 = load i8*, i8** %3
%25 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%26 = call i32 @sprintf(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = load i8*, i8** %3
%28 = call i64 @sizeColor(i8* %27)
%29 = icmp ne i64 0, %28
br i1 %29, label %30, label %32
30: ; preds = %23
%31 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %2
br label %53
32: ; preds = %23
%33 = load i8*, i8** %3
%34 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%35 = call i32 @sprintf(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %34)
%36 = load i8*, i8** %3
%37 = call i64 @price(i8* %36)
%38 = icmp ne i64 0, %37
br i1 %38, label %39, label %41
39: ; preds = %32
%40 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %2
br label %53
41: ; preds = %32
%42 = load i8*, i8** %3
%43 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%44 = call i32 @sprintf(i8* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %43)
%45 = load i8*, i8** %3
%46 = call i64 @writeRest(i8* %45)
%47 = icmp ne i64 0, %46
br i1 %47, label %48, label %50
48: ; preds = %41
%49 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %2
br label %53
50: ; preds = %41
%51 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%52 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %2
br label %53
53: ; preds = %50, %48, %39, %30, %21, %12
%54 = load i32, i32* %2
ret i32 %54
}

LLVM IR (-O2):
@.str.2 = [14 x i8] c"getTDK error!\00"
@.str.8 = [22 x i8] c"one single finished\0A\0A\00"
@str = [15 x i8] c"single() begin\00"
@str.9 = [14 x i8] c"\0Asingle() end\00"
@str.10 = [18 x i8] c"\0AwriteRest error!\00"
@str.11 = [20 x i8] c"\0Amain: price error!\00"
@str.12 = [23 x i8] c"\0Aget size|color error!\00"
@str.13 = [19 x i8] c"\0AdisposeUrl error!\00"
define i32 @single(i8* %0) {
%2 = alloca [32 x i8]
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%4 = call i8* @strcpy(i8* %3, i8* dereferenceable(1) %0)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%6 = call i64 @getTDK(i8* %0)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %37
10: ; preds = %1
%11 = call i8* @strcpy(i8* dereferenceable(1) %0, i8* %3)
%12 = call i64 @disposeUrl(i8* %0)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %10
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.13, i64 0, i64 0))
br label %37
16: ; preds = %10
%17 = call i8* @strcpy(i8* dereferenceable(1) %0, i8* %3)
%18 = call i64 @sizeColor(i8* %0)
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %16
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.12, i64 0, i64 0))
br label %37
22: ; preds = %16
%23 = call i8* @strcpy(i8* dereferenceable(1) %0, i8* %3)
%24 = call i64 @price(i8* %0)
%25 = icmp eq i64 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %22
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.11, i64 0, i64 0))
br label %37
28: ; preds = %22
%29 = call i8* @strcpy(i8* dereferenceable(1) %0, i8* %3)
%30 = call i64 @writeRest(i8* %0)
%31 = icmp eq i64 %30, 0
br i1 %31, label %34, label %32
32: ; preds = %28
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.10, i64 0, i64 0))
br label %37
34: ; preds = %28
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.9, i64 0, i64 0))
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
br label %37
37: ; preds = %34, %32, %26, %20, %14, %8
%38 = phi i32 [ -1, %8 ], [ -1, %14 ], [ -1, %20 ], [ -1, %26 ], [ -1, %32 ], [ 0, %34 ]
ret i32 %38
}