#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcat(int /*<<< orphan*/, char const *);
scalar_t__ strlen(char const *);
int /*<<< orphan*/ strncpy(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ write_to_log(char *, int);
void report_unknown_argument(const char *argument) {
  int argument_length = (int)strlen(argument);
  char full_error[(strlen("Unknown argument: ") + argument_length + 1)];
  strcat(strncpy(full_error,
                 "Unknown argument: ", strlen("Unknown argument: ") + 1),
         argument);
  printf("%s\n", full_error);
  write_to_log(full_error, true);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<report_unknown_argument>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0xc(%rbp)
lea    0xe81(%rip),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
movslq -0xc(%rbp),%rdx
lea    0x1(%rcx,%rdx,1),%rax
mov    %rsp,%rsi
mov    %rsi,-0x18(%rbp)
lea    0x10(%rcx,%rdx,1),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
lea    0xe48(%rip),%rdi
call   1050 <strlen@plt>
mov    -0x28(%rbp),%rdi
add    $0x1,%rax
mov    %eax,%edx
lea    0xe32(%rip),%rsi
call   1030 <strncpy@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x28(%rbp),%rsi
lea    0xe2a(%rip),%rdi
call   1060 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    $0x1,%esi
call   1040 <write_to_log@plt>
mov    0x2ddd(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<report_unknown_argument>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1050 <strlen@plt>
cltq
mov    %rsp,%rbx
add    $0x22,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xe77(%rip),%rsi
mov    %rbx,%rdi
mov    $0x13,%edx
call   1030 <strncpy@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1070 <strcat@plt>
lea    0xe6c(%rip),%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <write_to_log@plt>
mov    0x2e1d(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Unknown argument: \00"
@.str.1 = [4 x i8] c"%s\0A\00"
@EXIT_FAILURE = global i32 0
define void @report_unknown_argument(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i64 @strlen(i8* %6)
%8 = trunc i64 %7 to i32
store i32 %8, i32* %3
%9 = call i64 @strlen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = add nsw i64 %9, %11
%13 = add nsw i64 %12, 1
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %4
%15 = alloca i8, i64 %13
store i64 %13, i64* %5
%16 = call i64 @strlen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%17 = add nsw i64 %16, 1
%18 = trunc i64 %17 to i32
%19 = call i32 @strncpy(i8* %15, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i8*, i8** %2
%21 = call i32 @strcat(i32 %19, i8* %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%23 = call i32 @write_to_log(i8* %15, i32 1)
%24 = load i32, i32* @EXIT_FAILURE
%25 = call i32 @exit(i32 %24)
unreachable
}

LLVM IR (-O2):
@.str = [19 x i8] c"Unknown argument: \00"
@.str.1 = [4 x i8] c"%s\0A\00"
@EXIT_FAILURE = global i32 0
define void @report_unknown_argument(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = shl i64 %2, 32
%4 = ashr exact i64 %3, 32
%5 = add nsw i64 %4, 19
%6 = alloca i8, i64 %5
%7 = call i32 @strncpy(i8* %6, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 19)
%8 = call i32 @strcat(i32 %7, i8* %0)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%10 = call i32 @write_to_log(i8* %6, i32 1)
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
}