int main_godo(unsigned argc, char **argv) {
  const char *directory = argv[1];
  if (argc < 3) {
    lace_log_warning_(
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/grencez/lace/refs/heads/readme/src/godo.c",
        __extension__ __func__, 15, "Usage: godo PATH COMMAND [ARG...]");
    return 64;
  }
  if (0 != lace_compat_sh_chdir(directory)) {
    lace_log_errorf("Failed to chdir() to: %s", directory);
    return 66;
  }
  argv = &argv[2];
  lace_compat_sh_exec((const char **)argv);
  return 126;
}


x86 assembly (clang, -O0):
<main_godo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x3,-0x8(%rbp)
jae    1192 <main_godo+0x52>
lea    0xe94(%rip),%rdi
lea    0xf11(%rip),%rsi
mov    $0xf,%edx
lea    0xf0f(%rip),%rcx
mov    $0x0,%al
call   1050 <lace_log_warning_@plt>
movl   $0x40,-0x4(%rbp)
jmp    11e5 <main_godo+0xa5>
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1060 <lace_compat_sh_chdir@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
je     11c7 <main_godo+0x87>
mov    -0x18(%rbp),%rsi
lea    0xefc(%rip),%rdi
mov    $0x0,%al
call   1030 <lace_log_errorf@plt>
movl   $0x42,-0x4(%rbp)
jmp    11e5 <main_godo+0xa5>
mov    -0x10(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1040 <lace_compat_sh_exec@plt>
movl   $0x7e,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main_godo>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
ja     1171 <main_godo+0x31>
lea    0xeb0(%rip),%rdi
lea    0xf2d(%rip),%rsi
lea    0xf30(%rip),%rcx
mov    $0xf,%edx
xor    %eax,%eax
call   1050 <lace_log_warning_@plt>
mov    $0x40,%eax
jmp    11b1 <main_godo+0x71>
mov    %rsi,%rbx
mov    0x8(%rsi),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <lace_compat_sh_chdir@plt>
test   %eax,%eax
je     119e <main_godo+0x5e>
lea    0xf23(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <lace_log_errorf@plt>
mov    $0x42,%eax
jmp    11b1 <main_godo+0x71>
add    $0x10,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <lace_compat_sh_exec@plt>
mov    $0x7e,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [132 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/grencez/lace/refs/heads/readme/src/godo.c\00"
@__func__.main_godo = [10 x i8] c"main_godo\00"
@.str.1 = [34 x i8] c"Usage: godo PATH COMMAND [ARG...]\00"
@.str.2 = [25 x i8] c"Failed to chdir() to: %s\00"
define i32 @main_godo(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
store i8* %9, i8** %6
%10 = load i32, i32* %4
%11 = icmp ult i32 %10, 3
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 (i8*, i8*, i32, i8*, ...) bitcast (i32 (...)* @lace_log_warning_ to i32 (i8*, i8*, i32, i8*, ...)*)(i8* getelementptr inbounds ([132 x i8], [132 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__func__.main_godo, i64 0, i64 0), i32 15, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
store i32 64, i32* %3
br label %26
14: ; preds = %2
%15 = load i8*, i8** %6
%16 = call i32 (i8*, ...) bitcast (i32 (...)* @lace_compat_sh_chdir to i32 (i8*, ...)*)(i8* %15)
%17 = icmp ne i32 0, %16
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = load i8*, i8** %6
%20 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @lace_log_errorf to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %19)
store i32 66, i32* %3
br label %26
21: ; preds = %14
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
store i8** %23, i8*** %5
%24 = load i8**, i8*** %5
%25 = call i32 (i8**, ...) bitcast (i32 (...)* @lace_compat_sh_exec to i32 (i8**, ...)*)(i8** %24)
store i32 126, i32* %3
br label %26
26: ; preds = %21, %18, %12
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [132 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/grencez/lace/refs/heads/readme/src/godo.c\00"
@__func__.main_godo = [10 x i8] c"main_godo\00"
@.str.1 = [34 x i8] c"Usage: godo PATH COMMAND [ARG...]\00"
@.str.2 = [25 x i8] c"Failed to chdir() to: %s\00"
define i32 @main_godo(i32 %0, i8** %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = icmp ult i32 %0, 3
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (i8*, i8*, i32, i8*, ...) bitcast (i32 (...)* @lace_log_warning_ to i32 (i8*, i8*, i32, i8*, ...)*)(i8* getelementptr inbounds ([132 x i8], [132 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__func__.main_godo, i64 0, i64 0), i32 15, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %16
8: ; preds = %2
%9 = tail call i32 (i8*, ...) bitcast (i32 (...)* @lace_compat_sh_chdir to i32 (i8*, ...)*)(i8* %4)
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @lace_log_errorf to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %4)
br label %16
13: ; preds = %8
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = tail call i32 (i8**, ...) bitcast (i32 (...)* @lace_compat_sh_exec to i32 (i8**, ...)*)(i8** %14)
br label %16
16: ; preds = %13, %11, %6
%17 = phi i32 [ 64, %6 ], [ 66, %11 ], [ 126, %13 ]
ret i32 %17
}