#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 ipc_perm {
  int uid;
  int gid;
  int cuid;
  int cgid;
  int mode;
  int __key;
  int __seq;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int, int);
void dump_perm(struct ipc_perm *perm) {
  printf("perm: \n"
         "   uid: %d\n"
         "   gid: %d\n"
         "   create uid: %d\n"
         "   create gid: %d\n"
         "   mode: 0x%08x\n"
         "   key: 0x%08x\n"
         "   seq: %d\n",
         perm->uid, perm->gid, perm->cuid, perm->cgid, perm->mode, perm->__key,
         perm->__seq);
}


x86 assembly (clang, -O0):
<dump_perm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%r8d
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%r9d
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%r10d
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%eax
lea    0xeaa(%rip),%rdi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_perm>:
push   %rax
mov    (%rdi),%esi
mov    0x4(%rdi),%edx
mov    0x8(%rdi),%ecx
mov    0xc(%rdi),%r8d
mov    0x10(%rdi),%r9d
mov    0x14(%rdi),%r10d
mov    0x18(%rdi),%eax
lea    0xed1(%rip),%rdi
push   %rax
push   %r10
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rax
ret

LLVM IR (-O0):
%struct.ipc_perm = type { i32, i32, i32, i32, i32, i32, i32 }
@.str = [108 x i8] c"perm: \0A uid: %d\0A gid: %d\0A create uid: %d\0A create gid: %d\0A mode: 0x%08x\0A key: 0x%08x\0A seq: %d\0A\00"
define void @dump_perm(%struct.ipc_perm* %0) {
%2 = alloca %struct.ipc_perm*
store %struct.ipc_perm* %0, %struct.ipc_perm** %2
%3 = load %struct.ipc_perm*, %struct.ipc_perm** %2
%4 = getelementptr inbounds %struct.ipc_perm, %struct.ipc_perm* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = load %struct.ipc_perm*, %struct.ipc_perm** %2
%7 = getelementptr inbounds %struct.ipc_perm, %struct.ipc_perm* %6, i32 0, i32 1
%8 = load i32, i32* %7
%9 = load %struct.ipc_perm*, %struct.ipc_perm** %2
%10 = getelementptr inbounds %struct.ipc_perm, %struct.ipc_perm* %9, i32 0, i32 2
%11 = load i32, i32* %10
%12 = load %struct.ipc_perm*, %struct.ipc_perm** %2
%13 = getelementptr inbounds %struct.ipc_perm, %struct.ipc_perm* %12, i32 0, i32 3
%14 = load i32, i32* %13
%15 = load %struct.ipc_perm*, %struct.ipc_perm** %2
%16 = getelementptr inbounds %struct.ipc_perm, %struct.ipc_perm* %15, i32 0, i32 4
%17 = load i32, i32* %16
%18 = load %struct.ipc_perm*, %struct.ipc_perm** %2
%19 = getelementptr inbounds %struct.ipc_perm, %struct.ipc_perm* %18, i32 0, i32 5
%20 = load i32, i32* %19
%21 = load %struct.ipc_perm*, %struct.ipc_perm** %2
%22 = getelementptr inbounds %struct.ipc_perm, %struct.ipc_perm* %21, i32 0, i32 6
%23 = load i32, i32* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([108 x i8], [108 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %8, i32 %11, i32 %14, i32 %17, i32 %20, i32 %23)
ret void
}

LLVM IR (-O2):
%struct.ipc_perm = type { i32, i32, i32, i32, i32, i32, i32 }
@.str = [108 x i8] c"perm: \0A uid: %d\0A gid: %d\0A create uid: %d\0A create gid: %d\0A mode: 0x%08x\0A key: 0x%08x\0A seq: %d\0A\00"
define void @dump_perm(%struct.ipc_perm* nocapture %0) {
%2 = getelementptr inbounds %struct.ipc_perm, %struct.ipc_perm* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = getelementptr inbounds %struct.ipc_perm, %struct.ipc_perm* %0, i64 0, i32 1
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.ipc_perm, %struct.ipc_perm* %0, i64 0, i32 2
%7 = load i32, i32* %6
%8 = getelementptr inbounds %struct.ipc_perm, %struct.ipc_perm* %0, i64 0, i32 3
%9 = load i32, i32* %8
%10 = getelementptr inbounds %struct.ipc_perm, %struct.ipc_perm* %0, i64 0, i32 4
%11 = load i32, i32* %10
%12 = getelementptr inbounds %struct.ipc_perm, %struct.ipc_perm* %0, i64 0, i32 5
%13 = load i32, i32* %12
%14 = getelementptr inbounds %struct.ipc_perm, %struct.ipc_perm* %0, i64 0, i32 6
%15 = load i32, i32* %14
%16 = tail call i32 @printf(i8* getelementptr inbounds ([108 x i8], [108 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %5, i32 %7, i32 %9, i32 %11, i32 %13, i32 %15)
ret void
}