#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*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *);
int main() {
  struct Article {
    long number;
    char name[32];
    long price;
  };
  struct Article sw = {102030L, "Heroes", 5995L};
  printf("sw.name: %s\n", sw.name);
  struct Article *pw = &sw;
  printf("pw->name: %s\n", pw->name);
  sprintf(pw->name, "New name");
  printf("pw->name: %s\n", pw->name);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x30,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rsi
add    $0x8,%rsi
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rsi
add    $0x8,%rsi
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%rdi
add    $0x8,%rdi
lea    0xebf(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x38(%rbp),%rsi
add    $0x8,%rsi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movups 0xf02(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movups 0xee6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movups 0xeca(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x8(%rsp),%rbx
lea    0xeea(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xee8(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
movabs $0x656d616e2077654e,%rax
61 6d 65
mov    %rax,0x8(%rsp)
movb   $0x0,0x10(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.Article = type { i64, [32 x i8], i64 }
@__const.main.sw = %struct.Article { i64 102030, [32 x i8] c"Heroes\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i64 5995 }
@.str = [13 x i8] c"sw.name: %s\0A\00"
@.str.1 = [14 x i8] c"pw->name: %s\0A\00"
@.str.2 = [9 x i8] c"New name\00"
define i32 @main() {
%1 = alloca %struct.Article
%2 = alloca %struct.Article*
%3 = bitcast %struct.Article* %1 to i8*
%4 = getelementptr inbounds %struct.Article, %struct.Article* %1, i32 0, i32 1
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%6 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %5)
store %struct.Article* %1, %struct.Article** %2
%7 = load %struct.Article*, %struct.Article** %2
%8 = getelementptr inbounds %struct.Article, %struct.Article* %7, i32 0, i32 1
%9 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = load %struct.Article*, %struct.Article** %2
%12 = getelementptr inbounds %struct.Article, %struct.Article* %11, i32 0, i32 1
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %12, i64 0, i64 0
%14 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%15 = load %struct.Article*, %struct.Article** %2
%16 = getelementptr inbounds %struct.Article, %struct.Article* %15, i32 0, i32 1
%17 = getelementptr inbounds [32 x i8], [32 x i8]* %16, i64 0, i64 0
%18 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %17)
ret i32 0
}

LLVM IR (-O2):
%struct.Article = type { i64, [32 x i8], i64 }
@__const.main.sw = %struct.Article { i64 102030, [32 x i8] c"Heroes\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i64 5995 }
@.str = [13 x i8] c"sw.name: %s\0A\00"
@.str.1 = [14 x i8] c"pw->name: %s\0A\00"
@.str.2 = [9 x i8] c"New name\00"
define i32 @main() {
%1 = alloca %struct.Article
%2 = bitcast %struct.Article* %1 to i8*
%3 = getelementptr inbounds %struct.Article, %struct.Article* %1, i64 0, i32 1, i64 0
%4 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%6 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret i32 0
}