#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*/ die(char *);
scalar_t__ strcmp(char *, char *);
int main() {
  char buf[100] = "fnord";
  char buf2[100] = "fnort";
  if (strcmp(buf, buf))
    die("strcmp say a != a");
  if (strcmp(buf, buf2) >= 0)
    die("strcmp said fnord > fnort");
  if (strcmp(buf2, buf) <= 0)
    die("strcmp said fnort < fnord");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1030 <memset@plt>
movb   $0x66,-0x70(%rbp)
movb   $0x6e,-0x6f(%rbp)
movb   $0x6f,-0x6e(%rbp)
movb   $0x72,-0x6d(%rbp)
movb   $0x64,-0x6c(%rbp)
lea    -0xe0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1030 <memset@plt>
movb   $0x66,-0xe0(%rbp)
movb   $0x6e,-0xdf(%rbp)
movb   $0x6f,-0xde(%rbp)
movb   $0x72,-0xdd(%rbp)
movb   $0x74,-0xdc(%rbp)
lea    -0x70(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11bf <main+0x8f>
lea    0xe46(%rip),%rdi
call   1050 <die@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jl     11e5 <main+0xb5>
lea    0xe32(%rip),%rdi
call   1050 <die@plt>
lea    -0xe0(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jg     120b <main+0xdb>
lea    0xe26(%rip),%rdi
call   1050 <die@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xd8,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x60(%rsp)
movl   $0x726f6e66,(%rsp)
movb   $0x64,0x4(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movl   $0x0,0xd0(%rsp)
movl   $0x726f6e66,0x70(%rsp)
72
movb   $0x74,0x74(%rsp)
mov    %rsp,%rdi
mov    %rdi,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11bc <main+0x9c>
lea    0xe49(%rip),%rdi
call   1040 <die@plt>
mov    %rsp,%rdi
lea    0x70(%rsp),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
js     11da <main+0xba>
lea    0xe3d(%rip),%rdi
call   1040 <die@plt>
lea    0x70(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jg     11f8 <main+0xd8>
lea    0xe39(%rip),%rdi
call   1040 <die@plt>
xor    %eax,%eax
add    $0xd8,%rsp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"strcmp say a != a\00"
@.str.1 = [26 x i8] c"strcmp said fnord > fnort\00"
@.str.2 = [26 x i8] c"strcmp said fnort < fnord\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
store i32 0, i32* %1
%4 = bitcast [100 x i8]* %2 to i8*
%5 = bitcast i8* %4 to [100 x i8]*
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i32 0, i32 0
store i8 102, i8* %6
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i32 0, i32 1
store i8 110, i8* %7
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i32 0, i32 2
store i8 111, i8* %8
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i32 0, i32 3
store i8 114, i8* %9
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i32 0, i32 4
store i8 100, i8* %10
%11 = bitcast [100 x i8]* %3 to i8*
%12 = bitcast i8* %11 to [100 x i8]*
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i32 0, i32 0
store i8 102, i8* %13
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i32 0, i32 1
store i8 110, i8* %14
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i32 0, i32 2
store i8 111, i8* %15
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i32 0, i32 3
store i8 114, i8* %16
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i32 0, i32 4
store i8 116, i8* %17
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%20 = call i64 @strcmp(i8* %18, i8* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %0
%23 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %22, %0
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%27 = call i64 @strcmp(i8* %25, i8* %26)
%28 = icmp sge i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = call i32 @die(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %31
31: ; preds = %29, %24
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%34 = call i64 @strcmp(i8* %32, i8* %33)
%35 = icmp sle i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = call i32 @die(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %38
38: ; preds = %36, %31
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"strcmp say a != a\00"
@.str.1 = [26 x i8] c"strcmp said fnord > fnort\00"
@.str.2 = [26 x i8] c"strcmp said fnort < fnord\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
store i8 102, i8* %3
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 1
store i8 110, i8* %4
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 2
store i8 111, i8* %5
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 3
store i8 114, i8* %6
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 4
store i8 100, i8* %7
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
store i8 102, i8* %8
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 1
store i8 110, i8* %9
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 2
store i8 111, i8* %10
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 3
store i8 114, i8* %11
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 4
store i8 116, i8* %12
%13 = call i64 @strcmp(i8* %3, i8* %3)
%14 = icmp eq i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %0
%16 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %0
%18 = call i64 @strcmp(i8* %3, i8* %8)
%19 = icmp sgt i64 %18, -1
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @die(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
%23 = call i64 @strcmp(i8* %8, i8* %3)
%24 = icmp slt i64 %23, 1
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 @die(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %25, %22
ret i32 0
}