#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*/ f1(char *);
int /*<<< orphan*/ f2(int /*<<< orphan*/ (*)(char *), char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char str[] = "123";
  printf("in main pointer to str [ 0 ] = %p;\n", &str[0]);
  printf("in main pointer to str =w      %p;\n", str);
  printf("str = %s;\n", str);
  f1(&str[0]);
  f2(f1, str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x8(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
lea    -0x8(%rbp),%rsi
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
lea    -0x8(%rbp),%rsi
lea    0xee9(%rip),%rdi
call   1040 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1050 <f1@plt>
lea    -0x8(%rbp),%rsi
mov    0x2e6c(%rip),%rdi
call   1030 <f2@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x333231,0xc(%rsp)
lea    0xecc(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0xedc(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0xef1(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <f1@plt>
mov    0x2e7a(%rip),%rdi
mov    %rbx,%rsi
call   1030 <f2@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [4 x i8] c"123\00"
@.str = [36 x i8] c"in main pointer to str [ 0 ] = %p;\0A\00"
@.str.1 = [36 x i8] c"in main pointer to str =w %p;\0A\00"
@.str.2 = [11 x i8] c"str = %s;\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
store i32 0, i32* %1
%3 = bitcast [4 x i8]* %2 to i8*
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%7 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%11 = call i32 @f1(i8* %10)
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%13 = call i32 @f2(i32 (i8*)* @f1, i8* %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"in main pointer to str [ 0 ] = %p;\0A\00"
@.str.1 = [36 x i8] c"in main pointer to str =w %p;\0A\00"
@.str.2 = [11 x i8] c"str = %s;\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 3355185, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%6 = call i32 @f1(i8* %2)
%7 = call i32 @f2(i32 (i8*)* @f1, i8* %2)
ret i32 0
}