#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*/ printf(char *);
int strcmp_(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  char str1[15];
  char str2[15];
  int ret;
  strcpy(str1, "abcdef");
  strcpy(str2, "ABCDEF");
  ret = strcmp_(str1, str2);
  if (ret < 0) {
    printf("str1 is less than str2");
  } else if (ret > 0) {
    printf("str2 is less than str1");
  } else {
    printf("str1 is equal to str2");
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x13(%rbp),%rdi
lea    0xeb6(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x22(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x13(%rbp),%rdi
lea    -0x22(%rbp),%rsi
call   1040 <strcmp_@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jge    118a <main+0x5a>
lea    0xe8e(%rip),%rdi
call   1050 <printf@plt>
jmp    11b6 <main+0x86>
cmpl   $0x0,-0x28(%rbp)
jle    11a5 <main+0x75>
lea    0xe8a(%rip),%rdi
call   1050 <printf@plt>
jmp    11b1 <main+0x81>
lea    0xe90(%rip),%rdi
call   1050 <printf@plt>
jmp    11b6 <main+0x86>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xec2(%rip),%rsi
lea    0x19(%rsp),%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
lea    0xeb5(%rip),%rsi
lea    0xa(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcmp_@plt>
test   %eax,%eax
lea    0xec9(%rip),%rax
lea    0xeab(%rip),%rcx
cmove  %rax,%rcx
lea    0xe89(%rip),%rdi
cmovns %rcx,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"abcdef\00"
@.str.1 = [7 x i8] c"ABCDEF\00"
@.str.2 = [23 x i8] c"str1 is less than str2\00"
@.str.3 = [23 x i8] c"str2 is less than str1\00"
@.str.4 = [22 x i8] c"str1 is equal to str2\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i8]
%3 = alloca [15 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%6 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%8 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%11 = call i32 @strcmp_(i8* %9, i8* %10)
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
br label %24
16: ; preds = %0
%17 = load i32, i32* %4
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %23
21: ; preds = %16
%22 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %23
23: ; preds = %21, %19
br label %24
24: ; preds = %23, %14
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"abcdef\00"
@.str.1 = [7 x i8] c"ABCDEF\00"
@.str.2 = [23 x i8] c"str1 is less than str2\00"
@.str.3 = [23 x i8] c"str2 is less than str1\00"
@.str.4 = [22 x i8] c"str1 is equal to str2\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = alloca [15 x i8]
%3 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%5 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @strcmp_(i8* %3, i8* %4)
%8 = icmp slt i32 %7, 0
%9 = icmp eq i32 %7, 0
%10 = select i1 %9, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0)
%11 = select i1 %8, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %10
%12 = call i32 @printf(i8* dereferenceable(1) %11)
ret i32 0
}