#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strtok(char *, char *);
char *setname() {
  static char criername[128];
  printf("Well met, my liege. Please let us know how to identify you: ");
  fflush(stdout);
  fgets(criername, 128, stdin);
  strtok(criername, "\n");
  return criername;
}


x86 assembly (clang, -O0):
<setname>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    0x2e83(%rip),%rax
mov    (%rax),%edx
lea    0x2ee2(%rip),%rdi
mov    $0x80,%esi
call   1040 <fgets@plt>
lea    0x2ed1(%rip),%rdi
lea    0xeb7(%rip),%rsi
call   1060 <strtok@plt>
lea    0x2ebe(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<setname>:
push   %rbx
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%edx
lea    0x2ee5(%rip),%rbx
mov    %rbx,%rdi
mov    $0x80,%esi
call   1040 <fgets@plt>
lea    0xebe(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strtok@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@setname.criername = internal global [128 x i8] zeroinitializer
@.str = [61 x i8] c"Well met, my liege. Please let us know how to identify you: \00"
@stdout = global i32 0
@stdin = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
define i8* @setname() {
%1 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = call i32 @fflush(i32 %2)
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @setname.criername, i64 0, i64 0), i32 128, i32 %4)
%6 = call i32 @strtok(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @setname.criername, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @setname.criername, i64 0, i64 0)
}

LLVM IR (-O2):
@setname.criername = internal global [128 x i8] zeroinitializer
@.str = [61 x i8] c"Well met, my liege. Please let us know how to identify you: \00"
@stdout = global i32 0
@stdin = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
define i8* @setname() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
%4 = load i32, i32* @stdin
%5 = tail call i32 @fgets(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @setname.criername, i64 0, i64 0), i32 128, i32 %4)
%6 = tail call i32 @strtok(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @setname.criername, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @setname.criername, i64 0, i64 0)
}