#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 *, char const *, char *, char const *,
                          char *, char const *, ...);
int /*<<< orphan*/ strcmp(char const *, char const *);
char *strncmp(char const *, char const *, int);
int main(void) {
  const char *s1 = "Happy New Year";
  const char *s2 = "Happy New Year";
  const char *s3 = "Happy Holidays";
  printf("%s%s\n%s%s\n%s%s\n\n%s%2d\n%s%2d\n%s%2d\n\n", "s1 = ", s1,
         "s2 = ", s2, "s3 = ", s3, "strcmp(s1, s2) = ", strcmp(s1, s2),
         "strcmp(s1, s3) = ", strcmp(s1, s3),
         "strcmp(s3, s1) = ", strcmp(s3, s1));
  printf("%s%2d\n%s%2d\n%s%2d\n", "strncmp(s1, s3, 6) = ", strncmp(s1, s3, 6),
         "strncmp(s1, s3, 7) = ", strncmp(s1, s3, 7),
         "strncmp(s3, s1, 7) = ", strncmp(s3, s1, 7));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x80,%rsp
movl   $0x0,-0x24(%rbp)
lea    0xeb0(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xea5(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xea9(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x40(%rbp),%r12
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1050 <strcmp@plt>
mov    %eax,%r14d
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1050 <strcmp@plt>
mov    %eax,-0x54(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1050 <strcmp@plt>
mov    -0x68(%rbp),%rdx
mov    -0x60(%rbp),%r8
mov    -0x54(%rbp),%r11d
lea    0xe60(%rip),%rdi
lea    0xe7d(%rip),%rsi
lea    0xe7c(%rip),%rcx
lea    0xe7b(%rip),%r9
lea    0xe7a(%rip),%r15
lea    0xe85(%rip),%rbx
lea    0xe90(%rip),%r10
mov    %r12,(%rsp)
mov    %r15,0x8(%rsp)
mov    %r14d,0x10(%rsp)
mov    %rbx,0x18(%rsp)
mov    %r11d,0x20(%rsp)
mov    %r10,0x28(%rsp)
mov    %eax,0x30(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
mov    %rax,-0x50(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
mov    -0x50(%rbp),%rdx
mov    -0x48(%rbp),%r8
lea    0xe2d(%rip),%rdi
lea    0xe39(%rip),%rsi
lea    0xe48(%rip),%rcx
lea    0xe57(%rip),%r9
mov    %rax,(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x8,%rsp
lea    0xf44(%rip),%rbx
lea    0xf2b(%rip),%r10
lea    0xf12(%rip),%r11
lea    0xec6(%rip),%r14
lea    0xece(%rip),%rdi
lea    0xeeb(%rip),%rsi
lea    0xeea(%rip),%rcx
lea    0xe9b(%rip),%r12
lea    0xee2(%rip),%r9
mov    %r12,%rdx
mov    %r12,%r8
xor    %eax,%eax
push   $0xffffffffffffffff
push   %rbx
push   $0x1
push   %r10
push   $0x0
push   %r11
push   %r14
call   1040 <printf@plt>
add    $0x40,%rsp
mov    %r12,%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
mov    %rax,%r15
mov    %r12,%rdi
mov    %r14,%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
mov    %rax,%r13
mov    %r14,%rdi
mov    %r12,%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
mov    %rax,%rbx
sub    $0x8,%rsp
lea    0xebc(%rip),%rdi
lea    0xec8(%rip),%rsi
lea    0xed7(%rip),%rcx
lea    0xee6(%rip),%r9
mov    %r15,%rdx
mov    %r13,%r8
xor    %eax,%eax
push   %rbx
call   1040 <printf@plt>
add    $0x10,%rsp
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Happy New Year\00"
@.str.1 = [15 x i8] c"Happy Holidays\00"
@.str.2 = [36 x i8] c"%s%s\0A%s%s\0A%s%s\0A\0A%s%2d\0A%s%2d\0A%s%2d\0A\0A\00"
@.str.3 = [6 x i8] c"s1 = \00"
@.str.4 = [6 x i8] c"s2 = \00"
@.str.5 = [6 x i8] c"s3 = \00"
@.str.6 = [18 x i8] c"strcmp(s1, s2) = \00"
@.str.7 = [18 x i8] c"strcmp(s1, s3) = \00"
@.str.8 = [18 x i8] c"strcmp(s3, s1) = \00"
@.str.9 = [19 x i8] c"%s%2d\0A%s%2d\0A%s%2d\0A\00"
@.str.10 = [22 x i8] c"strncmp(s1, s3, 6) = \00"
@.str.11 = [22 x i8] c"strncmp(s1, s3, 7) = \00"
@.str.12 = [22 x i8] c"strncmp(s3, s1, 7) = \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8** %4
%5 = load i8*, i8** %2
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = load i8*, i8** %2
%9 = load i8*, i8** %3
%10 = call i32 @strcmp(i8* %8, i8* %9)
%11 = load i8*, i8** %2
%12 = load i8*, i8** %4
%13 = call i32 @strcmp(i8* %11, i8* %12)
%14 = load i8*, i8** %4
%15 = load i8*, i8** %2
%16 = call i32 @strcmp(i8* %14, i8* %15)
%17 = call i32 (i8*, i8*, i8*, i8*, i8*, i8*, i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %7, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %10, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 %13, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i32 %16)
%18 = load i8*, i8** %2
%19 = load i8*, i8** %4
%20 = call i8* @strncmp(i8* %18, i8* %19, i32 6)
%21 = load i8*, i8** %2
%22 = load i8*, i8** %4
%23 = call i8* @strncmp(i8* %21, i8* %22, i32 7)
%24 = load i8*, i8** %4
%25 = load i8*, i8** %2
%26 = call i8* @strncmp(i8* %24, i8* %25, i32 7)
%27 = call i32 (i8*, i8*, i8*, i8*, i8*, i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i8* %20, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i8* %23, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i8* %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Happy New Year\00"
@.str.1 = [15 x i8] c"Happy Holidays\00"
@.str.2 = [36 x i8] c"%s%s\0A%s%s\0A%s%s\0A\0A%s%2d\0A%s%2d\0A%s%2d\0A\0A\00"
@.str.3 = [6 x i8] c"s1 = \00"
@.str.4 = [6 x i8] c"s2 = \00"
@.str.5 = [6 x i8] c"s3 = \00"
@.str.6 = [18 x i8] c"strcmp(s1, s2) = \00"
@.str.7 = [18 x i8] c"strcmp(s1, s3) = \00"
@.str.8 = [18 x i8] c"strcmp(s3, s1) = \00"
@.str.9 = [19 x i8] c"%s%2d\0A%s%2d\0A%s%2d\0A\00"
@.str.10 = [22 x i8] c"strncmp(s1, s3, 6) = \00"
@.str.11 = [22 x i8] c"strncmp(s1, s3, 7) = \00"
@.str.12 = [22 x i8] c"strncmp(s3, s1, 7) = \00"
define i32 @main() {
%1 = tail call i32 (i8*, i8*, i8*, i8*, i8*, i8*, i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i32 -1)
%2 = tail call i8* @strncmp(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 6)
%3 = tail call i8* @strncmp(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 7)
%4 = tail call i8* @strncmp(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 7)
%5 = tail call i32 (i8*, i8*, i8*, i8*, i8*, i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i8* %4)
ret i32 0
}