#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 mystrcmp(char *, char *);
int /*<<< orphan*/ printf(char *, char *, char *, char *);
int main() {
  char sa[] = "hello, world";
  char sb[] = "hello, universal";
  int t = mystrcmp(sa, sb);
  printf("%s %s %s\n", sa, t < 0 ? "<" : t > 0 ? ">" : "=", sb);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x11(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xec3(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xecd(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec8(%rip),%al
mov    %al,-0x20(%rbp)
lea    -0x11(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <mystrcmp@plt>
mov    %eax,-0x34(%rbp)
lea    -0x11(%rbp),%rax
mov    %rax,-0x40(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    119d <main+0x7d>
lea    0xe83(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    11b9 <main+0x99>
mov    -0x34(%rbp),%edx
lea    0xe74(%rip),%rax
lea    0xe6b(%rip),%rcx
cmp    $0x0,%edx
cmovg  %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%rdx
lea    -0x30(%rbp),%rcx
lea    0xe41(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movabs $0x646c726f77202c,%rax
mov    %rax,0x5(%rsp)
movabs $0x77202c6f6c6c6568,%rax
2c 20 77
mov    %rax,(%rsp)
movaps 0xed5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movb   $0x0,0x20(%rsp)
mov    %rsp,%rbx
lea    0x10(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <mystrcmp@plt>
test   %eax,%eax
lea    0xeaa(%rip),%rax
lea    0xea1(%rip),%rcx
cmove  %rax,%rcx
lea    0xe94(%rip),%rdx
cmovns %rcx,%rdx
lea    0xe7f(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rcx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.sa = [13 x i8] c"hello, world\00"
@__const.main.sb = [17 x i8] c"hello, universal\00"
@.str = [10 x i8] c"%s %s %s\0A\00"
@.str.1 = [2 x i8] c"<\00"
@.str.2 = [2 x i8] c">\00"
@.str.3 = [2 x i8] c"=\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x i8]
%3 = alloca [17 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [13 x i8]* %2 to i8*
%6 = bitcast [17 x i8]* %3 to i8*
%7 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%9 = call i32 @mystrcmp(i8* %7, i8* %8)
store i32 %9, i32* %4
%10 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %0
br label %19
14: ; preds = %0
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 0
%17 = zext i1 %16 to i64
%18 = select i1 %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
br label %19
19: ; preds = %14, %13
%20 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %13 ], [ %18, %14 ]
%21 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%22 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %20, i8* %21)
ret i32 0
}

LLVM IR (-O2):
@__const.main.sa = [13 x i8] c"hello, world\00"
@__const.main.sb = [17 x i8] c"hello, universal\00"
@.str = [10 x i8] c"%s %s %s\0A\00"
@.str.1 = [2 x i8] c"<\00"
@.str.2 = [2 x i8] c">\00"
@.str.3 = [2 x i8] c"=\00"
define i32 @main() {
%1 = alloca [13 x i8]
%2 = alloca [17 x i8]
%3 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%5 = call i32 @mystrcmp(i8* %3, i8* %4)
%6 = icmp slt i32 %5, 0
%7 = icmp eq i32 %5, 0
%8 = select i1 %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%9 = select i1 %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %9, i8* %4)
ret i32 0
}