#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 EACCES;
int EEXIST;
int EINVAL;
int ENFILE;
int ENOENT;
int ENOMEM;
int ENOSPC;
int EPERM;
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  do {
    printf("[%2d]%-10s  %s", EACCES, "EACCES",
           "The  user  does  not  have  permission  to  access  the  \n"
           "\t\tshared  memory  segment, and does not have the CAP_IPC_OWNER\n"
           "\t\tcapability.");
    printf("\n");
  } while (0);
  do {
    printf("[%2d]%-10s  %s", EEXIST, "EEXIST",
           "IPC_CREAT | IPC_EXCL was specified and the segment exists.");
    printf("\n");
  } while (0);
  do {
    printf("[%2d]%-10s  %s", EINVAL, "EINVAL",
           "A new segment was to be created and size < SHMMIN or \n"
           "\t\tsize > SHMMAX, or no new segment was  to  be  created, \n"
           "\t\ta segment with given key existed, but size is greater than\n"
           "\t\tthe size of that segment.");
    printf("\n");
  } while (0);
  do {
    printf(
        "[%2d]%-10s  %s", ENFILE, "ENFILE",
        "The system limit on the total number of open files has been reached.");
    printf("\n");
  } while (0);
  do {
    printf("[%2d]%-10s  %s", ENOENT, "ENOENT",
           "No segment exists for the given key, and IPC_CREAT was not "
           "specified.");
    printf("\n");
  } while (0);
  do {
    printf("[%2d]%-10s  %s", ENOMEM, "ENOMEM",
           "No memory could be allocated for segment overhead.");
    printf("\n");
  } while (0);
  do {
    printf("[%2d]%-10s  %s", ENOSPC, "ENOSPC",
           "All  possible shared memory IDs have been taken (SHMMNI), \n"
           "\t\tor allocating a segment of the requested size would cause \n"
           "\tthe system to exceed the system-wide limit on shared memory "
           "(SHMALL).");
    printf("\n");
  } while (0);
  do {
    printf("[%2d]%-10s  %s", EPERM, "EPERM",
           "The SHM_HUGETLB flag was specified, but the caller was not "
           "privileged \n"
           "\t(did not  have  the  CAP_IPC_LOCK capability).");
    printf("\n");
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
lea    0xeca(%rip),%rdi
lea    0xed2(%rip),%rdx
lea    0xed2(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    115e <main+0x4e>
mov    0x2e73(%rip),%rax
mov    (%rax),%esi
lea    0xe92(%rip),%rdi
lea    0xf2a(%rip),%rdx
lea    0xf2a(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1196 <main+0x86>
mov    0x2e2b(%rip),%rax
mov    (%rax),%esi
lea    0xe5a(%rip),%rdi
lea    0xf34(%rip),%rdx
lea    0xf34(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ce <main+0xbe>
mov    0x2de3(%rip),%rax
mov    (%rax),%esi
lea    0xe22(%rip),%rdi
lea    0xfcc(%rip),%rdx
lea    0xfcc(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1206 <main+0xf6>
mov    0x2d9b(%rip),%rax
mov    (%rax),%esi
lea    0xdea(%rip),%rdi
lea    0xfe0(%rip),%rdx
lea    0xfe0(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123e <main+0x12e>
mov    0x2d8b(%rip),%rax
mov    (%rax),%esi
lea    0xdb2(%rip),%rdi
lea    0xff5(%rip),%rdx
lea    0xff5(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1276 <main+0x166>
mov    0x2d43(%rip),%rax
mov    (%rax),%esi
lea    0xd7a(%rip),%rdi
lea    0xff7(%rip),%rdx
lea    0xff7(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ae <main+0x19e>
mov    0x2ceb(%rip),%rax
mov    (%rax),%esi
lea    0xd42(%rip),%rdi
lea    0x1085(%rip),%rdx
lea    0x1084(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rbx
lea    0xed7(%rip),%rdx
lea    0xed7(%rip),%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%esi
lea    0xf3a(%rip),%rdx
lea    0xf3a(%rip),%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%esi
lea    0xf51(%rip),%rdx
lea    0xf51(%rip),%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2e08(%rip),%rax
mov    (%rax),%esi
lea    0xff6(%rip),%rdx
lea    0xff6(%rip),%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2dcd(%rip),%rax
mov    (%rax),%esi
lea    0x1017(%rip),%rdx
lea    0x1017(%rip),%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2dca(%rip),%rax
mov    (%rax),%esi
lea    0x1039(%rip),%rdx
lea    0x1039(%rip),%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2d8f(%rip),%rax
mov    (%rax),%esi
lea    0x1048(%rip),%rdx
lea    0x1048(%rip),%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2d44(%rip),%rax
mov    (%rax),%esi
lea    0x10e3(%rip),%rdx
lea    0x10e2(%rip),%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"[%2d]%-10s %s\00"
@EACCES = global i32 0
@.str.1 = [7 x i8] c"EACCES\00"
@.str.2 = [135 x i8] c"The user does not have permission to access the \0A\09\09shared memory segment, and does not have the CAP_IPC_OWNER\0A\09\09capability.\00"
@.str.3 = [2 x i8] c"\0A\00"
@EEXIST = global i32 0
@.str.4 = [7 x i8] c"EEXIST\00"
@.str.5 = [59 x i8] c"IPC_CREAT | IPC_EXCL was specified and the segment exists.\00"
@EINVAL = global i32 0
@.str.6 = [7 x i8] c"EINVAL\00"
@.str.7 = [201 x i8] c"A new segment was to be created and size < SHMMIN or \0A\09\09size > SHMMAX, or no new segment was to be created, \0A\09\09a segment with given key existed, but size is greater than\0A\09\09the size of that segment.\00"
@ENFILE = global i32 0
@.str.8 = [7 x i8] c"ENFILE\00"
@.str.9 = [69 x i8] c"The system limit on the total number of open files has been reached.\00"
@ENOENT = global i32 0
@.str.10 = [7 x i8] c"ENOENT\00"
@.str.11 = [70 x i8] c"No segment exists for the given key, and IPC_CREAT was not specified.\00"
@ENOMEM = global i32 0
@.str.12 = [7 x i8] c"ENOMEM\00"
@.str.13 = [51 x i8] c"No memory could be allocated for segment overhead.\00"
@ENOSPC = global i32 0
@.str.14 = [7 x i8] c"ENOSPC\00"
@.str.15 = [191 x i8] c"All possible shared memory IDs have been taken (SHMMNI), \0A\09\09or allocating a segment of the requested size would cause \0A\09the system to exceed the system-wide limit on shared memory (SHMALL).\00"
@EPERM = global i32 0
@.str.16 = [6 x i8] c"EPERM\00"
@.str.17 = [119 x i8] c"The SHM_HUGETLB flag was specified, but the caller was not privileged \0A\09(did not have the CAP_IPC_LOCK capability).\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %6
6: ; preds = %2
%7 = load i32, i32* @EACCES
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %10
10: ; preds = %6
br label %11
11: ; preds = %10
%12 = load i32, i32* @EEXIST
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %15
15: ; preds = %11
br label %16
16: ; preds = %15
%17 = load i32, i32* @EINVAL
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([201 x i8], [201 x i8]* @.str.7, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %16
br label %21
21: ; preds = %20
%22 = load i32, i32* @ENFILE
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.9, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %25
25: ; preds = %21
br label %26
26: ; preds = %25
%27 = load i32, i32* @ENOENT
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %27, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.11, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %30
30: ; preds = %26
br label %31
31: ; preds = %30
%32 = load i32, i32* @ENOMEM
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %32, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.13, i64 0, i64 0))
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %35
35: ; preds = %31
br label %36
36: ; preds = %35
%37 = load i32, i32* @ENOSPC
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %37, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([191 x i8], [191 x i8]* @.str.15, i64 0, i64 0))
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %40
40: ; preds = %36
br label %41
41: ; preds = %40
%42 = load i32, i32* @EPERM
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %42, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str.17, i64 0, i64 0))
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %45
45: ; preds = %41
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"[%2d]%-10s %s\00"
@EACCES = global i32 0
@.str.1 = [7 x i8] c"EACCES\00"
@.str.2 = [135 x i8] c"The user does not have permission to access the \0A\09\09shared memory segment, and does not have the CAP_IPC_OWNER\0A\09\09capability.\00"
@EEXIST = global i32 0
@.str.4 = [7 x i8] c"EEXIST\00"
@.str.5 = [59 x i8] c"IPC_CREAT | IPC_EXCL was specified and the segment exists.\00"
@EINVAL = global i32 0
@.str.6 = [7 x i8] c"EINVAL\00"
@.str.7 = [201 x i8] c"A new segment was to be created and size < SHMMIN or \0A\09\09size > SHMMAX, or no new segment was to be created, \0A\09\09a segment with given key existed, but size is greater than\0A\09\09the size of that segment.\00"
@ENFILE = global i32 0
@.str.8 = [7 x i8] c"ENFILE\00"
@.str.9 = [69 x i8] c"The system limit on the total number of open files has been reached.\00"
@ENOENT = global i32 0
@.str.10 = [7 x i8] c"ENOENT\00"
@.str.11 = [70 x i8] c"No segment exists for the given key, and IPC_CREAT was not specified.\00"
@ENOMEM = global i32 0
@.str.12 = [7 x i8] c"ENOMEM\00"
@.str.13 = [51 x i8] c"No memory could be allocated for segment overhead.\00"
@ENOSPC = global i32 0
@.str.14 = [7 x i8] c"ENOSPC\00"
@.str.15 = [191 x i8] c"All possible shared memory IDs have been taken (SHMMNI), \0A\09\09or allocating a segment of the requested size would cause \0A\09the system to exceed the system-wide limit on shared memory (SHMALL).\00"
@EPERM = global i32 0
@.str.16 = [6 x i8] c"EPERM\00"
@.str.17 = [119 x i8] c"The SHM_HUGETLB flag was specified, but the caller was not privileged \0A\09(did not have the CAP_IPC_LOCK capability).\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @EACCES
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @putchar(i32 10)
%6 = load i32, i32* @EEXIST
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.5, i64 0, i64 0))
%8 = tail call i32 @putchar(i32 10)
%9 = load i32, i32* @EINVAL
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([201 x i8], [201 x i8]* @.str.7, i64 0, i64 0))
%11 = tail call i32 @putchar(i32 10)
%12 = load i32, i32* @ENFILE
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.9, i64 0, i64 0))
%14 = tail call i32 @putchar(i32 10)
%15 = load i32, i32* @ENOENT
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.11, i64 0, i64 0))
%17 = tail call i32 @putchar(i32 10)
%18 = load i32, i32* @ENOMEM
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.13, i64 0, i64 0))
%20 = tail call i32 @putchar(i32 10)
%21 = load i32, i32* @ENOSPC
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([191 x i8], [191 x i8]* @.str.15, i64 0, i64 0))
%23 = tail call i32 @putchar(i32 10)
%24 = load i32, i32* @EPERM
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %24, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str.17, i64 0, i64 0))
%26 = tail call i32 @putchar(i32 10)
ret i32 0
}