#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 var1;
  char var2;
  int *ptr1;
  char *ptr2;
  int a = 1;
  int b = 2;
  int c;
  int *pa;
  int *pb;
  pa = &a;
  pb = &b;
  c = *pa / *pb;
  var1 = 1;
  var2 = 'A';
  ptr1 = &var1;
  ptr2 = &var2;
  printf("ptr1 contains %p\n", ptr1);
  printf("ptr2 contains %p\n", ptr2);
  printf("ptr1 contains %p, *ptr1 contains %d\n", ptr1, *ptr1);
  printf("ptr2 contains %p, *ptr2 contains %c\n", ptr2, *ptr2);
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x1,-0x1c(%rbp)
movl   $0x2,-0x20(%rbp)
lea    -0x1c(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
mov    -0x38(%rbp),%rcx
cltd
idivl  (%rcx)
mov    %eax,-0x24(%rbp)
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    -0x10(%rbp),%rsi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rax
movsbl (%rax),%edx
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x40,%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),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
lea    0x3(%rsp),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%edx
lea    0xebc(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl 0x3(%rsp),%edx
lea    0xecb(%rip),%rdi
mov    %r14,%rsi
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 = [18 x i8] c"ptr1 contains %p\0A\00"
@.str.1 = [18 x i8] c"ptr2 contains %p\0A\00"
@.str.2 = [37 x i8] c"ptr1 contains %p, *ptr1 contains %d\0A\00"
@.str.3 = [37 x i8] c"ptr2 contains %p, *ptr2 contains %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
store i32 1, i32* %5
store i32 2, i32* %6
store i32* %5, i32** %8
store i32* %6, i32** %9
%10 = load i32*, i32** %8
%11 = load i32, i32* %10
%12 = load i32*, i32** %9
%13 = load i32, i32* %12
%14 = sdiv i32 %11, %13
store i32 %14, i32* %7
store i32 1, i32* %1
store i8 65, i8* %2
store i32* %1, i32** %3
store i8* %2, i8** %4
%15 = load i32*, i32** %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32* %15)
%17 = load i8*, i8** %4
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i32*, i32** %3
%20 = load i32*, i32** %3
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32* %19, i32 %21)
%23 = load i8*, i8** %4
%24 = load i8*, i8** %4
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i8* %23, i32 %26)
%28 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"ptr1 contains %p\0A\00"
@.str.1 = [18 x i8] c"ptr2 contains %p\0A\00"
@.str.2 = [37 x i8] c"ptr1 contains %p, *ptr1 contains %d\0A\00"
@.str.3 = [37 x i8] c"ptr2 contains %p, *ptr2 contains %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 ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = load i32, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32 %6)
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i8* %2, i32 %9)
%11 = call i32 (...) @getchar()
ret i32 0
}