#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 *);
scalar_t__ strcmp(char *, char *);
int test_strcmp(void) {
  printf("\tstrcmp");
  if (strcmp("abcdefg", "abcdefg") != 0)
    return 1;
  if (strcmp("abcdefg", "abcdef") <= 0)
    return 1;
  if (strcmp("abcdef", "abcdefg") >= 0)
    return 1;
  if (strcmp("abcdefg", "abcdeff") <= 0)
    return 1;
  if (strcmp("abcdeff", "abcdefg") >= 0)
    return 1;
  printf("\tpassed.\n");
  return 0;
}


x86 assembly (clang, -O0):
<test_strcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xecd(%rip),%rsi
mov    %rsi,%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1159 <test_strcmp+0x39>
movl   $0x1,-0x4(%rbp)
jmp    1210 <test_strcmp+0xf0>
lea    0xea8(%rip),%rdi
lea    0xea9(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jg     1182 <test_strcmp+0x62>
movl   $0x1,-0x4(%rbp)
jmp    1210 <test_strcmp+0xf0>
lea    0xe87(%rip),%rdi
lea    0xe78(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jl     11ab <test_strcmp+0x8b>
movl   $0x1,-0x4(%rbp)
jmp    1210 <test_strcmp+0xf0>
lea    0xe56(%rip),%rdi
lea    0xe5e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jg     11d4 <test_strcmp+0xb4>
movl   $0x1,-0x4(%rbp)
jmp    1210 <test_strcmp+0xf0>
lea    0xe3c(%rip),%rdi
lea    0xe26(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jl     11fd <test_strcmp+0xdd>
movl   $0x1,-0x4(%rbp)
jmp    1210 <test_strcmp+0xf0>
lea    0xe1b(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_strcmp>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
mov    %rdi,%rsi
call   1050 <strcmp@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    11c4 <test_strcmp+0x94>
lea    0xeab(%rip),%rdi
lea    0xeac(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jle    11c4 <test_strcmp+0x94>
lea    0xe9b(%rip),%rdi
lea    0xe8c(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jns    11c4 <test_strcmp+0x94>
lea    0xe7b(%rip),%rdi
lea    0xe83(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jle    11c4 <test_strcmp+0x94>
lea    0xe72(%rip),%rdi
lea    0xe5c(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jns    11c4 <test_strcmp+0x94>
lea    0xe62(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"\09strcmp\00"
@.str.1 = [8 x i8] c"abcdefg\00"
@.str.2 = [7 x i8] c"abcdef\00"
@.str.3 = [8 x i8] c"abcdeff\00"
@.str.4 = [10 x i8] c"\09passed.\0A\00"
define i32 @test_strcmp() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 1, i32* %1
br label %24
6: ; preds = %0
%7 = call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp sle i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %1
br label %24
10: ; preds = %6
%11 = call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp sge i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 1, i32* %1
br label %24
14: ; preds = %10
%15 = call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp sle i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 1, i32* %1
br label %24
18: ; preds = %14
%19 = call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp sge i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 1, i32* %1
br label %24
22: ; preds = %18
%23 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %1
br label %24
24: ; preds = %22, %21, %17, %13, %9, %5
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [8 x i8] c"\09strcmp\00"
@.str.1 = [8 x i8] c"abcdefg\00"
@.str.2 = [7 x i8] c"abcdef\00"
@.str.3 = [8 x i8] c"abcdeff\00"
@str = [9 x i8] c"\09passed.\00"
define i32 @test_strcmp() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %18
4: ; preds = %0
%5 = tail call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%6 = icmp slt i64 %5, 1
br i1 %6, label %18, label %7
7: ; preds = %4
%8 = tail call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp sgt i64 %8, -1
br i1 %9, label %18, label %10
10: ; preds = %7
%11 = tail call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp slt i64 %11, 1
br i1 %12, label %18, label %13
13: ; preds = %10
%14 = tail call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp sgt i64 %14, -1
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br label %18
18: ; preds = %13, %10, %7, %4, %0, %16
%19 = phi i32 [ 0, %16 ], [ 1, %0 ], [ 1, %4 ], [ 1, %7 ], [ 1, %10 ], [ 1, %13 ]
ret i32 %19
}