#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 *, int, char *);
int /*<<< orphan*/ sprintf(char *, char *);
int main() {
  struct t_alumno {
    int legajo;
    char nombre[20];
  };
  struct t_alumno alumno1;
  struct t_alumno *p;
  alumno1.legajo = 100;
  sprintf(alumno1.nombre, "Agustín");
  printf("Alumno legajo %d nombre: %s\n", alumno1.legajo, alumno1.nombre);
  p = &alumno1;
  (*p).legajo = 200;
  printf("Alumno legajo %d nombre: %s\n", alumno1.legajo, alumno1.nombre);
  p->legajo = 300;
  printf("Alumno legajo %d nombre: %s\n", p->legajo, p->nombre);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
add    $0x4,%rdi
lea    0xebb(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x20(%rbp),%esi
lea    -0x20(%rbp),%rdx
add    $0x4,%rdx
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movl   $0xc8,(%rax)
mov    -0x20(%rbp),%esi
lea    -0x20(%rbp),%rdx
add    $0x4,%rdx
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
movl   $0x12c,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
mov    -0x28(%rbp),%rdx
add    $0x4,%rdx
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movl   $0x64,(%rsp)
lea    0x4(%rsp),%r14
movabs $0x6eadc37473756741,%rax
c3 ad 6e
mov    %rax,0x4(%rsp)
movb   $0x0,0xc(%rsp)
lea    0xecb(%rip),%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
movl   $0xc8,(%rsp)
mov    %rbx,%rdi
mov    $0xc8,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
movl   $0x12c,(%rsp)
mov    %rbx,%rdi
mov    $0x12c,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.t_alumno = type { i32, [20 x i8] }
@.str = [9 x i8] c"Agust\C3\ADn\00"
@.str.1 = [29 x i8] c"Alumno legajo %d nombre: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.t_alumno
%3 = alloca %struct.t_alumno*
store i32 0, i32* %1
%4 = getelementptr inbounds %struct.t_alumno, %struct.t_alumno* %2, i32 0, i32 0
store i32 100, i32* %4
%5 = getelementptr inbounds %struct.t_alumno, %struct.t_alumno* %2, i32 0, i32 1
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds %struct.t_alumno, %struct.t_alumno* %2, i32 0, i32 0
%9 = load i32, i32* %8
%10 = getelementptr inbounds %struct.t_alumno, %struct.t_alumno* %2, i32 0, i32 1
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %9, i8* %11)
store %struct.t_alumno* %2, %struct.t_alumno** %3
%13 = load %struct.t_alumno*, %struct.t_alumno** %3
%14 = getelementptr inbounds %struct.t_alumno, %struct.t_alumno* %13, i32 0, i32 0
store i32 200, i32* %14
%15 = getelementptr inbounds %struct.t_alumno, %struct.t_alumno* %2, i32 0, i32 0
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.t_alumno, %struct.t_alumno* %2, i32 0, i32 1
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %17, i64 0, i64 0
%19 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %16, i8* %18)
%20 = load %struct.t_alumno*, %struct.t_alumno** %3
%21 = getelementptr inbounds %struct.t_alumno, %struct.t_alumno* %20, i32 0, i32 0
store i32 300, i32* %21
%22 = load %struct.t_alumno*, %struct.t_alumno** %3
%23 = getelementptr inbounds %struct.t_alumno, %struct.t_alumno* %22, i32 0, i32 0
%24 = load i32, i32* %23
%25 = load %struct.t_alumno*, %struct.t_alumno** %3
%26 = getelementptr inbounds %struct.t_alumno, %struct.t_alumno* %25, i32 0, i32 1
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %26, i64 0, i64 0
%28 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %24, i8* %27)
ret i32 0
}

LLVM IR (-O2):
%struct.t_alumno = type { i32, [20 x i8] }
@.str = [9 x i8] c"Agust\C3\ADn\00"
@.str.1 = [29 x i8] c"Alumno legajo %d nombre: %s\0A\00"
define i32 @main() {
%1 = alloca %struct.t_alumno
%2 = bitcast %struct.t_alumno* %1 to i8*
%3 = getelementptr inbounds %struct.t_alumno, %struct.t_alumno* %1, i64 0, i32 0
store i32 100, i32* %3
%4 = getelementptr inbounds %struct.t_alumno, %struct.t_alumno* %1, i64 0, i32 1, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 100, i8* %4)
store i32 200, i32* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 200, i8* %4)
store i32 300, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 300, i8* %4)
ret i32 0
}