int struct1(void) {
  printf("----- START %s\n", __FUNCTION__);
  static struct s1 { char c[4], *s; } s1 = {"abc", "def"};
  static struct s2 {
    char *cp;
    struct s1 ss1;
  } s2 = {"ghi", {"jkl", "mno"}};
  printf("s1.c[0]"
         "= %"
         "c"
         "\t",
         (s1.c[0])),
      printf("*s1.s"
             "= %"
             "c"
             "\t",
             (*s1.s)),
      putchar('\n');
  printf("s1.c"
         "= %"
         "s"
         "\t",
         (s1.c)),
      printf("s1.s"
             "= %"
             "s"
             "\t",
             (s1.s)),
      putchar('\n');
  printf("** look at %s:%d **\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/reslaurentii/sandbox/refs/heads/master/src/"
         "structs.c",
         29);
  printf("s2.cp"
         "= %"
         "s"
         "\t",
         (s2.cp)),
      printf("s2.ss1.s"
             "= %"
             "s"
             "\t",
             (s2.ss1.s)),
      putchar('\n');
  printf("++s2.cp"
         "= %"
         "s"
         "\t",
         (++s2.cp)),
      printf("++s2.ss1.s"
             "= %"
             "s"
             "\t",
             (++s2.ss1.s)),
      putchar('\n');
  printf("** look at %s:%d **\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/reslaurentii/sandbox/refs/heads/master/src/"
         "structs.c",
         33);
  printf("----- END %s\n", __FUNCTION__);
  return 0;
}


