#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*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
char **q;
char ***wchar_t(char *);
int main() {
  char(*p)[4] = &("bar");
  wchar_t(*q)[4] = &(L"foO");
  if ((*p)[1] != 'a') {
    printf("Error %d\n", (int)1);
    exit(1);
  };
  if ((*q)[1] != 'o') {
    printf("Error %d\n", (int)2);
    exit(2);
  };
  {
    printf("Success\n");
    exit(0);
  };
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e97(%rip),%rax
mov    (%rax),%rax
mov    (%rax),%rdi
call   1050 <wchar_t@plt>
lea    0xeb5(%rip),%rcx
mov    %rcx,0x20(%rax)
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x61,%eax
je     1195 <main+0x65>
lea    0xe85(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%rax
mov    (%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x6f,%eax
je     11cc <main+0x9c>
lea    0xe4e(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ea0(%rip),%rbx
mov    (%rbx),%rax
mov    (%rax),%rdi
call   1060 <wchar_t@plt>
lea    0xea6(%rip),%rcx
mov    %rcx,0x20(%rax)
mov    (%rbx),%rax
mov    (%rax),%rax
cmpb   $0x6f,0x1(%rax)
jne    117d <main+0x3d>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>
lea    0xe8c(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"bar\00"
@.str.1 = [4 x i32] [i32 102, i32 111, i32 79, i32 0]
@q = global i8** null
@.str.2 = [10 x i8] c"Error %d\0A\00"
@.str.3 = [9 x i8] c"Success\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]*
store i32 0, i32* %1
store [4 x i8]* @.str, [4 x i8]** %2
%3 = load i8**, i8*** @q
%4 = load i8*, i8** %3
%5 = call i8*** @wchar_t(i8* %4)
%6 = getelementptr inbounds i8**, i8*** %5, i64 4
store i8** bitcast ([4 x i32]* @.str.1 to i8**), i8*** %6
%7 = load [4 x i8]*, [4 x i8]** %2
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 1
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 97
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 1)
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %0
%16 = load i8**, i8*** @q
%17 = load i8*, i8** %16
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 111
br i1 %21, label %22, label %25
22: ; preds = %15
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 2)
%24 = call i32 @exit(i32 2)
unreachable
25: ; preds = %15
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%27 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str.1 = [4 x i32] [i32 102, i32 111, i32 79, i32 0]
@q = global i8** null
@.str.2 = [10 x i8] c"Error %d\0A\00"
@str = [8 x i8] c"Success\00"
define i32 @main() {
%1 = load i8**, i8*** @q
%2 = load i8*, i8** %1
%3 = tail call i8*** @wchar_t(i8* %2)
%4 = getelementptr inbounds i8**, i8*** %3, i64 4
store i8** bitcast ([4 x i32]* @.str.1 to i8**), i8*** %4
%5 = load i8**, i8*** @q
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 111
br i1 %9, label %13, label %10
10: ; preds = %0
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 2)
%12 = tail call i32 @exit(i32 2)
unreachable
13: ; preds = %0
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%15 = tail call i32 @exit(i32 0)
unreachable
}