#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*/ sink(char);
void test_cststring(int i) {
  sink(""[(-0x7fffffffffffffffL - 1)]);
  sink(""[(-0x7fffffffffffffffL - 1) + 1]);
  sink(""[-1]);
  sink(""[0]);
  sink(""[1]);
  sink("0"[2]);
  sink("012"[2]);
  sink("012"[3]);
  sink("012"[4]);
  sink("0123"[0x7fffffffffffffffL]);
  sink("0123"[0xffffffffffffffffUL]);
}


x86 assembly (clang, -O0):
<test_cststring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xedf(%rip),%rax
movabs $0x8000000000000000,%rcx
add    %rcx,%rax
movsbl (%rax),%edi
call   1030 <sink@plt>
lea    0xec3(%rip),%rax
movabs $0x8000000000000001,%rcx
add    %rcx,%rax
movsbl (%rax),%edi
call   1030 <sink@plt>
movsbl 0xea6(%rip),%edi
call   1030 <sink@plt>
movsbl 0xe9b(%rip),%edi
call   1030 <sink@plt>
movsbl 0xe90(%rip),%edi
call   1030 <sink@plt>
movsbl 0xe84(%rip),%edi
call   1030 <sink@plt>
movsbl 0xe7a(%rip),%edi
call   1030 <sink@plt>
movsbl 0xe6f(%rip),%edi
call   1030 <sink@plt>
movsbl 0xe64(%rip),%edi
call   1030 <sink@plt>
lea    0xe58(%rip),%rax
movabs $0x7ffffffffffffffd,%rcx
ff ff 7f
add    %rcx,%rax
add    $0x2,%rax
movsbl (%rax),%edi
call   1030 <sink@plt>
movsbl 0xe37(%rip),%edi
call   1030 <sink@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_cststring>:
push   %rax
xor    %edi,%edi
call   1030 <sink@plt>
xor    %edi,%edi
call   1030 <sink@plt>
xor    %edi,%edi
call   1030 <sink@plt>
xor    %edi,%edi
call   1030 <sink@plt>
xor    %edi,%edi
call   1030 <sink@plt>
xor    %edi,%edi
call   1030 <sink@plt>
mov    $0x32,%edi
call   1030 <sink@plt>
xor    %edi,%edi
call   1030 <sink@plt>
xor    %edi,%edi
call   1030 <sink@plt>
xor    %edi,%edi
call   1030 <sink@plt>
xor    %edi,%edi
pop    %rax
jmp    1030 <sink@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [4 x i8] c"012\00"
@.str.3 = [5 x i8] c"0123\00"
define void @test_cststring(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 -9223372036854775808)
%4 = call i32 @sink(i8 signext %3)
%5 = load i8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 -9223372036854775807)
%6 = call i32 @sink(i8 signext %5)
%7 = load i8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 -1)
%8 = call i32 @sink(i8 signext %7)
%9 = load i8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
%10 = call i32 @sink(i8 signext %9)
%11 = load i8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 1, i64 0)
%12 = call i32 @sink(i8 signext %11)
%13 = load i8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 1, i64 0)
%14 = call i32 @sink(i8 signext %13)
%15 = load i8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 2)
%16 = call i32 @sink(i8 signext %15)
%17 = load i8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 3)
%18 = call i32 @sink(i8 signext %17)
%19 = load i8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 1, i64 0)
%20 = call i32 @sink(i8 signext %19)
%21 = load i8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 1844674407370955161, i64 2)
%22 = call i32 @sink(i8 signext %21)
%23 = load i8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 -1)
%24 = call i32 @sink(i8 signext %23)
ret void
}

LLVM IR (-O2):
define void @test_cststring(i32 %0) {
%2 = tail call i32 @sink(i8 signext 0)
%3 = tail call i32 @sink(i8 signext 0)
%4 = tail call i32 @sink(i8 signext 0)
%5 = tail call i32 @sink(i8 signext 0)
%6 = tail call i32 @sink(i8 signext undef)
%7 = tail call i32 @sink(i8 signext undef)
%8 = tail call i32 @sink(i8 signext 50)
%9 = tail call i32 @sink(i8 signext 0)
%10 = tail call i32 @sink(i8 signext undef)
%11 = tail call i32 @sink(i8 signext undef)
%12 = tail call i32 @sink(i8 signext undef)
ret void
}