int getWeight(int person) {
  int retValue_acc;
  {
    if (person == 0) {
      retValue_acc = 40;
      return (retValue_acc);
    } else {
      if (person == 1) {
        retValue_acc = 40;
        return (retValue_acc);
      } else {
        if (person == 2) {
          retValue_acc = 40;
          return (retValue_acc);
        } else {
          if (person == 3) {
            retValue_acc = 40;
            return (retValue_acc);
          } else {
            if (person == 4) {
              retValue_acc = 30;
              return (retValue_acc);
            } else {
              if (person == 5) {
                retValue_acc = 150;
                return (retValue_acc);
              } else {
                retValue_acc = 0;
                return (retValue_acc);
              }
            }
          }
        }
      }
    }
    return (retValue_acc);
  }
}


x86 assembly (clang, -O0):
<getWeight>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1123 <getWeight+0x23>
movl   $0x28,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11bc <getWeight+0xbc>
cmpl   $0x1,-0x8(%rbp)
jne    113f <getWeight+0x3f>
movl   $0x28,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11bc <getWeight+0xbc>
cmpl   $0x2,-0x8(%rbp)
jne    115b <getWeight+0x5b>
movl   $0x28,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11bc <getWeight+0xbc>
cmpl   $0x3,-0x8(%rbp)
jne    1177 <getWeight+0x77>
movl   $0x28,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11bc <getWeight+0xbc>
cmpl   $0x4,-0x8(%rbp)
jne    1193 <getWeight+0x93>
movl   $0x1e,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11bc <getWeight+0xbc>
cmpl   $0x5,-0x8(%rbp)
jne    11af <getWeight+0xaf>
movl   $0x96,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11bc <getWeight+0xbc>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getWeight>:
xor    %eax,%eax
cmp    $0x5,%edi
ja     1114 <getWeight+0x14>
movslq %edi,%rax
lea    0xeef(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @getWeight(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
store i32 40, i32* %4
%8 = load i32, i32* %4
store i32 %8, i32* %2
br label %36
9: ; preds = %1
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %9
store i32 40, i32* %4
%13 = load i32, i32* %4
store i32 %13, i32* %2
br label %36
14: ; preds = %9
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %19
17: ; preds = %14
store i32 40, i32* %4
%18 = load i32, i32* %4
store i32 %18, i32* %2
br label %36
19: ; preds = %14
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 3
br i1 %21, label %22, label %24
22: ; preds = %19
store i32 40, i32* %4
%23 = load i32, i32* %4
store i32 %23, i32* %2
br label %36
24: ; preds = %19
%25 = load i32, i32* %3
%26 = icmp eq i32 %25, 4
br i1 %26, label %27, label %29
27: ; preds = %24
store i32 30, i32* %4
%28 = load i32, i32* %4
store i32 %28, i32* %2
br label %36
29: ; preds = %24
%30 = load i32, i32* %3
%31 = icmp eq i32 %30, 5
br i1 %31, label %32, label %34
32: ; preds = %29
store i32 150, i32* %4
%33 = load i32, i32* %4
store i32 %33, i32* %2
br label %36
34: ; preds = %29
store i32 0, i32* %4
%35 = load i32, i32* %4
store i32 %35, i32* %2
br label %36
36: ; preds = %34, %32, %27, %22, %17, %12, %7
%37 = load i32, i32* %2
ret i32 %37
}

LLVM IR (-O2):
@switch.table.getWeight = [6 x i32] [i32 40, i32 40, i32 40, i32 40, i32 30, i32 150]
define i32 @getWeight(i32 %0) {
%2 = icmp ult i32 %0, 6
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [6 x i32], [6 x i32]* @switch.table.getWeight, i64 0, i64 %4
%6 = load i32, i32* %5
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 0, %1 ]
ret i32 %8
}