#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*/ clang_analyzer_eval(int);
int string_literal_init() {
  char a[] = "abc";
  char b[2] = "abc";
  char c[5] = "abc";
  clang_analyzer_eval(a[1] == 'b');
  clang_analyzer_eval(b[1] == 'b');
  clang_analyzer_eval(c[1] == 'b');
  clang_analyzer_eval(a[3] == 0);
  clang_analyzer_eval(c[3] == 0);
  clang_analyzer_eval(c[4] == 0);
  return 42;
}


x86 assembly (clang, -O0):
<string_literal_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xee2(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    0xedc(%rip),%ax
mov    %ax,-0x6(%rbp)
mov    0xed4(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xecf(%rip),%al
mov    %al,-0x7(%rbp)
movsbl -0x3(%rbp),%eax
cmp    $0x62,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x62,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
movsbl -0xa(%rbp),%eax
cmp    $0x62,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
movsbl -0x8(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
movsbl -0x7(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x2a,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_literal_init>:
push   %rax
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x2a,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.string_literal_init.a = [4 x i8] c"abc\00"
@__const.string_literal_init.b = [2 x i8] c"ab"
@__const.string_literal_init.c = [5 x i8] c"abc\00\00"
define i32 @string_literal_init() {
%1 = alloca [4 x i8]
%2 = alloca [2 x i8]
%3 = alloca [5 x i8]
%4 = bitcast [4 x i8]* %1 to i8*
%5 = bitcast [2 x i8]* %2 to i8*
%6 = bitcast [5 x i8]* %3 to i8*
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 1
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 98
%11 = zext i1 %10 to i32
%12 = call i32 @clang_analyzer_eval(i32 %11)
%13 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 98
%17 = zext i1 %16 to i32
%18 = call i32 @clang_analyzer_eval(i32 %17)
%19 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 1
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 98
%23 = zext i1 %22 to i32
%24 = call i32 @clang_analyzer_eval(i32 %23)
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 3
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 0
%29 = zext i1 %28 to i32
%30 = call i32 @clang_analyzer_eval(i32 %29)
%31 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 3
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 0
%35 = zext i1 %34 to i32
%36 = call i32 @clang_analyzer_eval(i32 %35)
%37 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 4
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 0
%41 = zext i1 %40 to i32
%42 = call i32 @clang_analyzer_eval(i32 %41)
ret i32 42
}

LLVM IR (-O2):
define i32 @string_literal_init() {
%1 = tail call i32 @clang_analyzer_eval(i32 1)
%2 = tail call i32 @clang_analyzer_eval(i32 1)
%3 = tail call i32 @clang_analyzer_eval(i32 1)
%4 = tail call i32 @clang_analyzer_eval(i32 1)
%5 = tail call i32 @clang_analyzer_eval(i32 1)
%6 = tail call i32 @clang_analyzer_eval(i32 1)
ret i32 42
}