#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int strcmp1(char *, char *);
int strcmp2(char *, char *);
int main() {
  char str1[] = "This is a string, array";
  char *str2 = "This is a string, pointer";
  int result;
  result = strcmp1(str1, str2);
  if (result < 0)
    printf("%d (str1 < str2)\n", result);
  else if (result > 0)
    printf("%d (str1 > str2)\n", result);
  else
    printf("%d (str1 == str2)\n", result);
  result = strcmp2(str1, str2);
  printf("result=%d\n", result);
  printf("\nPress any key to end...");
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xea1(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcmp1@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    11ab <main+0x6b>
mov    -0x2c(%rbp),%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11e1 <main+0xa1>
cmpl   $0x0,-0x2c(%rbp)
jle    11cb <main+0x8b>
mov    -0x2c(%rbp),%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11dc <main+0x9c>
mov    -0x2c(%rbp),%esi
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11e1 <main+0xa1>
lea    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <strcmp2@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xeb5(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x7961727261202c,%rax
mov    %rax,0x10(%rsp)
lea    0xeb3(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcmp1@plt>
test   %eax,%eax
js     117e <main+0x3e>
je     1189 <main+0x49>
lea    0xeca(%rip),%rdi
mov    %eax,%esi
jmp    1192 <main+0x52>
lea    0xead(%rip),%rdi
mov    %eax,%esi
jmp    1192 <main+0x52>
lea    0xec6(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe78(%rip),%rsi
mov    %rsp,%rdi
call   1060 <strcmp2@plt>
lea    0xeba(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.str1 = [24 x i8] c"This is a string, array\00"
@.str = [26 x i8] c"This is a string, pointer\00"
@.str.1 = [18 x i8] c"%d (str1 < str2)\0A\00"
@.str.2 = [18 x i8] c"%d (str1 > str2)\0A\00"
@.str.3 = [19 x i8] c"%d (str1 == str2)\0A\00"
@.str.4 = [11 x i8] c"result=%d\0A\00"
@.str.5 = [25 x i8] c"\0APress any key to end...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [24 x i8]
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [24 x i8]* %2 to i8*
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8** %3
%6 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = call i32 @strcmp1(i8* %6, i8* %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = load i32, i32* %4
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %24
14: ; preds = %0
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* %4
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %18)
br label %23
20: ; preds = %14
%21 = load i32, i32* %4
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %20, %17
br label %24
24: ; preds = %23, %11
%25 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%26 = load i8*, i8** %3
%27 = call i32 @strcmp2(i8* %25, i8* %26)
store i32 %27, i32* %4
%28 = load i32, i32* %4
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%31 = call i32 (...) @getchar()
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
@__const.main.str1 = [24 x i8] c"This is a string, array\00"
@.str = [26 x i8] c"This is a string, pointer\00"
@.str.1 = [18 x i8] c"%d (str1 < str2)\0A\00"
@.str.2 = [18 x i8] c"%d (str1 > str2)\0A\00"
@.str.3 = [19 x i8] c"%d (str1 == str2)\0A\00"
@.str.4 = [11 x i8] c"result=%d\0A\00"
@.str.5 = [25 x i8] c"\0APress any key to end...\00"
define i32 @main() {
%1 = alloca [24 x i8]
%2 = getelementptr inbounds [24 x i8], [24 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcmp1(i8* %2, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %3)
br label %13
7: ; preds = %0
%8 = icmp eq i32 %3, 0
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %3)
br label %13
11: ; preds = %7
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 0)
br label %13
13: ; preds = %9, %11, %5
%14 = call i32 @strcmp2(i8* %2, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 (...) @getchar()
ret i32 0
}