#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);
int strcomp(char *, char *);
int main() {
  printf("%d\n", strcomp("hello", "hello how are you"));
  printf("%d\n", strcomp("hello", "hello"));
  printf("%d\n", strcomp("hi", "hello"));
  printf("%d\n", 'i' - 'e');
  printf("%d\n", "hi"[1] - "hello"[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xece(%rip),%rdi
lea    0xecd(%rip),%rsi
call   1030 <strcomp@plt>
lea    0xeb7(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
lea    0xeac(%rip),%rsi
mov    %rsi,%rdi
call   1030 <strcomp@plt>
lea    0xe99(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
lea    0xea6(%rip),%rdi
lea    0xe87(%rip),%rsi
call   1030 <strcomp@plt>
lea    0xe77(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
lea    0xe68(%rip),%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
movsbl 0xe74(%rip),%eax
movsbl 0xe55(%rip),%ecx
sub    %ecx,%eax
lea    0xe47(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed9(%rip),%r14
lea    0xed8(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcomp@plt>
movsbl %al,%esi
lea    0xebc(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r14,%rsi
call   1030 <strcomp@plt>
movsbl %al,%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
mov    %r14,%rsi
call   1030 <strcomp@plt>
movsbl %al,%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [6 x i8] c"hello\00"
@.str.2 = [18 x i8] c"hello how are you\00"
@.str.3 = [3 x i8] c"hi\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @strcomp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%3 = trunc i32 %2 to i8
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %3)
%5 = call i32 @strcomp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%6 = trunc i32 %5 to i8
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %6)
%8 = call i32 @strcomp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%9 = trunc i32 %8 to i8
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 4)
%12 = load i8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 1)
%13 = sext i8 %12 to i32
%14 = load i8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 1)
%15 = sext i8 %14 to i32
%16 = sub nsw i32 %13, %15
%17 = trunc i32 %16 to i8
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [6 x i8] c"hello\00"
@.str.2 = [18 x i8] c"hello how are you\00"
@.str.3 = [3 x i8] c"hi\00"
define i32 @main() {
%1 = tail call i32 @strcomp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%2 = trunc i32 %1 to i8
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %2)
%4 = tail call i32 @strcomp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%5 = trunc i32 %4 to i8
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %5)
%7 = tail call i32 @strcomp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%8 = trunc i32 %7 to i8
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %8)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 4)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 4)
ret i32 0
}