#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 */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, ...);
const char *kore_worker_name(int id) {
  static char buf[64];
  switch (id) {
  case 2000:
    (void)snprintf(buf, sizeof(buf), "[keymgr]");
    break;
  case 2001:
    (void)snprintf(buf, sizeof(buf), "[acme]");
    break;
  default:
    (void)snprintf(buf, sizeof(buf), "[wrk %d]", id);
    break;
  }
  return (buf);
}


x86 assembly (clang, -O0):
<kore_worker_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x7d0,%eax
je     1144 <kore_worker_name+0x34>
jmp    1131 <kore_worker_name+0x21>
mov    -0x8(%rbp),%eax
sub    $0x7d1,%eax
je     1163 <kore_worker_name+0x53>
jmp    1182 <kore_worker_name+0x72>
lea    0x2ef5(%rip),%rdi
mov    $0x40,%esi
lea    0xea9(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    119f <kore_worker_name+0x8f>
lea    0x2ed6(%rip),%rdi
mov    $0x40,%esi
lea    0xe93(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    119f <kore_worker_name+0x8f>
mov    -0x4(%rbp),%ecx
lea    0x2eb4(%rip),%rdi
mov    $0x40,%esi
lea    0xe78(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
lea    0x2e9a(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kore_worker_name>:
push   %rax
cmp    $0x7d1,%edi
je     1133 <kore_worker_name+0x23>
mov    %edi,%ecx
lea    0x2f1e(%rip),%rdi
cmp    $0x7d0,%ecx
jne    114f <kore_worker_name+0x3f>
lea    0xecf(%rip),%rdx
jmp    1141 <kore_worker_name+0x31>
lea    0x2f06(%rip),%rdi
lea    0xec8(%rip),%rdx
mov    $0x40,%esi
xor    %eax,%eax
call   1030 <snprintf@plt>
jmp    1162 <kore_worker_name+0x52>
lea    0xeba(%rip),%rdx
mov    $0x40,%esi
xor    %eax,%eax
call   1030 <snprintf@plt>
lea    0x2ed7(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@kore_worker_name.buf = internal global [64 x i8] zeroinitializer
@.str = [9 x i8] c"[keymgr]\00"
@.str.1 = [7 x i8] c"[acme]\00"
@.str.2 = [9 x i8] c"[wrk %d]\00"
define i8* @kore_worker_name(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %8 [
i32 2000, label %4
i32 2001, label %6
]
4: ; preds = %1
%5 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @kore_worker_name.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %11
6: ; preds = %1
%7 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @kore_worker_name.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %11
8: ; preds = %1
%9 = load i32, i32* %2
%10 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @kore_worker_name.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %8, %6, %4
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @kore_worker_name.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@kore_worker_name.buf = internal global [64 x i8] zeroinitializer
@.str = [9 x i8] c"[keymgr]\00"
@.str.1 = [7 x i8] c"[acme]\00"
@.str.2 = [9 x i8] c"[wrk %d]\00"
define i8* @kore_worker_name(i32 %0) {
switch i32 %0, label %6 [
i32 2000, label %2
i32 2001, label %4
]
2: ; preds = %1
%3 = tail call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @kore_worker_name.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %8
4: ; preds = %1
%5 = tail call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @kore_worker_name.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %8
6: ; preds = %1
%7 = tail call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @kore_worker_name.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %0)
br label %8
8: ; preds = %6, %4, %2
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @kore_worker_name.buf, i64 0, i64 0)
}