int main() {
  char str[80];
  char str1[80];
  char *ptr;
  int len;
  printf("input string: ");
  gets(str);
  printf("原始字串: \"%s\"\n", str);
  len = strLen(str);
  printf("字串\"%s\"的長度為: %d\n", str, len);
  printf("複製字串: \"%s\"\n", strCpy(str1, str));
  printf("請輸入欲連接的字串: ");
  gets(str1);
  printf("欲連接字串: \"%s\"\n", str1);
  ptr = strCat(str, str1);
  printf("連接結果的字串: \"%s\"\n", ptr);
  printf("請輸入欲比較的字串: ");
  gets(str1);
  printf("欲比較的字串: \"%s\"\n", str1);
  printf("字串比較結果: %d\n", strCmp(str, str1));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x0,%al
call   1070 <gets@plt>
lea    -0x50(%rbp),%rsi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x0,%al
call   1060 <strLen@plt>
mov    %eax,-0xac(%rbp)
lea    -0x50(%rbp),%rsi
mov    -0xac(%rbp),%edx
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xa0(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x0,%al
call   1030 <strCpy@plt>
mov    %eax,%esi
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xa0(%rbp),%rdi
mov    $0x0,%al
call   1070 <gets@plt>
lea    -0xa0(%rbp),%rsi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x0,%al
call   1080 <strCat@plt>
cltq
mov    %rax,-0xa8(%rbp)
mov    -0xa8(%rbp),%rsi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xa0(%rbp),%rdi
mov    $0x0,%al
call   1070 <gets@plt>
lea    -0xa0(%rbp),%rsi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x0,%al
call   1050 <strCmp@plt>
mov    %eax,%esi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xa8,%rsp
lea    0xe8f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x50(%rsp),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <gets@plt>
lea    0xe81(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <strLen@plt>
lea    0xe7a(%rip),%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <strCpy@plt>
lea    0xe73(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe77(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <gets@plt>
lea    0xe7d(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <strCat@plt>
movslq %eax,%rsi
lea    0xe73(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe82(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <gets@plt>
lea    0xe88(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <strCmp@plt>
lea    0xe84(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"input string: \00"
@.str.1 = [20 x i8] c"\E5\8E\9F\E5\A7\8B\E5\AD\97\E4\B8\B2: \22%s\22\0A\00"
@.str.2 = [28 x i8] c"\E5\AD\97\E4\B8\B2\22%s\22\E7\9A\84\E9\95\B7\E5\BA\A6\E7\82\BA: %d\0A\00"
@.str.3 = [20 x i8] c"\E8\A4\87\E8\A3\BD\E5\AD\97\E4\B8\B2: \22%s\22\0A\00"
@.str.4 = [30 x i8] c"\E8\AB\8B\E8\BC\B8\E5\85\A5\E6\AC\B2\E9\80\A3\E6\8E\A5\E7\9A\84\E5\AD\97\E4\B8\B2: \00"
@.str.5 = [23 x i8] c"\E6\AC\B2\E9\80\A3\E6\8E\A5\E5\AD\97\E4\B8\B2: \22%s\22\0A\00"
@.str.6 = [29 x i8] c"\E9\80\A3\E6\8E\A5\E7\B5\90\E6\9E\9C\E7\9A\84\E5\AD\97\E4\B8\B2: \22%s\22\0A\00"
@.str.7 = [30 x i8] c"\E8\AB\8B\E8\BC\B8\E5\85\A5\E6\AC\B2\E6\AF\94\E8\BC\83\E7\9A\84\E5\AD\97\E4\B8\B2: \00"
@.str.8 = [26 x i8] c"\E6\AC\B2\E6\AF\94\E8\BC\83\E7\9A\84\E5\AD\97\E4\B8\B2: \22%s\22\0A\00"
@.str.9 = [24 x i8] c"\E5\AD\97\E4\B8\B2\E6\AF\94\E8\BC\83\E7\B5\90\E6\9E\9C: %d\0A\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = alloca [80 x i8]
%3 = alloca i8*
%4 = alloca i32
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @gets to i32 (i8*, ...)*)(i8* %6)
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @strLen to i32 (i8*, ...)*)(i8* %10)
store i32 %11, i32* %4
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%13 = load i32, i32* %4
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %12, i32 %13)
%15 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%16 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%17 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @strCpy to i32 (i8*, i8*, ...)*)(i8* %15, i8* %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
%20 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%21 = call i32 (i8*, ...) bitcast (i32 (...)* @gets to i32 (i8*, ...)*)(i8* %20)
%22 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%25 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%26 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @strCat to i32 (i8*, i8*, ...)*)(i8* %24, i8* %25)
%27 = sext i32 %26 to i64
%28 = inttoptr i64 %27 to i8*
store i8* %28, i8** %3
%29 = load i8*, i8** %3
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %29)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%32 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%33 = call i32 (i8*, ...) bitcast (i32 (...)* @gets to i32 (i8*, ...)*)(i8* %32)
%34 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %34)
%36 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%37 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%38 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @strCmp to i32 (i8*, i8*, ...)*)(i8* %36, i8* %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), i32 %38)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"input string: \00"
@.str.1 = [20 x i8] c"\E5\8E\9F\E5\A7\8B\E5\AD\97\E4\B8\B2: \22%s\22\0A\00"
@.str.2 = [28 x i8] c"\E5\AD\97\E4\B8\B2\22%s\22\E7\9A\84\E9\95\B7\E5\BA\A6\E7\82\BA: %d\0A\00"
@.str.3 = [20 x i8] c"\E8\A4\87\E8\A3\BD\E5\AD\97\E4\B8\B2: \22%s\22\0A\00"
@.str.4 = [30 x i8] c"\E8\AB\8B\E8\BC\B8\E5\85\A5\E6\AC\B2\E9\80\A3\E6\8E\A5\E7\9A\84\E5\AD\97\E4\B8\B2: \00"
@.str.5 = [23 x i8] c"\E6\AC\B2\E9\80\A3\E6\8E\A5\E5\AD\97\E4\B8\B2: \22%s\22\0A\00"
@.str.6 = [29 x i8] c"\E9\80\A3\E6\8E\A5\E7\B5\90\E6\9E\9C\E7\9A\84\E5\AD\97\E4\B8\B2: \22%s\22\0A\00"
@.str.7 = [30 x i8] c"\E8\AB\8B\E8\BC\B8\E5\85\A5\E6\AC\B2\E6\AF\94\E8\BC\83\E7\9A\84\E5\AD\97\E4\B8\B2: \00"
@.str.8 = [26 x i8] c"\E6\AC\B2\E6\AF\94\E8\BC\83\E7\9A\84\E5\AD\97\E4\B8\B2: \22%s\22\0A\00"
@.str.9 = [24 x i8] c"\E5\AD\97\E4\B8\B2\E6\AF\94\E8\BC\83\E7\B5\90\E6\9E\9C: %d\0A\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @gets to i32 (i8*, ...)*)(i8* %3)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @strLen to i32 (i8*, ...)*)(i8* %3)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %3, i32 %8)
%10 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @strCpy to i32 (i8*, i8*, ...)*)(i8* %4, i8* %3)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 (i8*, ...) bitcast (i32 (...)* @gets to i32 (i8*, ...)*)(i8* %4)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%15 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @strCat to i32 (i8*, i8*, ...)*)(i8* %3, i8* %4)
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i8*
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %17)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%20 = call i32 (i8*, ...) bitcast (i32 (...)* @gets to i32 (i8*, ...)*)(i8* %4)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %4)
%22 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @strCmp to i32 (i8*, i8*, ...)*)(i8* %3, i8* %4)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), i32 %22)
ret i32 0
}