#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 *, ...);
main() {
  struct stu {
    int num;
    char *name;
    char sex;
    float score;
  } ps;
  ps.num = 102;
  ps.name = "Zhang ping";
  ps.sex = 'M';
  ps.score = 62.5;
  printf("Name=%s\nSex=%c\n", ps.name, ps.sex);
  extern int cc;
  printf("cc is %d \n", cc);
  extern char *aa;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x66,-0x18(%rbp)
lea    0xede(%rip),%rax
mov    %rax,-0x10(%rbp)
movb   $0x4d,-0x8(%rbp)
movss  0xeca(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
mov    -0x10(%rbp),%rsi
movsbl -0x8(%rbp),%edx
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%esi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef3(%rip),%rdi
lea    0xee1(%rip),%rsi
mov    $0x4d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2eb6(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stu = type { i32, i8*, i8, float }
@.str = [11 x i8] c"Zhang ping\00"
@.str.1 = [16 x i8] c"Name=%s\0ASex=%c\0A\00"
@.str.2 = [11 x i8] c"cc is %d \0A\00"
@cc = external global i32
define i32 @main() {
%1 = alloca %struct.stu
%2 = getelementptr inbounds %struct.stu, %struct.stu* %1, i32 0, i32 0
store i32 102, i32* %2
%3 = getelementptr inbounds %struct.stu, %struct.stu* %1, i32 0, i32 1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = getelementptr inbounds %struct.stu, %struct.stu* %1, i32 0, i32 2
store i8 77, i8* %4
%5 = getelementptr inbounds %struct.stu, %struct.stu* %1, i32 0, i32 3
store float 6.250000e+01, float* %5
%6 = getelementptr inbounds %struct.stu, %struct.stu* %1, i32 0, i32 1
%7 = load i8*, i8** %6
%8 = getelementptr inbounds %struct.stu, %struct.stu* %1, i32 0, i32 2
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %7, i32 %10)
%12 = load i32, i32* @cc
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"Zhang ping\00"
@.str.1 = [16 x i8] c"Name=%s\0ASex=%c\0A\00"
@.str.2 = [11 x i8] c"cc is %d \0A\00"
@cc = external global i32
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 77)
%2 = load i32, i32* @cc
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %2)
ret i32 0
}