#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 *, ...);
void main() {
  struct student {
    long int num;
    char name[20];
    char sex;
    char addr[20];
  } a = {89031, "Li Lin", 'M', "123 Beijing Road"};
  int i;
  struct student s[] = {{89032, "Li Lei", 'F', "Zhongshan Road"},
                        {89033, "Li Xiang", 'F', "Zhongguo Road"}};
  printf("Student a:\n");
  printf("NO.:%ld\nname:%s\nsex:%c\naddress:%s\n", a.num, a.name, a.sex,
         a.addr);
  for (i = 0; i < 2; i++) {
    printf("\nStudent %d:\n", i);
    printf("NO.:%ld\nname:%s\nsex:%c\naddress:%s\n", s[i].num, s[i].name,
           s[i].sex, s[i].addr);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
lea    -0x38(%rbp),%rdi
lea    0xeca(%rip),%rsi
mov    $0x38,%edx
call   1040 <memcpy@plt>
lea    -0xb0(%rbp),%rdi
lea    0xef2(%rip),%rsi
mov    $0x70,%edx
call   1040 <memcpy@plt>
lea    0xf51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rsi
lea    -0x38(%rbp),%rdx
add    $0x8,%rdx
movsbl -0x1c(%rbp),%ecx
lea    -0x38(%rbp),%r8
add    $0x1d,%r8
lea    0xf37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x2,-0x3c(%rbp)
jge    1221 <main+0x101>
mov    -0x3c(%rbp),%esi
lea    0xf38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x3c(%rbp),%rcx
lea    -0xb0(%rbp),%rax
imul   $0x38,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%rsi
movslq -0x3c(%rbp),%rax
lea    -0xb0(%rbp),%rdx
imul   $0x38,%rax,%rax
add    %rax,%rdx
add    $0x8,%rdx
movslq -0x3c(%rbp),%rcx
lea    -0xb0(%rbp),%rax
imul   $0x38,%rcx,%rcx
add    %rcx,%rax
movsbl 0x1c(%rax),%ecx
movslq -0x3c(%rbp),%rax
lea    -0xb0(%rbp),%r8
imul   $0x38,%rax,%rax
add    %rax,%r8
add    $0x1d,%r8
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1193 <main+0x73>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xb0,%rsp
mov    0xefd(%rip),%rax
mov    %rax,0xa0(%rsp)
movups 0xede(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movups 0xebf(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movups 0xea0(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xf34(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xf18(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xefc(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xee0(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec4(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xea8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe8c(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x40(%rsp),%r14
lea    0xf1d(%rip),%rdi
call   1030 <puts@plt>
lea    0x78(%rsp),%rdx
lea    0x8d(%rsp),%r8
lea    0xed3(%rip),%r15
mov    $0x15bc7,%esi
mov    %r15,%rdi
mov    $0x4d,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedb(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rdx
lea    0x1d(%rsp),%r8
mov    $0x15bc8,%esi
mov    %r15,%rdi
mov    $0x46,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x38(%rsp),%rsi
movsbl 0x54(%rsp),%ecx
lea    0x55(%rsp),%r8
mov    %r15,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xb0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.student = type { i64, [20 x i8], i8, [20 x i8] }
@__const.main.a = %struct.student { i64 89031, [20 x i8] c"Li Lin\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i8 77, [20 x i8] c"123 Beijing Road\00\00\00\00" }
@__const.main.s = [2 x %struct.student] [%struct.student { i64 89032, [20 x i8] c"Li Lei\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i8 70, [20 x i8] c"Zhongshan Road\00\00\00\00\00\00" }, %struct.student { i64 89033, [20 x i8] c"Li Xiang\00\00\00\00\00\00\00\00\00\00\00\00", i8 70, [20 x i8] c"Zhongguo Road\00\00\00\00\00\00\00" }]
@.str = [12 x i8] c"Student a:\0A\00"
@.str.1 = [35 x i8] c"NO.:%ld\0Aname:%s\0Asex:%c\0Aaddress:%s\0A\00"
@.str.2 = [14 x i8] c"\0AStudent %d:\0A\00"
define void @main() {
%1 = alloca %struct.student
%2 = alloca i32
%3 = alloca [2 x %struct.student]
%4 = bitcast %struct.student* %1 to i8*
%5 = bitcast [2 x %struct.student]* %3 to i8*
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds %struct.student, %struct.student* %1, i32 0, i32 0
%8 = load i64, i64* %7
%9 = getelementptr inbounds %struct.student, %struct.student* %1, i32 0, i32 1
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%11 = getelementptr inbounds %struct.student, %struct.student* %1, i32 0, i32 2
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = getelementptr inbounds %struct.student, %struct.student* %1, i32 0, i32 3
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %14, i64 0, i64 0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i64 %8, i8* %10, i32 %13, i8* %15)
store i32 0, i32* %2
br label %17
17: ; preds = %45, %0
%18 = load i32, i32* %2
%19 = icmp slt i32 %18, 2
br i1 %19, label %20, label %48
20: ; preds = %17
%21 = load i32, i32* %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [2 x %struct.student], [2 x %struct.student]* %3, i64 0, i64 %24
%26 = getelementptr inbounds %struct.student, %struct.student* %25, i32 0, i32 0
%27 = load i64, i64* %26
%28 = load i32, i32* %2
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [2 x %struct.student], [2 x %struct.student]* %3, i64 0, i64 %29
%31 = getelementptr inbounds %struct.student, %struct.student* %30, i32 0, i32 1
%32 = getelementptr inbounds [20 x i8], [20 x i8]* %31, i64 0, i64 0
%33 = load i32, i32* %2
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [2 x %struct.student], [2 x %struct.student]* %3, i64 0, i64 %34
%36 = getelementptr inbounds %struct.student, %struct.student* %35, i32 0, i32 2
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = load i32, i32* %2
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [2 x %struct.student], [2 x %struct.student]* %3, i64 0, i64 %40
%42 = getelementptr inbounds %struct.student, %struct.student* %41, i32 0, i32 3
%43 = getelementptr inbounds [20 x i8], [20 x i8]* %42, i64 0, i64 0
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i64 %27, i8* %32, i32 %38, i8* %43)
br label %45
45: ; preds = %20
%46 = load i32, i32* %2
%47 = add nsw i32 %46, 1
store i32 %47, i32* %2
br label %17
48: ; preds = %17
ret void
}

LLVM IR (-O2):
%struct.student = type { i64, [20 x i8], i8, [20 x i8] }
@__const.main.a = %struct.student { i64 89031, [20 x i8] c"Li Lin\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i8 77, [20 x i8] c"123 Beijing Road\00\00\00\00" }
@__const.main.s = [2 x %struct.student] [%struct.student { i64 89032, [20 x i8] c"Li Lei\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i8 70, [20 x i8] c"Zhongshan Road\00\00\00\00\00\00" }, %struct.student { i64 89033, [20 x i8] c"Li Xiang\00\00\00\00\00\00\00\00\00\00\00\00", i8 70, [20 x i8] c"Zhongguo Road\00\00\00\00\00\00\00" }]
@.str.1 = [35 x i8] c"NO.:%ld\0Aname:%s\0Asex:%c\0Aaddress:%s\0A\00"
@.str.2 = [14 x i8] c"\0AStudent %d:\0A\00"
@str = [11 x i8] c"Student a:\00"
define void @main() {
%1 = alloca %struct.student
%2 = alloca [2 x %struct.student]
%3 = bitcast %struct.student* %1 to i8*
%4 = bitcast [2 x %struct.student]* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%6 = getelementptr inbounds %struct.student, %struct.student* %1, i64 0, i32 1, i64 0
%7 = getelementptr inbounds %struct.student, %struct.student* %1, i64 0, i32 3, i64 0
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i64 89031, i8* %6, i32 77, i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 0)
%10 = getelementptr inbounds [2 x %struct.student], [2 x %struct.student]* %2, i64 0, i64 0, i32 1, i64 0
%11 = getelementptr inbounds [2 x %struct.student], [2 x %struct.student]* %2, i64 0, i64 0, i32 3, i64 0
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i64 89032, i8* %10, i32 70, i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 1)
%14 = getelementptr inbounds [2 x %struct.student], [2 x %struct.student]* %2, i64 0, i64 1, i32 0
%15 = load i64, i64* %14
%16 = getelementptr inbounds [2 x %struct.student], [2 x %struct.student]* %2, i64 0, i64 1, i32 1, i64 0
%17 = getelementptr inbounds [2 x %struct.student], [2 x %struct.student]* %2, i64 0, i64 1, i32 2
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = getelementptr inbounds [2 x %struct.student], [2 x %struct.student]* %2, i64 0, i64 1, i32 3, i64 0
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i64 %15, i8* %16, i32 %19, i8* %20)
ret void
}