void report_shmget_errors(int s) {
  switch (s) {
  case -1:
    printf(1,
           "nroError:%d-current process has all shared memory blocks already "
           "busy.\n",
           s);
    break;
  case -2:
    printf(1,
           "nroError:%d-Sharem memory block with key descriptor hasn't been "
           "created.",
           s);
    break;
  case -3:
    printf(1, "nroError:%d-Process haven't enought adresses space.", s);
    break;
  case -4:
    printf(1, "nroError:%d-Invalid key in shm_get.", s);
    break;
  }
}


x86 assembly (clang, -O0):
<report_shmget_errors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     11ab <report_shmget_errors+0x9b>
mov    -0x10(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x4(%rbp),%edx
mov    $0x1,%edi
lea    0xebd(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ab <report_shmget_errors+0x9b>
mov    -0x4(%rbp),%edx
mov    $0x1,%edi
lea    0xeea(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ab <report_shmget_errors+0x9b>
mov    -0x4(%rbp),%edx
mov    $0x1,%edi
lea    0xf18(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ab <report_shmget_errors+0x9b>
mov    -0x4(%rbp),%edx
mov    $0x1,%edi
lea    0xf31(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report_shmget_errors>:
add    $0x4,%edi
cmp    $0x3,%edi
ja     1140 <report_shmget_errors+0x30>
lea    0xee1(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xfa6(%rip),%rsi
mov    $0x1,%edi
mov    $0xfffffffc,%edx
xor    %eax,%eax
jmp    1030 <printf@plt>
ret
lea    0xf59(%rip),%rsi
mov    $0x1,%edi
mov    $0xfffffffd,%edx
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xef8(%rip),%rsi
mov    $0x1,%edi
mov    $0xfffffffe,%edx
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xe98(%rip),%rsi
mov    $0x1,%edi
mov    $0xffffffff,%edx
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [72 x i8] c"nroError:%d-current process has all shared memory blocks already busy.\0A\00"
@.str.1 = [73 x i8] c"nroError:%d-Sharem memory block with key descriptor hasn't been created.\00"
@.str.2 = [52 x i8] c"nroError:%d-Process haven't enought adresses space.\00"
@.str.3 = [36 x i8] c"nroError:%d-Invalid key in shm_get.\00"
define void @report_shmget_errors(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %16 [
i32 -1, label %4
i32 -2, label %7
i32 -3, label %10
i32 -4, label %13
]
4: ; preds = %1
%5 = load i32, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %16
7: ; preds = %1
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0), i32 %8)
br label %16
10: ; preds = %1
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i32 %11)
br label %16
13: ; preds = %1
%14 = load i32, i32* %2
%15 = call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %1, %13, %10, %7, %4
ret void
}

LLVM IR (-O2):
@.str = [72 x i8] c"nroError:%d-current process has all shared memory blocks already busy.\0A\00"
@.str.1 = [73 x i8] c"nroError:%d-Sharem memory block with key descriptor hasn't been created.\00"
@.str.2 = [52 x i8] c"nroError:%d-Process haven't enought adresses space.\00"
@.str.3 = [36 x i8] c"nroError:%d-Invalid key in shm_get.\00"
define void @report_shmget_errors(i32 %0) {
switch i32 %0, label %10 [
i32 -1, label %2
i32 -2, label %4
i32 -3, label %6
i32 -4, label %8
]
2: ; preds = %1
%3 = tail call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i32 -1)
br label %10
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0), i32 -2)
br label %10
6: ; preds = %1
%7 = tail call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i32 -3)
br label %10
8: ; preds = %1
%9 = tail call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 -4)
br label %10
10: ; preds = %1, %8, %6, %4, %2
ret void
}