#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*/ expecti(char, int);
void test() {
  struct incomplete;
  struct s {
    int a;
    int b;
    int array[3];
  } d;
  d.a = 100;
  d.b = 200;
  d.array[0] = d.a;
  d.array[1] = d.b;
  d.array[2] = d.array[1];
  expecti(d.a, 100);
  expecti(d.b, 200);
  expecti(d.array[0], 100);
  expecti(d.array[1], 200);
  expecti(d.array[2], 200);
  struct {
    union {
      struct {
        int x;
        int y;
      };
      struct {
        char data[8];
      };
    };
  } a;
  a.x = 100;
  a.y = 200;
  expecti(a.data[0], 100);
  expecti(a.data[4], 200);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x64,-0x18(%rbp)
movl   $0xc8,-0x14(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x64,%esi
movsbl %al,%edi
call   1030 <expecti@plt>
mov    -0x14(%rbp),%eax
mov    $0xc8,%esi
movsbl %al,%edi
call   1030 <expecti@plt>
mov    -0x10(%rbp),%eax
mov    $0x64,%esi
movsbl %al,%edi
call   1030 <expecti@plt>
mov    -0xc(%rbp),%eax
mov    $0xc8,%esi
movsbl %al,%edi
call   1030 <expecti@plt>
mov    -0x8(%rbp),%eax
mov    $0xc8,%esi
movsbl %al,%edi
call   1030 <expecti@plt>
movl   $0x64,-0x20(%rbp)
movl   $0xc8,-0x1c(%rbp)
mov    $0x64,%esi
movsbl -0x20(%rbp),%edi
call   1030 <expecti@plt>
mov    $0xc8,%esi
movsbl -0x1c(%rbp),%edi
call   1030 <expecti@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
mov    $0x64,%edi
mov    $0x64,%esi
call   1030 <expecti@plt>
mov    $0xffffffc8,%edi
mov    $0xc8,%esi
call   1030 <expecti@plt>
mov    $0x64,%edi
mov    $0x64,%esi
call   1030 <expecti@plt>
mov    $0xffffffc8,%edi
mov    $0xc8,%esi
call   1030 <expecti@plt>
mov    $0xffffffc8,%edi
mov    $0xc8,%esi
call   1030 <expecti@plt>
mov    $0x64,%edi
mov    $0x64,%esi
call   1030 <expecti@plt>
mov    $0xffffffc8,%edi
mov    $0xc8,%esi
pop    %rax
jmp    1030 <expecti@plt>

LLVM IR (-O0):
%struct.s = type { i32, i32, [3 x i32] }
%struct.anon = type { %union.anon }
%union.anon = type { %struct.anon.0 }
%struct.anon.0 = type { i32, i32 }
%struct.anon.1 = type { [8 x i8] }
define void @test() {
%1 = alloca %struct.s
%2 = alloca %struct.anon
%3 = getelementptr inbounds %struct.s, %struct.s* %1, i32 0, i32 0
store i32 100, i32* %3
%4 = getelementptr inbounds %struct.s, %struct.s* %1, i32 0, i32 1
store i32 200, i32* %4
%5 = getelementptr inbounds %struct.s, %struct.s* %1, i32 0, i32 0
%6 = load i32, i32* %5
%7 = getelementptr inbounds %struct.s, %struct.s* %1, i32 0, i32 2
%8 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
store i32 %6, i32* %8
%9 = getelementptr inbounds %struct.s, %struct.s* %1, i32 0, i32 1
%10 = load i32, i32* %9
%11 = getelementptr inbounds %struct.s, %struct.s* %1, i32 0, i32 2
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %11, i64 0, i64 1
store i32 %10, i32* %12
%13 = getelementptr inbounds %struct.s, %struct.s* %1, i32 0, i32 2
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %13, i64 0, i64 1
%15 = load i32, i32* %14
%16 = getelementptr inbounds %struct.s, %struct.s* %1, i32 0, i32 2
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %16, i64 0, i64 2
store i32 %15, i32* %17
%18 = getelementptr inbounds %struct.s, %struct.s* %1, i32 0, i32 0
%19 = load i32, i32* %18
%20 = trunc i32 %19 to i8
%21 = call i32 @expecti(i8 signext %20, i32 100)
%22 = getelementptr inbounds %struct.s, %struct.s* %1, i32 0, i32 1
%23 = load i32, i32* %22
%24 = trunc i32 %23 to i8
%25 = call i32 @expecti(i8 signext %24, i32 200)
%26 = getelementptr inbounds %struct.s, %struct.s* %1, i32 0, i32 2
%27 = getelementptr inbounds [3 x i32], [3 x i32]* %26, i64 0, i64 0
%28 = load i32, i32* %27
%29 = trunc i32 %28 to i8
%30 = call i32 @expecti(i8 signext %29, i32 100)
%31 = getelementptr inbounds %struct.s, %struct.s* %1, i32 0, i32 2
%32 = getelementptr inbounds [3 x i32], [3 x i32]* %31, i64 0, i64 1
%33 = load i32, i32* %32
%34 = trunc i32 %33 to i8
%35 = call i32 @expecti(i8 signext %34, i32 200)
%36 = getelementptr inbounds %struct.s, %struct.s* %1, i32 0, i32 2
%37 = getelementptr inbounds [3 x i32], [3 x i32]* %36, i64 0, i64 2
%38 = load i32, i32* %37
%39 = trunc i32 %38 to i8
%40 = call i32 @expecti(i8 signext %39, i32 200)
%41 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 0
%42 = bitcast %union.anon* %41 to %struct.anon.0*
%43 = getelementptr inbounds %struct.anon.0, %struct.anon.0* %42, i32 0, i32 0
store i32 100, i32* %43
%44 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 0
%45 = bitcast %union.anon* %44 to %struct.anon.0*
%46 = getelementptr inbounds %struct.anon.0, %struct.anon.0* %45, i32 0, i32 1
store i32 200, i32* %46
%47 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 0
%48 = bitcast %union.anon* %47 to %struct.anon.1*
%49 = getelementptr inbounds %struct.anon.1, %struct.anon.1* %48, i32 0, i32 0
%50 = getelementptr inbounds [8 x i8], [8 x i8]* %49, i64 0, i64 0
%51 = load i8, i8* %50
%52 = call i32 @expecti(i8 signext %51, i32 100)
%53 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 0
%54 = bitcast %union.anon* %53 to %struct.anon.1*
%55 = getelementptr inbounds %struct.anon.1, %struct.anon.1* %54, i32 0, i32 0
%56 = getelementptr inbounds [8 x i8], [8 x i8]* %55, i64 0, i64 4
%57 = load i8, i8* %56
%58 = call i32 @expecti(i8 signext %57, i32 200)
ret void
}

LLVM IR (-O2):
define void @test() {
%1 = tail call i32 @expecti(i8 signext 100, i32 100)
%2 = tail call i32 @expecti(i8 signext -56, i32 200)
%3 = tail call i32 @expecti(i8 signext 100, i32 100)
%4 = tail call i32 @expecti(i8 signext -56, i32 200)
%5 = tail call i32 @expecti(i8 signext -56, i32 200)
%6 = tail call i32 @expecti(i8 signext 100, i32 100)
%7 = tail call i32 @expecti(i8 signext -56, i32 200)
ret void
}