#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 */
typedef int /*<<< orphan*/ mem;

/* Variables and functions */
int /*<<< orphan*/ crear_cmsj();
int msgget(int, int /*<<< orphan*/);
int /*<<< orphan*/ msgsnd(int, struct mensaje *, int, int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(char *, char *);
int mainescq() {
  crear_cmsj();
  int msgid;
  msgid = msgget(0xA, 0);
  struct mensaje {
    long tipo;
    char mensaje[20];
  };
  struct mensaje mem;
  mem.tipo = 1;
  strcpy(mem.mensaje, "hola\0");
  msgsnd(msgid, &mem, sizeof(mem) - sizeof(long), 0);
}


x86 assembly (clang, -O0):
<mainescq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x0,%al
call   1050 <crear_cmsj@plt>
mov    $0xa,%edi
xor    %esi,%esi
call   1030 <msgget@plt>
mov    %eax,-0x8(%rbp)
movq   $0x1,-0x28(%rbp)
lea    -0x28(%rbp),%rdi
add    $0x8,%rdi
lea    0xe8b(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x8(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x18,%edx
xor    %ecx,%ecx
call   1060 <msgsnd@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mainescq>:
push   %rbx
sub    $0x20,%rsp
xor    %eax,%eax
call   1050 <crear_cmsj@plt>
mov    $0xa,%edi
xor    %esi,%esi
call   1030 <msgget@plt>
mov    %eax,%ebx
movq   $0x1,(%rsp)
lea    0x8(%rsp),%rdi
lea    0xe92(%rip),%rsi
call   1040 <strcpy@plt>
mov    %rsp,%rsi
mov    %ebx,%edi
mov    $0x18,%edx
xor    %ecx,%ecx
call   1060 <msgsnd@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.mensaje = type { i64, [20 x i8] }
%struct.mensaje.0 = type opaque
@.str = [6 x i8] c"hola\00\00"
define i32 @mainescq() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.mensaje
%4 = call i32 (...) @crear_cmsj()
%5 = call i32 @msgget(i32 10, i32 0)
store i32 %5, i32* %2
%6 = getelementptr inbounds %struct.mensaje, %struct.mensaje* %3, i32 0, i32 0
store i64 1, i64* %6
%7 = getelementptr inbounds %struct.mensaje, %struct.mensaje* %3, i32 0, i32 1
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%9 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* %2
%11 = bitcast %struct.mensaje* %3 to %struct.mensaje.0*
%12 = call i32 @msgsnd(i32 %10, %struct.mensaje.0* %11, i32 24, i32 0)
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
%struct.mensaje = type { i64, [20 x i8] }
%struct.mensaje.0 = type opaque
@.str = [6 x i8] c"hola\00\00"
define i32 @mainescq() {
%1 = alloca %struct.mensaje
%2 = tail call i32 (...) @crear_cmsj()
%3 = tail call i32 @msgget(i32 10, i32 0)
%4 = bitcast %struct.mensaje* %1 to i8*
%5 = getelementptr inbounds %struct.mensaje, %struct.mensaje* %1, i64 0, i32 0
store i64 1, i64* %5
%6 = getelementptr inbounds %struct.mensaje, %struct.mensaje* %1, i64 0, i32 1, i64 0
%7 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = bitcast %struct.mensaje* %1 to %struct.mensaje.0*
%9 = call i32 @msgsnd(i32 %3, %struct.mensaje.0* %8, i32 24, i32 0)
ret i32 undef
}