int main() {
  struct l {
    struct l **next;
  } s[4];
  struct l *a;
  struct l *p[4];
  struct l *old;
  p[0] = s;
  p[0]->next = &p[0];
  old = (*p[0]->next);
  a = ((*p[0]->next) += 1);
  if (old + 1 != a) {
    printf("Error %d\n", (int)1);
    exit(1);
  };
  {
    printf("Success\n");
    exit(0);
  };
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
lea    -0x60(%rbp),%rcx
mov    -0x60(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x60(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rax
mov    %rax,-0x68(%rbp)
mov    -0x60(%rbp),%rax
mov    (%rax),%rcx
mov    (%rcx),%rax
add    $0x8,%rax
mov    %rax,(%rcx)
mov    %rax,-0x38(%rbp)
mov    -0x68(%rbp),%rax
add    $0x8,%rax
cmp    -0x38(%rbp),%rax
je     1194 <main+0x74>
lea    0xe82(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
mov    %rsp,%rax
mov    %rax,0x20(%rsp)
lea    0x28(%rsp),%rax
mov    %rax,(%rsp)
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
%struct.l = type { %struct.l** }
@.str = [10 x i8] c"Error %d\0A\00"
@.str.1 = [9 x i8] c"Success\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x %struct.l]
%3 = alloca %struct.l*
%4 = alloca [4 x %struct.l*]
%5 = alloca %struct.l*
store i32 0, i32* %1
%6 = getelementptr inbounds [4 x %struct.l], [4 x %struct.l]* %2, i64 0, i64 0
%7 = getelementptr inbounds [4 x %struct.l*], [4 x %struct.l*]* %4, i64 0, i64 0
store %struct.l* %6, %struct.l** %7
%8 = getelementptr inbounds [4 x %struct.l*], [4 x %struct.l*]* %4, i64 0, i64 0
%9 = getelementptr inbounds [4 x %struct.l*], [4 x %struct.l*]* %4, i64 0, i64 0
%10 = load %struct.l*, %struct.l** %9
%11 = getelementptr inbounds %struct.l, %struct.l* %10, i32 0, i32 0
store %struct.l** %8, %struct.l*** %11
%12 = getelementptr inbounds [4 x %struct.l*], [4 x %struct.l*]* %4, i64 0, i64 0
%13 = load %struct.l*, %struct.l** %12
%14 = getelementptr inbounds %struct.l, %struct.l* %13, i32 0, i32 0
%15 = load %struct.l**, %struct.l*** %14
%16 = load %struct.l*, %struct.l** %15
store %struct.l* %16, %struct.l** %5
%17 = getelementptr inbounds [4 x %struct.l*], [4 x %struct.l*]* %4, i64 0, i64 0
%18 = load %struct.l*, %struct.l** %17
%19 = getelementptr inbounds %struct.l, %struct.l* %18, i32 0, i32 0
%20 = load %struct.l**, %struct.l*** %19
%21 = load %struct.l*, %struct.l** %20
%22 = getelementptr inbounds %struct.l, %struct.l* %21, i64 1
store %struct.l* %22, %struct.l** %20
store %struct.l* %22, %struct.l** %3
%23 = load %struct.l*, %struct.l** %5
%24 = getelementptr inbounds %struct.l, %struct.l* %23, i64 1
%25 = load %struct.l*, %struct.l** %3
%26 = icmp ne %struct.l* %24, %25
br i1 %26, label %27, label %29
27: ; preds = %0
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1)
unreachable
29: ; preds = %0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
unreachable
}

LLVM IR (-O2):
%struct.l = type { %struct.l** }
@str = [8 x i8] c"Success\00"
define i32 @main() {
%1 = alloca [4 x %struct.l]
%2 = alloca [4 x %struct.l*]
%3 = bitcast [4 x %struct.l]* %1 to i8*
%4 = bitcast [4 x %struct.l*]* %2 to i8*
%5 = getelementptr inbounds [4 x %struct.l*], [4 x %struct.l*]* %2, i64 0, i64 0
%6 = getelementptr inbounds [4 x %struct.l], [4 x %struct.l]* %1, i64 0, i64 0, i32 0
store %struct.l** %5, %struct.l*** %6
%7 = getelementptr inbounds [4 x %struct.l], [4 x %struct.l]* %1, i64 0, i64 1
store %struct.l* %7, %struct.l** %5
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
unreachable
}