#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*/ exit(int);
scalar_t__ memcmp(char *, char *, int);
int main() {
  if (memcmp("abc", "abc", 3) != 0) {
    exit(1);
  }
  if (memcmp("abcd", "abce", 4) >= 0) {
    exit(2);
  }
  if (memcmp("abce", "abcd", 4) <= 0) {
    exit(3);
  }
  if (memcmp("", "", 1) != 0) {
    exit(4);
  }
  if (memcmp("abc", "def", 3) >= 0) {
    exit(5);
  }
  if (memcmp("abc", "abcd", 4) >= 0) {
    exit(6);
  }
  if (memcmp("abcd", "abc", 4) <= 0) {
    exit(7);
  }
  if (memcmp("abc", "ABC", 3) <= 0) {
    exit(8);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rsi
mov    $0x3,%edx
mov    %rsi,%rdi
call   1030 <memcmp@plt>
cmp    $0x0,%rax
je     114c <main+0x2c>
mov    $0x1,%edi
call   1040 <exit@plt>
lea    0xeb1(%rip),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
jl     1178 <main+0x58>
mov    $0x2,%edi
call   1040 <exit@plt>
lea    0xe8a(%rip),%rdi
lea    0xe7e(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
jg     11a4 <main+0x84>
mov    $0x3,%edi
call   1040 <exit@plt>
lea    0xe6a(%rip),%rsi
mov    $0x1,%edx
mov    %rsi,%rdi
call   1030 <memcmp@plt>
cmp    $0x0,%rax
je     11cc <main+0xac>
mov    $0x4,%edi
call   1040 <exit@plt>
lea    0xe2d(%rip),%rdi
lea    0xe34(%rip),%rsi
mov    $0x3,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
jl     11f8 <main+0xd8>
mov    $0x5,%edi
call   1040 <exit@plt>
lea    0xe01(%rip),%rdi
lea    0xdfe(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
jl     1224 <main+0x104>
mov    $0x6,%edi
call   1040 <exit@plt>
lea    0xdd9(%rip),%rdi
lea    0xdce(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
jg     1250 <main+0x130>
mov    $0x7,%edi
call   1040 <exit@plt>
lea    0xda9(%rip),%rdi
lea    0xdb4(%rip),%rsi
mov    $0x3,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
jg     127c <main+0x15c>
mov    $0x8,%edi
call   1040 <exit@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    %rdi,%rsi
mov    $0x3,%edx
call   1030 <memcmp@plt>
test   %rax,%rax
jne    1219 <main+0xf9>
lea    0xebf(%rip),%rdi
lea    0xebd(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
test   %rax,%rax
jns    1223 <main+0x103>
lea    0xea3(%rip),%rdi
lea    0xe97(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
test   %rax,%rax
jle    122d <main+0x10d>
lea    0xe8e(%rip),%rdi
mov    %rdi,%rsi
mov    $0x1,%edx
call   1030 <memcmp@plt>
test   %rax,%rax
jne    1237 <main+0x117>
lea    0xe5c(%rip),%rdi
lea    0xe63(%rip),%rsi
mov    $0x3,%edx
call   1030 <memcmp@plt>
test   %rax,%rax
jns    1241 <main+0x121>
lea    0xe3b(%rip),%rdi
lea    0xe38(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
test   %rax,%rax
jns    124b <main+0x12b>
lea    0xe22(%rip),%rdi
lea    0xe17(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
test   %rax,%rax
jle    1255 <main+0x135>
lea    0xe01(%rip),%rdi
lea    0xe0c(%rip),%rsi
mov    $0x3,%edx
call   1030 <memcmp@plt>
test   %rax,%rax
jle    125f <main+0x13f>
xor    %eax,%eax
pop    %rcx
ret
mov    $0x1,%edi
call   1040 <exit@plt>
mov    $0x2,%edi
call   1040 <exit@plt>
mov    $0x3,%edi
call   1040 <exit@plt>
mov    $0x4,%edi
call   1040 <exit@plt>
mov    $0x5,%edi
call   1040 <exit@plt>
mov    $0x6,%edi
call   1040 <exit@plt>
mov    $0x7,%edi
call   1040 <exit@plt>
mov    $0x8,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
@.str.1 = [5 x i8] c"abcd\00"
@.str.2 = [5 x i8] c"abce\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [4 x i8] c"def\00"
@.str.5 = [4 x i8] c"ABC\00"
define i32 @main() {
%1 = call i64 @memcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%2 = icmp ne i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @exit(i32 1)
unreachable
5: ; preds = %0
%6 = call i64 @memcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%7 = icmp sge i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = call i32 @exit(i32 2)
unreachable
10: ; preds = %5
%11 = call i64 @memcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%12 = icmp sle i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @exit(i32 3)
unreachable
15: ; preds = %10
%16 = call i64 @memcmp(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i32 1)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 @exit(i32 4)
unreachable
20: ; preds = %15
%21 = call i64 @memcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 3)
%22 = icmp sge i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @exit(i32 5)
unreachable
25: ; preds = %20
%26 = call i64 @memcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%27 = icmp sge i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 @exit(i32 6)
unreachable
30: ; preds = %25
%31 = call i64 @memcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 4)
%32 = icmp sle i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 @exit(i32 7)
unreachable
35: ; preds = %30
%36 = call i64 @memcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 3)
%37 = icmp sle i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 @exit(i32 8)
unreachable
40: ; preds = %35
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"abc\00"
@.str.1 = [5 x i8] c"abcd\00"
@.str.2 = [5 x i8] c"abce\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [4 x i8] c"def\00"
@.str.5 = [4 x i8] c"ABC\00"
define i32 @main() {
%1 = tail call i64 @memcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%2 = icmp eq i64 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @exit(i32 1)
unreachable
5: ; preds = %0
%6 = tail call i64 @memcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%7 = icmp sgt i64 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @exit(i32 2)
unreachable
10: ; preds = %5
%11 = tail call i64 @memcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%12 = icmp slt i64 %11, 1
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 @exit(i32 3)
unreachable
15: ; preds = %10
%16 = tail call i64 @memcmp(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i32 1)
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 @exit(i32 4)
unreachable
20: ; preds = %15
%21 = tail call i64 @memcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 3)
%22 = icmp sgt i64 %21, -1
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = tail call i32 @exit(i32 5)
unreachable
25: ; preds = %20
%26 = tail call i64 @memcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%27 = icmp sgt i64 %26, -1
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = tail call i32 @exit(i32 6)
unreachable
30: ; preds = %25
%31 = tail call i64 @memcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 4)
%32 = icmp slt i64 %31, 1
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = tail call i32 @exit(i32 7)
unreachable
35: ; preds = %30
%36 = tail call i64 @memcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 3)
%37 = icmp slt i64 %36, 1
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = tail call i32 @exit(i32 8)
unreachable
40: ; preds = %35
ret i32 0
}