main(int argc, char *argv[]) {
  char *hello = "hello\n";
  my_print(hello);
  my_print("%p\n", hello);
  my_print("hello's addr is :%p\n", &hello);
  printf("main's addr is :%p\n", &main);
  printf("my_print's addr is :%p\n", &my_print);
  printf("printf's addr is :%p\n", &printf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1038 <my_print@plt>
mov    -0x18(%rbp),%rsi
lea    0xf13(%rip),%rdi
mov    $0x0,%al
call   1038 <my_print@plt>
lea    0xeb2(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1038 <my_print@plt>
lea    0xeb5(%rip),%rdi
mov    0x2e7a(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
mov    0x2e55(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
mov    0x2e38(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%rbx
mov    %rbx,(%rsp)
mov    %rbx,%rdi
xor    %eax,%eax
call   1038 <my_print@plt>
mov    0x2ea8(%rip),%r14
lea    0xf23(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1038 <my_print@plt>
lea    0xebf(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1038 <my_print@plt>
lea    0xec3(%rip),%rdi
mov    0x2e88(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e62(%rip),%rbx
lea    0xebb(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"hello\0A\00"
@.str.1 = [4 x i8] c"%p\0A\00"
@.str.2 = [21 x i8] c"hello's addr is :%p\0A\00"
@.str.3 = [20 x i8] c"main's addr is :%p\0A\00"
@.str.4 = [24 x i8] c"my_print's addr is :%p\0A\00"
@.str.5 = [22 x i8] c"printf's addr is :%p\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = load i8*, i8** %6
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @my_print to i32 (i8*, ...)*)(i8* %7)
%9 = load i8*, i8** %6
%10 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @my_print to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @my_print to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8** %6)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 (i32, i8**)* @main)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 (...)* @my_print)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 (i8*, ...)* @printf)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"hello\0A\00"
@.str.1 = [4 x i8] c"%p\0A\00"
@.str.2 = [21 x i8] c"hello's addr is :%p\0A\00"
@.str.3 = [20 x i8] c"main's addr is :%p\0A\00"
@.str.4 = [24 x i8] c"my_print's addr is :%p\0A\00"
@.str.5 = [22 x i8] c"printf's addr is :%p\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %3
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @my_print to i32 (i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @my_print to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @my_print to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8** %3)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 (i32, i8**)* @main)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 (...)* @my_print)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 (i8*, ...)* @printf)
ret i32 0
}