#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 *, int, ...);
void test1() {
  int a = 3;
  int *pb = &a;
  int c = *pb;
  printf("Reading from a pointer: %d %d\n", a, c);
  *pb = 4;
  printf("Writing to a pointer: %d\n", a);
  printf("Testing casts: %d %g %g %d\n", 3, (float)3, 4.5, (int)4.5);
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x3,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movl   $0x4,(%rax)
mov    -0x4(%rbp),%esi
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
mov    $0x3,%esi
movsd  0xe8d(%rip),%xmm0
movsd  0xe8d(%rip),%xmm1
mov    $0x4,%edx
mov    $0x2,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
push   %rax
lea    0xef8(%rip),%rdi
mov    $0x3,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf06(%rip),%rdi
movsd  0xeb5(%rip),%xmm0
movsd  0xeb5(%rip),%xmm1
mov    $0x3,%esi
mov    $0x4,%edx
mov    $0x2,%al
pop    %rcx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"Reading from a pointer: %d %d\0A\00"
@.str.1 = [26 x i8] c"Writing to a pointer: %d\0A\00"
@.str.2 = [28 x i8] c"Testing casts: %d %g %g %d\0A\00"
define void @test1() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
store i32 3, i32* %1
store i32* %1, i32** %2
%4 = load i32*, i32** %2
%5 = load i32, i32* %4
store i32 %5, i32* %3
%6 = load i32, i32* %1
%7 = load i32, i32* %3
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = load i32*, i32** %2
store i32 4, i32* %9
%10 = load i32, i32* %1
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 3, double 3.000000e+00, double 4.500000e+00, i32 4)
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"Reading from a pointer: %d %d\0A\00"
@.str.1 = [26 x i8] c"Writing to a pointer: %d\0A\00"
@.str.2 = [28 x i8] c"Testing casts: %d %g %g %d\0A\00"
define void @test1() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 3, i32 3)
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 4)
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 3, double 3.000000e+00, double 4.500000e+00, i32 4)
ret void
}