#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 *, ...);
int main() {
  char *str;
  str = "Hello world!";
  printf("%s, %p\n", str, &str);
  if (((unsigned long)&str > 0xffb01000) ||
      ((unsigned long)&str < 0xffb00000)) {
    printf("        TEST FAIL\n");
  } else {
    printf("        TEST PASS\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xed8(%rip),%rdi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x10(%rbp),%rax
mov    $0xffb01000,%ecx
cmp    %rcx,%rax
ja     1164 <main+0x54>
lea    -0x10(%rbp),%rax
mov    $0xffb00000,%ecx
cmp    %rcx,%rax
jae    1177 <main+0x67>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1185 <main+0x75>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rsi
mov    %rsi,0x8(%rsp)
lea    0xed5(%rip),%rdi
lea    0x8(%rsp),%rbx
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffb00000,%eax
or     $0x1000,%rax
mov    %rbx,%rcx
shr    $0x14,%rcx
cmp    $0xffb,%rcx
lea    0xec0(%rip),%rcx
lea    0xea7(%rip),%rdi
cmovb  %rcx,%rdi
cmp    %rax,%rbx
cmova  %rcx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello world!\00"
@.str.1 = [8 x i8] c"%s, %p\0A\00"
@.str.2 = [19 x i8] c" TEST FAIL\0A\00"
@.str.3 = [19 x i8] c" TEST PASS\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8** %2)
%5 = ptrtoint i8** %2 to i64
%6 = icmp ugt i64 %5, 4289728512
br i1 %6, label %10, label %7
7: ; preds = %0
%8 = ptrtoint i8** %2 to i64
%9 = icmp ult i64 %8, 4289724416
br i1 %9, label %10, label %12
10: ; preds = %7, %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %14
12: ; preds = %7
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %14
14: ; preds = %12, %10
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello world!\00"
@.str.1 = [8 x i8] c"%s, %p\0A\00"
@str = [18 x i8] c" TEST PASS\00"
@str.4 = [18 x i8] c" TEST FAIL\00"
define i32 @main() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %1
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %1)
%4 = icmp ugt i8** %1, inttoptr (i64 4289728512 to i8**)
%5 = icmp ult i8** %1, inttoptr (i64 4289724416 to i8**)
%6 = or i1 %4, %5
%7 = select i1 %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0)
%8 = call i32 @puts(i8* dereferenceable(1) %7)
ret i32 0
}