#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 *, ...);
main() {
  int num1 = 5;
  char ch1 = 'x';
  int *ptr1;
  char *ptr2;
  ptr1 = &num1;
  ptr2 = &ch1;
  printf("The contents of num1 is %d and of ch1 is %c\n", num1, ch1);
  printf("The address of num1 is %p and of ch1 is %p\n\n", &num1, &ch1);
  printf("The contents of ptr1 is %p and of ptr2 is %p\n", ptr1, ptr2);
  printf("The contents of the address pointed to by ptr1 is %d and of ptr2 is "
         "%c\n",
         *ptr1, *ptr2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x5,-0x4(%rbp)
movb   $0x78,-0x5(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x5(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%esi
movsbl -0x5(%rbp),%edx
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x5(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xeed(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
movsbl (%rax),%edx
lea    0xf00(%rip),%rdi
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
movl   $0x5,0x4(%rsp)
movb   $0x78,0x3(%rsp)
lea    0xed8(%rip),%rdi
mov    $0x5,%esi
mov    $0x78,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
lea    0x4(%rsp),%rbx
lea    0x3(%rsp),%r14
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xefc(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
movsbl 0x3(%rsp),%edx
lea    0xf0d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [45 x i8] c"The contents of num1 is %d and of ch1 is %c\0A\00"
@.str.1 = [45 x i8] c"The address of num1 is %p and of ch1 is %p\0A\0A\00"
@.str.2 = [46 x i8] c"The contents of ptr1 is %p and of ptr2 is %p\0A\00"
@.str.3 = [72 x i8] c"The contents of the address pointed to by ptr1 is %d and of ptr2 is %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32*
%4 = alloca i8*
store i32 5, i32* %1
store i8 120, i8* %2
store i32* %1, i32** %3
store i8* %2, i8** %4
%5 = load i32, i32* %1
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32* %1, i8* %2)
%10 = load i32*, i32** %3
%11 = load i8*, i8** %4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i32* %10, i8* %11)
%13 = load i32*, i32** %3
%14 = load i32, i32* %13
%15 = load i8*, i8** %4
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.3, i64 0, i64 0), i32 %14, i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"The contents of num1 is %d and of ch1 is %c\0A\00"
@.str.1 = [45 x i8] c"The address of num1 is %p and of ch1 is %p\0A\0A\00"
@.str.2 = [46 x i8] c"The contents of ptr1 is %p and of ptr2 is %p\0A\00"
@.str.3 = [72 x i8] c"The contents of the address pointed to by ptr1 is %d and of ptr2 is %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
store i32 5, i32* %1
store i8 120, i8* %2
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 5, i32 120)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32* %1, i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i32* %1, i8* %2)
%7 = load i32, i32* %1
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str.3, i64 0, i64 0), i32 %7, i32 %9)
ret i32 0
}