#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
main() {
  int num1;
  char char1;
  int *ptr1;
  char *ptr2;
  num1 = 1;
  char1 = 'A';
  ptr1 = &num1;
  ptr2 = &char1;
  printf("num1 contains %d and is stored at %p\n", num1, &num1);
  printf("char1 contains %c and is stored at %p\n", char1, &char1);
  printf("ptr1 contains %p\n", ptr1);
  printf("ptr2 contains %p\n", ptr2);
  printf("ptr1 holds the value %d and ptr2 holds the values %c\n", *ptr1,
         *ptr2);
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x1,-0x4(%rbp)
movb   $0x41,-0x5(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x5(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%esi
lea    0xeb3(%rip),%rdi
lea    -0x4(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x5(%rbp),%esi
lea    0xec3(%rip),%rdi
lea    -0x5(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
movsbl (%rax),%edx
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0x1,0x4(%rsp)
movb   $0x41,0x3(%rsp)
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%r14
mov    $0x1,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    0x3(%rsp),%rbx
mov    $0x41,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
movsbl 0x3(%rsp),%edx
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [38 x i8] c"num1 contains %d and is stored at %p\0A\00"
@.str.1 = [39 x i8] c"char1 contains %c and is stored at %p\0A\00"
@.str.2 = [18 x i8] c"ptr1 contains %p\0A\00"
@.str.3 = [18 x i8] c"ptr2 contains %p\0A\00"
@.str.4 = [54 x i8] c"ptr1 holds the value %d and ptr2 holds the values %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32*
%4 = alloca i8*
store i32 1, i32* %1
store i8 65, i8* %2
store i32* %1, i32** %3
store i8* %2, i8** %4
%5 = load i32, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %5, i32* %1)
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %8, i8* %2)
%10 = load i32*, i32** %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32* %10)
%12 = load i8*, i8** %4
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %12)
%14 = load i32*, i32** %3
%15 = load i32, i32* %14
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i32 %15, i32 %18)
%20 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"num1 contains %d and is stored at %p\0A\00"
@.str.1 = [39 x i8] c"char1 contains %c and is stored at %p\0A\00"
@.str.2 = [18 x i8] c"ptr1 contains %p\0A\00"
@.str.3 = [18 x i8] c"ptr2 contains %p\0A\00"
@.str.4 = [54 x i8] c"ptr1 holds the value %d and ptr2 holds the values %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
store i32 1, i32* %1
store i8 65, i8* %2
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 1, i32* %1)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 65, i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), 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 ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i32 %8, i32 %10)
%12 = call i32 (...) @getchar()
ret i32 0
}