#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 */
typedef int /*<<< orphan*/ line;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int strcmp(char *, char *);
int strlen(char *);
int main(int argc, const char *argv[]) {
  char line[] = "hello";
  printf("strlen=%lu\n", strlen(line));
  printf("sizeof=%lu\n", sizeof(line));
  char s1[] = "abc";
  char s2[] = "abc";
  printf("%d\n", s1 == s2);
  if (strcmp(s1, s2) == 0) {
    printf("s1=s2\n");
  }
  char s3[] = "bbc";
  printf("%d\n", strcmp(s1, s3));
  char s4[] = "Abc";
  printf("%d\n", strcmp(s1, s4));
  printf("%d\n", 'a' - 'A');
  char s5[] = "abc ";
  printf("%d\n", strcmp(s1, s5));
  char *strchr(const char *s, int c);
  char *strrchr(const char *s, int c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeb4(%rip),%eax
mov    %eax,-0x16(%rbp)
mov    0xeae(%rip),%ax
mov    %ax,-0x12(%rbp)
lea    -0x16(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe98(%rip),%rdi
mov    $0x6,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0xe92(%rip),%eax
mov    %eax,-0x1a(%rbp)
mov    0xe89(%rip),%eax
mov    %eax,-0x1e(%rbp)
lea    -0x1a(%rbp),%rax
lea    -0x1e(%rbp),%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x1a(%rbp),%rdi
lea    -0x1e(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11dd <main+0xad>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0xe4a(%rip),%eax
mov    %eax,-0x22(%rbp)
lea    -0x1a(%rbp),%rdi
lea    -0x22(%rbp),%rsi
call   1050 <strcmp@plt>
mov    %eax,%esi
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0xe28(%rip),%eax
mov    %eax,-0x26(%rbp)
lea    -0x1a(%rbp),%rdi
lea    -0x26(%rbp),%rsi
call   1050 <strcmp@plt>
mov    %eax,%esi
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdf2(%rip),%rdi
mov    $0x20,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0xdf3(%rip),%eax
mov    %eax,-0x2b(%rbp)
mov    0xdee(%rip),%al
mov    %al,-0x27(%rbp)
lea    -0x1a(%rbp),%rdi
lea    -0x2b(%rbp),%rsi
call   1050 <strcmp@plt>
mov    %eax,%esi
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movw   $0x6f,0xc(%rsp)
movl   $0x6c6c6568,0x8(%rsp)
6c
lea    0x8(%rsp),%rdi
call   1040 <strlen@plt>
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xead(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea6(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.line = [6 x i8] c"hello\00"
@.str = [12 x i8] c"strlen=%lu\0A\00"
@.str.1 = [12 x i8] c"sizeof=%lu\0A\00"
@__const.main.s1 = [4 x i8] c"abc\00"
@__const.main.s2 = [4 x i8] c"abc\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [7 x i8] c"s1=s2\0A\00"
@__const.main.s3 = [4 x i8] c"bbc\00"
@__const.main.s4 = [4 x i8] c"Abc\00"
@__const.main.s5 = [5 x i8] c"abc \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [6 x i8]
%7 = alloca [4 x i8]
%8 = alloca [4 x i8]
%9 = alloca [4 x i8]
%10 = alloca [4 x i8]
%11 = alloca [5 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = bitcast [6 x i8]* %6 to i8*
%13 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i64 6)
%17 = bitcast [4 x i8]* %7 to i8*
%18 = bitcast [4 x i8]* %8 to i8*
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%21 = icmp eq i8* %19, %20
%22 = zext i1 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%26 = call i32 @strcmp(i8* %24, i8* %25)
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %2
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %30
30: ; preds = %28, %2
%31 = bitcast [4 x i8]* %9 to i8*
%32 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%33 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%34 = call i32 @strcmp(i8* %32, i8* %33)
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %34)
%36 = bitcast [4 x i8]* %10 to i8*
%37 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%38 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%39 = call i32 @strcmp(i8* %37, i8* %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 32)
%42 = bitcast [5 x i8]* %11 to i8*
%43 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%44 = getelementptr inbounds [5 x i8], [5 x i8]* %11, i64 0, i64 0
%45 = call i32 @strcmp(i8* %43, i8* %44)
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %45)
ret i32 0
}

LLVM IR (-O2):
@__const.main.line = [6 x i8] c"hello\00"
@.str = [12 x i8] c"strlen=%lu\0A\00"
@.str.1 = [12 x i8] c"sizeof=%lu\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@str = [6 x i8] c"s1=s2\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [6 x i8]
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%5 = call i32 @strlen(i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i64 6)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 0)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 -1)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 1)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 32)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 -1)
ret i32 0
}