#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 main() {
  int x = 100;
  printf("x的值是:%d\n", x);
  printf("x所占空间大小是:%ld\n", sizeof x);
  int *ptr1 = &x;
  printf("x的地址是:%p\n", ptr1);
  printf("通过指针来获得x的值：%d\n", *ptr1);
  *ptr1 = 1000;
  printf("通过指针改变x的值后x=%d\n", x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x64,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movl   $0x3e8,(%rax)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x64,0x4(%rsp)
lea    0xee0(%rip),%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
lea    0xee0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0x3e8,0x4(%rsp)
lea    0xeed(%rip),%rdi
mov    $0x3e8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"x\E7\9A\84\E5\80\BC\E6\98\AF:%d\0A\00"
@.str.1 = [28 x i8] c"x\E6\89\80\E5\8D\A0\E7\A9\BA\E9\97\B4\E5\A4\A7\E5\B0\8F\E6\98\AF:%ld\0A\00"
@.str.2 = [18 x i8] c"x\E7\9A\84\E5\9C\B0\E5\9D\80\E6\98\AF:%p\0A\00"
@.str.3 = [35 x i8] c"\E9\80\9A\E8\BF\87\E6\8C\87\E9\92\88\E6\9D\A5\E8\8E\B7\E5\BE\97x\E7\9A\84\E5\80\BC\EF\BC\9A%d\0A\00"
@.str.4 = [34 x i8] c"\E9\80\9A\E8\BF\87\E6\8C\87\E9\92\88\E6\94\B9\E5\8F\98x\E7\9A\84\E5\80\BC\E5\90\8Ex=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 100, i32* %1
%3 = load i32, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i64 4)
store i32* %1, i32** %2
%6 = load i32*, i32** %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%8 = load i32*, i32** %2
%9 = load i32, i32* %8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%11 = load i32*, i32** %2
store i32 1000, i32* %11
%12 = load i32, i32* %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"x\E7\9A\84\E5\80\BC\E6\98\AF:%d\0A\00"
@.str.1 = [28 x i8] c"x\E6\89\80\E5\8D\A0\E7\A9\BA\E9\97\B4\E5\A4\A7\E5\B0\8F\E6\98\AF:%ld\0A\00"
@.str.2 = [18 x i8] c"x\E7\9A\84\E5\9C\B0\E5\9D\80\E6\98\AF:%p\0A\00"
@.str.3 = [35 x i8] c"\E9\80\9A\E8\BF\87\E6\8C\87\E9\92\88\E6\9D\A5\E8\8E\B7\E5\BE\97x\E7\9A\84\E5\80\BC\EF\BC\9A%d\0A\00"
@.str.4 = [34 x i8] c"\E9\80\9A\E8\BF\87\E6\8C\87\E9\92\88\E6\94\B9\E5\8F\98x\E7\9A\84\E5\80\BC\E5\90\8Ex=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 100, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 100)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i64 4)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %6)
store i32 1000, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 1000)
ret i32 0
}