#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcat(char *, char *);
int strchr(char *, char);
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
int main(int argc, char **argv) {
  char s1[20];
  char s2[] = " Zahari!";
  s1[0] = 'H';
  s1[1] = 'e';
  s1[2] = 'l';
  s1[3] = 'l';
  s1[4] = 'o';
  s1[5] = '\0';
  strcat(s1, s2);
  fprintf(stdout, "strcmp -> %d\n", !strcmp("HellO", "Hello"));
  fprintf(stdout, "strchr -> %c\n", strchr("HellO", 'H'));
  fprintf(stdout, "strlen('%s') -> %d\n", s1, strlen(s1));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe93(%rip),%rax
mov    %rax,-0x39(%rbp)
mov    0xe91(%rip),%al
mov    %al,-0x31(%rbp)
movb   $0x48,-0x30(%rbp)
movb   $0x65,-0x2f(%rbp)
movb   $0x6c,-0x2e(%rbp)
movb   $0x6c,-0x2d(%rbp)
movb   $0x6f,-0x2c(%rbp)
movb   $0x0,-0x2b(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x39(%rbp),%rsi
call   1070 <strcat@plt>
mov    0x2e3a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
lea    0xe65(%rip),%rdi
lea    0xe64(%rip),%rsi
call   1050 <strcmp@plt>
mov    -0x54(%rbp),%edi
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edx
lea    0xe34(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2dfd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
lea    0xe28(%rip),%rdi
mov    $0x48,%esi
call   1040 <strchr@plt>
mov    -0x50(%rbp),%edi
mov    %eax,%edx
lea    0xe1e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2dcd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x4c(%rbp),%edi
mov    -0x48(%rbp),%rdx
mov    %eax,%ecx
lea    0xdf8(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
movabs $0x2169726168615a20,%rax
72 69 21
mov    %rax,(%rsp)
movb   $0x0,0x8(%rsp)
movl   $0x6c6c6548,0x10(%rsp)
6c
movw   $0x6f,0x14(%rsp)
lea    0x10(%rsp),%r14
mov    %rsp,%rsi
mov    %r14,%rdi
call   1060 <strcat@plt>
mov    0x2e5f(%rip),%rbx
mov    (%rbx),%edi
lea    0xe7f(%rip),%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    (%rbx),%ebp
lea    0xe7b(%rip),%rdi
mov    $0x48,%esi
call   1040 <strchr@plt>
lea    0xe70(%rip),%rsi
mov    %ebp,%edi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    (%rbx),%ebp
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    0xe62(%rip),%rsi
mov    %ebp,%edi
mov    %r14,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.s2 = [9 x i8] c" Zahari!\00"
@stdout = global i32 0
@.str = [14 x i8] c"strcmp -> %d\0A\00"
@.str.1 = [6 x i8] c"HellO\00"
@.str.2 = [6 x i8] c"Hello\00"
@.str.3 = [14 x i8] c"strchr -> %c\0A\00"
@.str.4 = [20 x i8] c"strlen('%s') -> %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [20 x i8]
%7 = alloca [9 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [9 x i8]* %7 to i8*
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
store i8 72, i8* %9
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 1
store i8 101, i8* %10
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 2
store i8 108, i8* %11
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 3
store i8 108, i8* %12
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 4
store i8 111, i8* %13
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 5
store i8 0, i8* %14
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%16 = getelementptr inbounds [9 x i8], [9 x i8]* %7, i64 0, i64 0
%17 = call i32 @strcat(i8* %15, i8* %16)
%18 = load i32, i32* @stdout
%19 = call i32 @strcmp(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.2, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
%21 = xor i1 %20, true
%22 = zext i1 %21 to i32
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = load i32, i32* @stdout
%25 = call i32 @strchr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 signext 72)
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %25)
%27 = load i32, i32* @stdout
%28 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%29 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%30 = call i32 @strlen(i8* %29)
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %28, i32 %30)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s2 = [9 x i8] c" Zahari!\00"
@stdout = global i32 0
@.str = [14 x i8] c"strcmp -> %d\0A\00"
@.str.1 = [6 x i8] c"HellO\00"
@.str.3 = [14 x i8] c"strchr -> %c\0A\00"
@.str.4 = [20 x i8] c"strlen('%s') -> %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [20 x i8]
%4 = alloca [9 x i8]
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 0
store i8 72, i8* %5
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 1
store i8 101, i8* %7
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 2
store i8 108, i8* %8
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 3
store i8 108, i8* %9
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 4
store i8 111, i8* %10
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 5
store i8 0, i8* %11
%12 = call i32 @strcat(i8* %5, i8* %6)
%13 = load i32, i32* @stdout
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 0)
%15 = load i32, i32* @stdout
%16 = call i32 @strchr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 signext 72)
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = load i32, i32* @stdout
%19 = call i32 @strlen(i8* %5)
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %5, i32 %19)
ret i32 0
}