#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 const *);
void test_constant_bindings(void) {
  const char *const s1 = "hello";
  const char s2[] = "hello";
  const char *s3 = "hello";
  char *const s4 = "hello";
  extern const char s5[];
  printf(s1);
  printf(s2);
  printf(s3);
  printf(s4);
  printf(s5);
}


x86 assembly (clang, -O0):
<test_constant_bindings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0xed7(%rip),%eax
mov    %eax,-0xe(%rbp)
mov    0xed1(%rip),%ax
mov    %ax,-0xa(%rbp)
lea    0xec2(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xeb7(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
lea    -0xe(%rbp),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <printf@plt>
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e6a(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_constant_bindings>:
push   %rbx
sub    $0x10,%rsp
movw   $0x6f,0xc(%rsp)
movl   $0x6c6c6568,0x8(%rsp)
6c
lea    0xed5(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x8(%rsp),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2e94(%rip),%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
@__const.test_constant_bindings.s2 = [6 x i8] c"hello\00"
@s5 = external constant [0 x i8]
define void @test_constant_bindings() {
%1 = alloca i8*
%2 = alloca [6 x i8]
%3 = alloca i8*
%4 = alloca i8*
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %1
%5 = bitcast [6 x i8]* %2 to i8*
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0))
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%8 = call i32 @printf(i8* %7)
%9 = load i8*, i8** %3
%10 = call i32 @printf(i8* %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @s5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.test_constant_bindings.s2 = [6 x i8] c"hello\00"
@s5 = external constant [0 x i8]
define void @test_constant_bindings() {
%1 = alloca [6 x i8]
%2 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @__const.test_constant_bindings.s2, i64 0, i64 0))
%4 = call i32 @printf(i8* %2)
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @__const.test_constant_bindings.s2, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @__const.test_constant_bindings.s2, i64 0, i64 0))
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([0 x i8], [0 x i8]* @s5, i64 0, i64 0))
ret void
}