#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*/ ldt_seg_write(int, int, int);
int /*<<< orphan*/ print_ldt();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ set_ldt1(int *);
int main(void) {
  int i;
  int arr[9];
  for (i = 0; i < 9; i++)
    arr[i] = 11 * i;
  set_ldt1(&arr[4]);
  print_ldt();
  ldt_seg_write(1, 4, 4444);
  for (i = 0; i < 9; i++)
    printf("%d ", arr[i]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x9,-0x8(%rbp)
jge    117a <main+0x3a>
imul   $0xb,-0x8(%rbp),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <main+0x16>
lea    -0x30(%rbp),%rdi
add    $0x10,%rdi
call   1060 <set_ldt1@plt>
mov    $0x0,%al
call   1040 <print_ldt@plt>
mov    $0x1,%edi
mov    $0x4,%esi
mov    $0x115c,%edx
call   1050 <ldt_seg_write@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x9,-0x8(%rbp)
jge    11d7 <main+0x97>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a9 <main+0x69>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movaps 0xea4(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x10(%rsp),%rdi
movaps 0xea4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x58,0x20(%rsp)
call   1070 <set_ldt1@plt>
xor    %eax,%eax
call   1050 <print_ldt@plt>
mov    $0x1,%edi
mov    $0x4,%esi
mov    $0x115c,%edx
call   1060 <ldt_seg_write@plt>
mov    (%rsp),%esi
lea    0xe7d(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [9 x i32]
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %13, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 9
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i32, i32* %2
%9 = mul nsw i32 11, %8
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 %11
store i32 %9, i32* %12
br label %13
13: ; preds = %7
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %4
16: ; preds = %4
%17 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 4
%18 = call i32 @set_ldt1(i32* %17)
%19 = call i32 (...) @print_ldt()
%20 = call i32 @ldt_seg_write(i32 1, i32 4, i32 4444)
store i32 0, i32* %2
br label %21
21: ; preds = %30, %16
%22 = load i32, i32* %2
%23 = icmp slt i32 %22, 9
br i1 %23, label %24, label %33
24: ; preds = %21
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %24
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
br label %21
33: ; preds = %21
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca [9 x i32]
%2 = bitcast [9 x i32]* %1 to i8*
%3 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%4 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 1
%5 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 2
%6 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 3
%7 = bitcast [9 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 0, i32 11, i32 22, i32 33>, <4 x i32>* %7
%8 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 4
%9 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 5
%10 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 6
%11 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 7
%12 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> <i32 44, i32 55, i32 66, i32 77>, <4 x i32>* %12
%13 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 8
store i32 88, i32* %13
%14 = call i32 @set_ldt1(i32* %8)
%15 = call i32 (...) @print_ldt()
%16 = call i32 @ldt_seg_write(i32 1, i32 4, i32 4444)
%17 = load i32, i32* %3
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %4
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %5
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %6
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %8
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %9
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %10
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %11
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %13
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = call i32 @putchar(i32 10)
ret i32 0
}