#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 */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  char *str;
};
struct TYPE_3__ {
  char *str;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void main() {
  struct s1 {
    char *str;
    struct s1 *ptr;
  };
  static struct s1 arr[] = {
      {"Hyderabad", arr + 1}, {"Bangalore", arr + 2}, {"Delhi", arr}};
  struct s1 *p[3];
  int i;
  for (i = 0; i <= 2; i++)
    p[i] = arr[i].ptr;
  printf("%s  ", (*p)->str);
  printf("%s ", (++*p)->str);
  printf("%s ", ((*p)++)->str);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jg     1156 <main+0x46>
movslq -0x24(%rbp),%rcx
lea    0x2efc(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%rcx
movslq -0x24(%rbp),%rax
mov    %rcx,-0x20(%rbp,%rax,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    111f <main+0xf>
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x10,%rcx
mov    %rcx,-0x20(%rbp)
mov    0x10(%rax),%rsi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x10,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%rsi
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2f1d(%rip),%rbx
mov    (%rbx),%rsi
lea    0xef5(%rip),%rdi
call   1030 <printf@plt>
mov    0x10(%rbx),%rsi
lea    0xeea(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x10(%rbx),%rsi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.s1 = type { i8*, %struct.s1* }
@main.arr = internal global [3 x %struct.s1] [%struct.s1 { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), %struct.s1* bitcast (i8* getelementptr (i8, i8* bitcast ([3 x %struct.s1]* @main.arr to i8*), i64 16) to %struct.s1*) }, %struct.s1 { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i32 0, i32 0), %struct.s1* bitcast (i8* getelementptr (i8, i8* bitcast ([3 x %struct.s1]* @main.arr to i8*), i64 32) to %struct.s1*) }, %struct.s1 { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), %struct.s1* getelementptr inbounds ([3 x %struct.s1], [3 x %struct.s1]* @main.arr, i32 0, i32 0) }]
@.str = [10 x i8] c"Hyderabad\00"
@.str.1 = [10 x i8] c"Bangalore\00"
@.str.2 = [6 x i8] c"Delhi\00"
@.str.3 = [5 x i8] c"%s \00"
@.str.4 = [4 x i8] c"%s \00"
define void @main() {
%1 = alloca [3 x %struct.s1*]
%2 = alloca i32
store i32 0, i32* %2
br label %3
3: ; preds = %15, %0
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 2
br i1 %5, label %6, label %18
6: ; preds = %3
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [3 x %struct.s1], [3 x %struct.s1]* @main.arr, i64 0, i64 %8
%10 = getelementptr inbounds %struct.s1, %struct.s1* %9, i32 0, i32 1
%11 = load %struct.s1*, %struct.s1** %10
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [3 x %struct.s1*], [3 x %struct.s1*]* %1, i64 0, i64 %13
store %struct.s1* %11, %struct.s1** %14
br label %15
15: ; preds = %6
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %3
18: ; preds = %3
%19 = getelementptr inbounds [3 x %struct.s1*], [3 x %struct.s1*]* %1, i64 0, i64 0
%20 = load %struct.s1*, %struct.s1** %19
%21 = getelementptr inbounds %struct.s1, %struct.s1* %20, i32 0, i32 0
%22 = load i8*, i8** %21
%23 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [3 x %struct.s1*], [3 x %struct.s1*]* %1, i64 0, i64 0
%25 = load %struct.s1*, %struct.s1** %24
%26 = getelementptr inbounds %struct.s1, %struct.s1* %25, i32 1
store %struct.s1* %26, %struct.s1** %24
%27 = getelementptr inbounds %struct.s1, %struct.s1* %26, i32 0, i32 0
%28 = load i8*, i8** %27
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %28)
%30 = getelementptr inbounds [3 x %struct.s1*], [3 x %struct.s1*]* %1, i64 0, i64 0
%31 = load %struct.s1*, %struct.s1** %30
%32 = getelementptr inbounds %struct.s1, %struct.s1* %31, i32 1
store %struct.s1* %32, %struct.s1** %30
%33 = getelementptr inbounds %struct.s1, %struct.s1* %31, i32 0, i32 0
%34 = load i8*, i8** %33
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %34)
ret void
}

LLVM IR (-O2):
%struct.s1 = type { i8*, %struct.s1* }
@main.arr = internal global [3 x %struct.s1] [%struct.s1 { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), %struct.s1* bitcast (i8* getelementptr (i8, i8* bitcast ([3 x %struct.s1]* @main.arr to i8*), i64 16) to %struct.s1*) }, %struct.s1 { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i32 0, i32 0), %struct.s1* bitcast (i8* getelementptr (i8, i8* bitcast ([3 x %struct.s1]* @main.arr to i8*), i64 32) to %struct.s1*) }, %struct.s1 { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), %struct.s1* getelementptr inbounds ([3 x %struct.s1], [3 x %struct.s1]* @main.arr, i32 0, i32 0) }]
@.str = [10 x i8] c"Hyderabad\00"
@.str.1 = [10 x i8] c"Bangalore\00"
@.str.2 = [6 x i8] c"Delhi\00"
@.str.3 = [5 x i8] c"%s \00"
@.str.4 = [4 x i8] c"%s \00"
define void @main() {
%1 = load %struct.s1*, %struct.s1** getelementptr inbounds ([3 x %struct.s1], [3 x %struct.s1]* @main.arr, i64 0, i64 0, i32 1)
%2 = getelementptr inbounds %struct.s1, %struct.s1* %1, i64 0, i32 0
%3 = load i8*, i8** %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds %struct.s1, %struct.s1* %1, i64 1, i32 0
%6 = load i8*, i8** %5
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %5
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %8)
ret void
}