#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*/ clang_analyzer_eval(int);
void struct_as_array() {
  struct simple {
    int x;
    int y;
  };
  struct simple a;
  struct simple *p = &a;
  p->x = 5;
  clang_analyzer_eval(a.x == 5);
  clang_analyzer_eval(p[0].x == 5);
  p[0].y = 5;
  clang_analyzer_eval(a.y == 5);
  clang_analyzer_eval(p->y == 5);
}


x86 assembly (clang, -O0):
<struct_as_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x5,(%rax)
cmpl   $0x5,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x5,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x10(%rbp),%rax
movl   $0x5,0x4(%rax)
cmpl   $0x5,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x5,0x4(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<struct_as_array>:
push   %rax
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
pop    %rax
jmp    1030 <clang_analyzer_eval@plt>

LLVM IR (-O0):
%struct.simple = type { i32, i32 }
define void @struct_as_array() {
%1 = alloca %struct.simple
%2 = alloca %struct.simple*
store %struct.simple* %1, %struct.simple** %2
%3 = load %struct.simple*, %struct.simple** %2
%4 = getelementptr inbounds %struct.simple, %struct.simple* %3, i32 0, i32 0
store i32 5, i32* %4
%5 = getelementptr inbounds %struct.simple, %struct.simple* %1, i32 0, i32 0
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 5
%8 = zext i1 %7 to i32
%9 = call i32 @clang_analyzer_eval(i32 %8)
%10 = load %struct.simple*, %struct.simple** %2
%11 = getelementptr inbounds %struct.simple, %struct.simple* %10, i64 0
%12 = getelementptr inbounds %struct.simple, %struct.simple* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 5
%15 = zext i1 %14 to i32
%16 = call i32 @clang_analyzer_eval(i32 %15)
%17 = load %struct.simple*, %struct.simple** %2
%18 = getelementptr inbounds %struct.simple, %struct.simple* %17, i64 0
%19 = getelementptr inbounds %struct.simple, %struct.simple* %18, i32 0, i32 1
store i32 5, i32* %19
%20 = getelementptr inbounds %struct.simple, %struct.simple* %1, i32 0, i32 1
%21 = load i32, i32* %20
%22 = icmp eq i32 %21, 5
%23 = zext i1 %22 to i32
%24 = call i32 @clang_analyzer_eval(i32 %23)
%25 = load %struct.simple*, %struct.simple** %2
%26 = getelementptr inbounds %struct.simple, %struct.simple* %25, i32 0, i32 1
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, 5
%29 = zext i1 %28 to i32
%30 = call i32 @clang_analyzer_eval(i32 %29)
ret void
}

LLVM IR (-O2):
%struct.simple = type { i32, i32 }
define void @struct_as_array() {
%1 = tail call i32 @clang_analyzer_eval(i32 1)
%2 = tail call i32 @clang_analyzer_eval(i32 1)
%3 = tail call i32 @clang_analyzer_eval(i32 1)
%4 = tail call i32 @clang_analyzer_eval(i32 1)
ret void
}