#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*/ dir;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ error(char *, char *);
int /*<<< orphan*/ go_to_dir(char *, int /*<<< orphan*/);
scalar_t__ options_get_str(char *);
int /*<<< orphan*/ resolve_path(char *, int, scalar_t__);
int /*<<< orphan*/ sprintf(char *, char *, int const);
void go_to_fast_dir(const int num) {
  char option_name[20];
  assert(num >= 1 && num <= 10);
  sprintf(option_name, "FastDir%d", num);
  if (options_get_str(option_name)) {
    char dir[4096] = "/";
    resolve_path(dir, sizeof(dir), options_get_str(option_name));
    go_to_dir(dir, 0);
  } else
    error("%s is not defined", option_name);
}


x86 assembly (clang, -O0):
<go_to_fast_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1030,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x1,-0x4(%rbp)
mov    %al,-0x1021(%rbp)
jl     119d <go_to_fast_dir+0x2d>
cmpl   $0xa,-0x4(%rbp)
setle  %al
mov    %al,-0x1021(%rbp)
mov    -0x1021(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe45(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x20(%rbp),%rdi
call   1090 <options_get_str@plt>
cmp    $0x0,%rax
je     122b <go_to_fast_dir+0xbb>
lea    -0x1020(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1030 <memset@plt>
movb   $0x2f,-0x1020(%rbp)
lea    -0x1020(%rbp),%rax
mov    %rax,-0x1030(%rbp)
lea    -0x20(%rbp),%rdi
call   1090 <options_get_str@plt>
mov    -0x1030(%rbp),%rdi
mov    %rax,%rdx
mov    $0x1000,%esi
call   1060 <resolve_path@plt>
lea    -0x1020(%rbp),%rdi
xor    %esi,%esi
call   1040 <go_to_dir@plt>
jmp    123b <go_to_fast_dir+0xcb>
lea    -0x20(%rbp),%rsi
lea    0xdd4(%rip),%rdi
call   1070 <error@plt>
add    $0x1030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<go_to_fast_dir>:
push   %r14
push   %rbx
sub    $0x1028,%rsp
mov    %edi,%ebx
lea    -0x1(%rbx),%eax
xor    %edi,%edi
cmp    $0xa,%eax
setb   %dil
call   1050 <assert@plt>
lea    0xe6c(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %ebx,%edx
call   1080 <sprintf@plt>
mov    %r14,%rdi
call   1090 <options_get_str@plt>
test   %rax,%rax
je     11eb <go_to_fast_dir+0x7b>
lea    0x20(%rsp),%rbx
mov    $0x1000,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
movb   $0x2f,0x20(%rsp)
mov    %rsp,%rdi
call   1090 <options_get_str@plt>
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    %rax,%rdx
call   1060 <resolve_path@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <go_to_dir@plt>
jmp    11fa <go_to_fast_dir+0x8a>
lea    0xe18(%rip),%rdi
mov    %rsp,%rsi
call   1070 <error@plt>
add    $0x1028,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"FastDir%d\00"
@.str.1 = [18 x i8] c"%s is not defined\00"
define void @go_to_fast_dir(i32 %0) {
%2 = alloca i32
%3 = alloca [20 x i8]
%4 = alloca [4096 x i8]
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp sge i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp sle i32 %8, 10
br label %10
10: ; preds = %7, %1
%11 = phi i1 [ false, %1 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%15 = load i32, i32* %2
%16 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%18 = call i64 @options_get_str(i8* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %30
20: ; preds = %10
%21 = bitcast [4096 x i8]* %4 to i8*
%22 = bitcast i8* %21 to [4096 x i8]*
%23 = getelementptr inbounds [4096 x i8], [4096 x i8]* %22, i32 0, i32 0
store i8 47, i8* %23
%24 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%25 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%26 = call i64 @options_get_str(i8* %25)
%27 = call i32 @resolve_path(i8* %24, i32 4096, i64 %26)
%28 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%29 = call i32 @go_to_dir(i8* %28, i32 0)
br label %33
30: ; preds = %10
%31 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%32 = call i32 @error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %31)
br label %33
33: ; preds = %30, %20
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"FastDir%d\00"
@.str.1 = [18 x i8] c"%s is not defined\00"
define void @go_to_fast_dir(i32 %0) {
%2 = alloca [20 x i8]
%3 = alloca [4096 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = add i32 %0, -1
%6 = icmp ult i32 %5, 10
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0)
%10 = call i64 @options_get_str(i8* %4)
%11 = icmp eq i64 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %1
%13 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
store i8 47, i8* %13
%14 = call i64 @options_get_str(i8* %4)
%15 = call i32 @resolve_path(i8* %13, i32 4096, i64 %14)
%16 = call i32 @go_to_dir(i8* %13, i32 0)
br label %19
17: ; preds = %1
%18 = call i32 @error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %4)
br label %19
19: ; preds = %17, %12
ret void
}