#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 /*<<< orphan*/ sprintf(char *, char *, unsigned int);
const char *mfu_mul_dst(unsigned dst) {
  static char ret[16];
  char *buf = ret;
  switch (dst) {
  case 1:
    return "bar";
  case 4:
    return "r0";
  case 5:
    return "r1";
  case 6:
    return "r2";
  case 7:
    return "r3";
  default:
    sprintf(buf, "dst%d", dst);
    break;
  }
  return ret;
}


x86 assembly (clang, -O0):
<mfu_mul_dst>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
lea    0x2f1e(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x6,%eax
ja     119f <mfu_mul_dst+0x8f>
mov    -0x20(%rbp),%rax
lea    0xeba(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xec6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bd <mfu_mul_dst+0xad>
lea    0xeba(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bd <mfu_mul_dst+0xad>
lea    0xead(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bd <mfu_mul_dst+0xad>
lea    0xea0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bd <mfu_mul_dst+0xad>
lea    0xe93(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bd <mfu_mul_dst+0xad>
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xe7f(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2e87(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mfu_mul_dst>:
push   %rbx
mov    %edi,%edx
lea    -0x1(%rdx),%eax
cmp    $0x7,%eax
jae    1125 <mfu_mul_dst+0x15>
mov    $0x79,%ecx
bt     %eax,%ecx
jb     113d <mfu_mul_dst+0x2d>
lea    0x2f14(%rip),%rbx
lea    0xedd(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
jmp    114d <mfu_mul_dst+0x3d>
cltq
lea    0xed2(%rip),%rcx
movslq (%rcx,%rax,4),%rbx
add    %rcx,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@mfu_mul_dst.ret = internal global [16 x i8] zeroinitializer
@.str = [4 x i8] c"bar\00"
@.str.1 = [3 x i8] c"r0\00"
@.str.2 = [3 x i8] c"r1\00"
@.str.3 = [3 x i8] c"r2\00"
@.str.4 = [3 x i8] c"r3\00"
@.str.5 = [6 x i8] c"dst%d\00"
define i8* @mfu_mul_dst(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @mfu_mul_dst.ret, i64 0, i64 0), i8** %4
%5 = load i32, i32* %3
switch i32 %5, label %11 [
i32 1, label %6
i32 4, label %7
i32 5, label %8
i32 6, label %9
i32 7, label %10
]
6: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2
br label %16
7: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %16
8: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %16
9: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %16
10: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %16
11: ; preds = %1
%12 = load i8*, i8** %4
%13 = load i32, i32* %3
%14 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %11
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @mfu_mul_dst.ret, i64 0, i64 0), i8** %2
br label %16
16: ; preds = %15, %10, %9, %8, %7, %6
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
@mfu_mul_dst.ret = internal global [16 x i8] zeroinitializer
@.str = [4 x i8] c"bar\00"
@.str.1 = [3 x i8] c"r0\00"
@.str.2 = [3 x i8] c"r1\00"
@.str.3 = [3 x i8] c"r2\00"
@.str.4 = [3 x i8] c"r3\00"
@.str.5 = [6 x i8] c"dst%d\00"
@reltable.mfu_mul_dst = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([7 x i32]* @reltable.mfu_mul_dst to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([7 x i32]* @reltable.mfu_mul_dst to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([7 x i32]* @reltable.mfu_mul_dst to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.mfu_mul_dst to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.mfu_mul_dst to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.mfu_mul_dst to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.mfu_mul_dst to i64)) to i32)]
define i8* @mfu_mul_dst(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 7
br i1 %3, label %6, label %4
4: ; preds = %6, %1
%5 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @mfu_mul_dst.ret, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %0)
br label %15
6: ; preds = %1
%7 = trunc i32 %2 to i8
%8 = lshr i8 121, %7
%9 = and i8 %8, 1
%10 = icmp eq i8 %9, 0
br i1 %10, label %4, label %11
11: ; preds = %6
%12 = sext i32 %2 to i64
%13 = shl i64 %12, 2
%14 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.mfu_mul_dst to i8*), i64 %13)
br label %15
15: ; preds = %11, %4
%16 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @mfu_mul_dst.ret, i64 0, i64 0), %4 ], [ %14, %11 ]
ret i8* %16
}