x86 assembly (clang, -O0):
<struct1>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xede(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
movsbl 0x2ef0(%rip),%esi
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2ee3(%rip),%rax
movsbl (%rax),%esi
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xa,%edi
mov    $0x0,%al
call   1030 <putchar@plt>
lea    0xec3(%rip),%rdi
lea    0x2eb0(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2eaa(%rip),%rsi
lea    0xf68(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xa,%edi
mov    $0x0,%al
call   1030 <putchar@plt>
lea    0xe97(%rip),%rdi
lea    0xea5(%rip),%rsi
mov    $0x1d,%edx
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e77(%rip),%rsi
lea    0xf1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e72(%rip),%rsi
lea    0xf14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xa,%edi
mov    $0x0,%al
call   1030 <putchar@plt>
mov    0x2e41(%rip),%rsi
add    $0x1,%rsi
mov    %rsi,0x2e36(%rip)
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e31(%rip),%rsi
add    $0x1,%rsi
mov    %rsi,0x2e26(%rip)
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xa,%edi
mov    $0x0,%al
call   1030 <putchar@plt>
lea    0xdfb(%rip),%rdi
lea    0xe09(%rip),%rsi
mov    $0x21,%edx
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea2(%rip),%rdi
lea    0xda4(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<struct1>:
push   %r15
push   %r14
push   %rbx
lea    0xed4(%rip),%rdi
lea    0xedd(%rip),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x2eec(%rip),%rbx
movsbl 0x2ee5(%rip),%esi
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2ed8(%rip),%rax
movsbl (%rax),%esi
lea    0xec7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
xor    %eax,%eax
call   1030 <putchar@plt>
lea    0xeb8(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2ea3(%rip),%rsi
lea    0xf61(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
xor    %eax,%eax
call   1030 <putchar@plt>
lea    0xe90(%rip),%rbx
lea    0xe9e(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e6a(%rip),%rsi
lea    0xf0f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e5d(%rip),%rsi
lea    0xf07(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
xor    %eax,%eax
call   1030 <putchar@plt>
mov    0x2e34(%rip),%rsi
add    $0x1,%rsi
mov    %rsi,0x2e29(%rip)
lea    0xecc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e1c(%rip),%rsi
add    $0x1,%rsi
mov    %rsi,0x2e11(%rip)
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
xor    %eax,%eax
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x21,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9d(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.s1 = type { [4 x i8], i8* }
%struct.s2 = type { i8*, %struct.s1 }
@.str = [16 x i8] c"----- START %s\0A\00"
@__FUNCTION__.struct1 = [8 x i8] c"struct1\00"
@struct1.s1 = internal global %struct.s1 { [4 x i8] c"abc\00", i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0) }
@.str.1 = [4 x i8] c"def\00"
@struct1.s2 = internal global %struct.s2 { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), %struct.s1 { [4 x i8] c"jkl\00", i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0) } }
@.str.2 = [4 x i8] c"ghi\00"
@.str.3 = [4 x i8] c"mno\00"
@.str.4 = [13 x i8] c"s1.c[0]= %c\09\00"
@.str.5 = [11 x i8] c"*s1.s= %c\09\00"
@.str.6 = [10 x i8] c"s1.c= %s\09\00"
@.str.7 = [10 x i8] c"s1.s= %s\09\00"
@.str.8 = [21 x i8] c"** look at %s:%d **\0A\00"
@.str.9 = [143 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/reslaurentii/sandbox/refs/heads/master/src/structs.c\00"
@.str.10 = [11 x i8] c"s2.cp= %s\09\00"
@.str.11 = [14 x i8] c"s2.ss1.s= %s\09\00"
@.str.12 = [13 x i8] c"++s2.cp= %s\09\00"
@.str.13 = [16 x i8] c"++s2.ss1.s= %s\09\00"
@.str.14 = [14 x i8] c"----- END %s\0A\00"
define i32 @struct1() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__FUNCTION__.struct1, i64 0, i64 0))
%2 = load i8, i8* getelementptr inbounds (%struct.s1, %struct.s1* @struct1.s1, i32 0, i32 0, i64 0)
%3 = sext i8 %2 to i32
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %3)
%5 = load i8*, i8** getelementptr inbounds (%struct.s1, %struct.s1* @struct1.s1, i32 0, i32 1)
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %7)
%9 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 10)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds (%struct.s1, %struct.s1* @struct1.s1, i32 0, i32 0, i64 0))
%11 = load i8*, i8** getelementptr inbounds (%struct.s1, %struct.s1* @struct1.s1, i32 0, i32 1)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %11)
%13 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 10)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.9, i64 0, i64 0), i32 29)
%15 = load i8*, i8** getelementptr inbounds (%struct.s2, %struct.s2* @struct1.s2, i32 0, i32 0)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8* %15)
%17 = load i8*, i8** getelementptr inbounds (%struct.s2, %struct.s2* @struct1.s2, i32 0, i32 1, i32 1)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8* %17)
%19 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 10)
%20 = load i8*, i8** getelementptr inbounds (%struct.s2, %struct.s2* @struct1.s2, i32 0, i32 0)
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** getelementptr inbounds (%struct.s2, %struct.s2* @struct1.s2, i32 0, i32 0)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i8* %21)
%23 = load i8*, i8** getelementptr inbounds (%struct.s2, %struct.s2* @struct1.s2, i32 0, i32 1, i32 1)
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** getelementptr inbounds (%struct.s2, %struct.s2* @struct1.s2, i32 0, i32 1, i32 1)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i8* %24)
%26 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 10)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.9, i64 0, i64 0), i32 33)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__FUNCTION__.struct1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.s1 = type { [4 x i8], i8* }
@.str = [16 x i8] c"----- START %s\0A\00"
@__FUNCTION__.struct1 = [8 x i8] c"struct1\00"
@struct1.s1 = internal global %struct.s1 { [4 x i8] c"abc\00", i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0) }
@.str.1 = [4 x i8] c"def\00"
@struct1.s2.0 = internal unnamed_addr global i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
@struct1.s2.1 = internal unnamed_addr global i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
@.str.2 = [4 x i8] c"ghi\00"
@.str.3 = [4 x i8] c"mno\00"
@.str.4 = [13 x i8] c"s1.c[0]= %c\09\00"
@.str.5 = [11 x i8] c"*s1.s= %c\09\00"
@.str.6 = [10 x i8] c"s1.c= %s\09\00"
@.str.7 = [10 x i8] c"s1.s= %s\09\00"
@.str.8 = [21 x i8] c"** look at %s:%d **\0A\00"
@.str.9 = [143 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/reslaurentii/sandbox/refs/heads/master/src/structs.c\00"
@.str.10 = [11 x i8] c"s2.cp= %s\09\00"
@.str.11 = [14 x i8] c"s2.ss1.s= %s\09\00"
@.str.12 = [13 x i8] c"++s2.cp= %s\09\00"
@.str.13 = [16 x i8] c"++s2.ss1.s= %s\09\00"
@.str.14 = [14 x i8] c"----- END %s\0A\00"
define i32 @struct1() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__FUNCTION__.struct1, i64 0, i64 0))
%2 = load i8, i8* getelementptr inbounds (%struct.s1, %struct.s1* @struct1.s1, i64 0, i32 0, i64 0)
%3 = sext i8 %2 to i32
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %3)
%5 = load i8*, i8** getelementptr inbounds (%struct.s1, %struct.s1* @struct1.s1, i64 0, i32 1)
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %7)
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 10)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds (%struct.s1, %struct.s1* @struct1.s1, i64 0, i32 0, i64 0))
%11 = load i8*, i8** getelementptr inbounds (%struct.s1, %struct.s1* @struct1.s1, i64 0, i32 1)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %11)
%13 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 10)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.9, i64 0, i64 0), i32 29)
%15 = load i8*, i8** @struct1.s2.0
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8* %15)
%17 = load i8*, i8** @struct1.s2.1
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8* %17)
%19 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 10)
%20 = load i8*, i8** @struct1.s2.0
%21 = getelementptr inbounds i8, i8* %20, i64 1
store i8* %21, i8** @struct1.s2.0
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i8* %21)
%23 = load i8*, i8** @struct1.s2.1
%24 = getelementptr inbounds i8, i8* %23, i64 1
store i8* %24, i8** @struct1.s2.1
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i8* %24)
%26 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 10)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.9, i64 0, i64 0), i32 33)
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__FUNCTION__.struct1, i64 0, i64 0))
ret i32 0
}