#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 */
typedef int /*<<< orphan*/ c;
typedef int /*<<< orphan*/ b;
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, short);
int main() {
  int a = 4;
  short b;
  double c;
  int *ptr;
  printf("Line 1 - 变量 a 的大小 = %lu\n", sizeof(a));
  printf("Line 2 - 变量 b 的大小 = %lu\n", sizeof(b));
  printf("Line 3 - 变量 c 的大小 = %lu\n", sizeof(c));
  ptr = &a;
  printf("a 的值是 %d\n", a);
  printf("*ptr 是 %d\n", *ptr);
  a = 10;
  b = (a == 1) ? 20 : 30;
  printf("b 的值是 %d\n", b);
  b = (a == 10) ? 20 : 30;
  printf("b 的值是 %d\n", b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x4,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
lea    0xf05(%rip),%rdi
movswl %ax,%esi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
lea    0xf00(%rip),%rdi
movswl %ax,%esi
call   1030 <printf@plt>
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x1e,%eax
mov    $0x14,%ecx
cmp    $0x1,%edx
cmove  %ecx,%eax
mov    %ax,-0x6(%rbp)
lea    0xee0(%rip),%rdi
movswl -0x6(%rbp),%esi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edx
mov    $0x1e,%eax
mov    $0x14,%ecx
cmp    $0xa,%edx
cmove  %ecx,%eax
mov    %ax,-0x6(%rbp)
lea    0xeb9(%rip),%rdi
movswl -0x6(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
lea    0xf0c(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xf1e(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xf1d(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xf19(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Line 1 - \E5\8F\98\E9\87\8F a \E7\9A\84\E5\A4\A7\E5\B0\8F = %lu\0A\00"
@.str.1 = [35 x i8] c"Line 2 - \E5\8F\98\E9\87\8F b \E7\9A\84\E5\A4\A7\E5\B0\8F = %lu\0A\00"
@.str.2 = [35 x i8] c"Line 3 - \E5\8F\98\E9\87\8F c \E7\9A\84\E5\A4\A7\E5\B0\8F = %lu\0A\00"
@.str.3 = [16 x i8] c"a \E7\9A\84\E5\80\BC\E6\98\AF %d\0A\00"
@.str.4 = [13 x i8] c"*ptr \E6\98\AF %d\0A\00"
@.str.5 = [16 x i8] c"b \E7\9A\84\E5\80\BC\E6\98\AF %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
%3 = alloca double
%4 = alloca i32*
store i32 4, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i16 signext 4)
%6 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i16 signext 2)
%7 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i16 signext 8)
store i32* %1, i32** %4
%8 = load i32, i32* %1
%9 = trunc i32 %8 to i16
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i16 signext %9)
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
%13 = trunc i32 %12 to i16
%14 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i16 signext %13)
store i32 10, i32* %1
%15 = load i32, i32* %1
%16 = icmp eq i32 %15, 1
%17 = zext i1 %16 to i64
%18 = select i1 %16, i32 20, i32 30
%19 = trunc i32 %18 to i16
store i16 %19, i16* %2
%20 = load i16, i16* %2
%21 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i16 signext %20)
%22 = load i32, i32* %1
%23 = icmp eq i32 %22, 10
%24 = zext i1 %23 to i64
%25 = select i1 %23, i32 20, i32 30
%26 = trunc i32 %25 to i16
store i16 %26, i16* %2
%27 = load i16, i16* %2
%28 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i16 signext %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"Line 1 - \E5\8F\98\E9\87\8F a \E7\9A\84\E5\A4\A7\E5\B0\8F = %lu\0A\00"
@.str.1 = [35 x i8] c"Line 2 - \E5\8F\98\E9\87\8F b \E7\9A\84\E5\A4\A7\E5\B0\8F = %lu\0A\00"
@.str.2 = [35 x i8] c"Line 3 - \E5\8F\98\E9\87\8F c \E7\9A\84\E5\A4\A7\E5\B0\8F = %lu\0A\00"
@.str.3 = [16 x i8] c"a \E7\9A\84\E5\80\BC\E6\98\AF %d\0A\00"
@.str.4 = [13 x i8] c"*ptr \E6\98\AF %d\0A\00"
@.str.5 = [16 x i8] c"b \E7\9A\84\E5\80\BC\E6\98\AF %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i16 signext 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i16 signext 2)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i16 signext 8)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i16 signext 4)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i16 signext 4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i16 signext 30)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i16 signext 20)
ret i32 0
}