#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 */
struct shmid_ds {
  int dummy;
};
struct shm_info {
  int shm_tot;
  int shm_rss;
  int shm_swp;
  int used_ids;
  int swap_attempts;
  int swap_successes;
};

/* Variables and functions */
int /*<<< orphan*/ memset(struct shm_info *, int /*<<< orphan*/, int);
int shmctl(int shmid, int cmd, struct shmid_ds *buf) {
  struct shm_info *i = (struct shm_info *)buf;
  memset(i, 0, sizeof(*i));
  i->shm_tot = 9;
  i->shm_rss = 100;
  i->shm_swp = 9000;
  i->used_ids = 2;
  i->swap_attempts = 4;
  i->swap_successes = 3;
  return 0;
}


x86 assembly (clang, -O0):
<shmctl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1030 <memset@plt>
mov    -0x18(%rbp),%rax
movl   $0x9,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x64,0x4(%rax)
mov    -0x18(%rbp),%rax
movl   $0x2328,0x8(%rax)
mov    -0x18(%rbp),%rax
movl   $0x2,0xc(%rax)
mov    -0x18(%rbp),%rax
movl   $0x4,0x10(%rax)
mov    -0x18(%rbp),%rax
movl   $0x3,0x14(%rax)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shmctl>:
push   %rbx
mov    %rdx,%rbx
mov    %rdx,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1030 <memset@plt>
movaps 0xed6(%rip),%xmm0
movups %xmm0,(%rbx)
movabs $0x300000004,%rax
mov    %rax,0x10(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.shmid_ds = type { i32 }
%struct.shm_info = type { i32, i32, i32, i32, i32, i32 }
define i32 @shmctl(i32 %0, i32 %1, %struct.shmid_ds* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.shmid_ds*
%7 = alloca %struct.shm_info*
store i32 %0, i32* %4
store i32 %1, i32* %5
store %struct.shmid_ds* %2, %struct.shmid_ds** %6
%8 = load %struct.shmid_ds*, %struct.shmid_ds** %6
%9 = bitcast %struct.shmid_ds* %8 to %struct.shm_info*
store %struct.shm_info* %9, %struct.shm_info** %7
%10 = load %struct.shm_info*, %struct.shm_info** %7
%11 = call i32 @memset(%struct.shm_info* %10, i32 0, i32 24)
%12 = load %struct.shm_info*, %struct.shm_info** %7
%13 = getelementptr inbounds %struct.shm_info, %struct.shm_info* %12, i32 0, i32 0
store i32 9, i32* %13
%14 = load %struct.shm_info*, %struct.shm_info** %7
%15 = getelementptr inbounds %struct.shm_info, %struct.shm_info* %14, i32 0, i32 1
store i32 100, i32* %15
%16 = load %struct.shm_info*, %struct.shm_info** %7
%17 = getelementptr inbounds %struct.shm_info, %struct.shm_info* %16, i32 0, i32 2
store i32 9000, i32* %17
%18 = load %struct.shm_info*, %struct.shm_info** %7
%19 = getelementptr inbounds %struct.shm_info, %struct.shm_info* %18, i32 0, i32 3
store i32 2, i32* %19
%20 = load %struct.shm_info*, %struct.shm_info** %7
%21 = getelementptr inbounds %struct.shm_info, %struct.shm_info* %20, i32 0, i32 4
store i32 4, i32* %21
%22 = load %struct.shm_info*, %struct.shm_info** %7
%23 = getelementptr inbounds %struct.shm_info, %struct.shm_info* %22, i32 0, i32 5
store i32 3, i32* %23
ret i32 0
}

LLVM IR (-O2):
%struct.shmid_ds = type { i32 }
%struct.shm_info = type { i32, i32, i32, i32, i32, i32 }
define i32 @shmctl(i32 %0, i32 %1, %struct.shmid_ds* %2) {
%4 = bitcast %struct.shmid_ds* %2 to %struct.shm_info*
%5 = tail call i32 @memset(%struct.shm_info* %4, i32 0, i32 24)
%6 = bitcast %struct.shmid_ds* %2 to <4 x i32>*
store <4 x i32> <i32 9, i32 100, i32 9000, i32 2>, <4 x i32>* %6
%7 = getelementptr inbounds %struct.shmid_ds, %struct.shmid_ds* %2, i64 4, i32 0
store i32 4, i32* %7
%8 = getelementptr inbounds %struct.shmid_ds, %struct.shmid_ds* %2, i64 5, i32 0
store i32 3, i32* %8
ret i32 0
}