#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;
  int *ptr3;
  ptr1 = &num1;
  ptr2 = &ch1;
  ptr3 = &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);
  printf("Ptr3 contents in decimal is %d and in character format is %c", *ptr3,
         *ptr3);
}


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)
lea    -0x5(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%esi
movsbl -0x5(%rbp),%edx
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed6(%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    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
movsbl (%rax),%edx
lea    0xef8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
lea    0xf26(%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,(%rsp)
lea    0xed9(%rip),%rdi
mov    $0x5,%esi
mov    $0x78,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
lea    0x4(%rsp),%rbx
mov    %rsp,%r14
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
movsbl (%rsp),%edx
lea    0xf11(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%edx
lea    0xf48(%rip),%rdi
mov    %edx,%esi
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"
@.str.4 = [61 x i8] c"Ptr3 contents in decimal is %d and in character format is %c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32*
store i32 5, i32* %1
store i8 120, i8* %2
store i32* %1, i32** %3
store i8* %2, i8** %4
%6 = bitcast i8* %2 to i32*
store i32* %6, i32** %5
%7 = load i32, i32* %1
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32* %1, i8* %2)
%12 = load i32*, i32** %3
%13 = load i8*, i8** %4
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i32* %12, i8* %13)
%15 = load i32*, i32** %3
%16 = load i32, i32* %15
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.3, i64 0, i64 0), i32 %16, i32 %19)
%21 = load i32*, i32** %5
%22 = load i32, i32* %21
%23 = load i32*, i32** %5
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0), i32 %22, i32 %24)
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"
@.str.4 = [61 x i8] c"Ptr3 contents in decimal is %d and in character format is %c\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 = bitcast i8* %2 to i32*
%5 = 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)
%6 = 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)
%7 = 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)
%8 = load i32, i32* %1
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str.3, i64 0, i64 0), i32 %8, i32 %10)
%12 = load i32, i32* %4
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0), i32 %12, i32 %12)
ret i32 0
}