#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 *, char *, char *);
scalar_t__ strcmp(char *, char *);
int main(void) {
  char *a, *b;
  a = "abcde";
  b = "abcd";
  if (strcmp(a, b) < 0) {
    printf("%s is less than %s\n", a, b);
  } else if (strcmp(a, b) == 0) {
    printf("%s is equal to %s\n", a, b);
  } else {
    printf("%s is greater than %s\n", a, b);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xec5(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jge    1175 <main+0x55>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
jmp    11be <main+0x9e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11a5 <main+0x85>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
jmp    11b9 <main+0x99>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
jmp    11be <main+0x9e>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed7(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jns    1142 <main+0x22>
lea    0xecb(%rip),%rdi
jmp    116a <main+0x4a>
lea    0xeb7(%rip),%rdi
lea    0xeb6(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
lea    0xec0(%rip),%rax
lea    0xecc(%rip),%rdi
cmove  %rax,%rdi
lea    0xe8f(%rip),%rsi
lea    0xe8e(%rip),%rdx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"abcde\00"
@.str.1 = [5 x i8] c"abcd\00"
@.str.2 = [20 x i8] c"%s is less than %s\0A\00"
@.str.3 = [19 x i8] c"%s is equal to %s\0A\00"
@.str.4 = [23 x i8] c"%s is greater than %s\0A\00"
define i32 @main() {
%1 = tail call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp slt i64 %1, 0
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = tail call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0)
br label %7
7: ; preds = %3, %0
%8 = phi i8* [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), %0 ], [ %6, %3 ]
%9 = tail call i32 @printf(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}