#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 */
struct sub_command {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ s_internal(char *, char *, char *, int);
char *which(char *);
int cmd_which(int argc, char **argv, struct sub_command *cmd) {
  if (argc == 2) {
    char *str = which(argv[1]);
    printf("%s\n", str);
    (s_internal(str, "str",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/JulienBoubechtoulaAmabis/"
                "roswell/refs/heads/maBranche/src/cmd-internal.c",
                27));
  }
  return 0;
}


x86 assembly (clang, -O0):
<cmd_which>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x2,-0x4(%rbp)
jne    118a <cmd_which+0x5a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <which@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe8b(%rip),%rsi
lea    0xe88(%rip),%rdx
mov    $0x1b,%ecx
call   1030 <s_internal@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_which>:
cmp    $0x2,%edi
jne    116d <cmd_which+0x3d>
push   %rbx
mov    0x8(%rsi),%rdi
call   1050 <which@plt>
mov    %rax,%rbx
lea    0xeb7(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
lea    0xeac(%rip),%rsi
lea    0xea9(%rip),%rdx
mov    %rbx,%rdi
mov    $0x1b,%ecx
call   1030 <s_internal@plt>
pop    %rbx
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.sub_command = type { i32 }
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [4 x i8] c"str\00"
@.str.2 = [163 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/JulienBoubechtoulaAmabis/roswell/refs/heads/maBranche/src/cmd-internal.c\00"
define i32 @cmd_which(i32 %0, i8** %1, %struct.sub_command* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.sub_command*
%7 = alloca i8*
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.sub_command* %2, %struct.sub_command** %6
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %19
10: ; preds = %3
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i8* @which(i8* %13)
store i8* %14, i8** %7
%15 = load i8*, i8** %7
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i8*, i8** %7
%18 = call i32 @s_internal(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.2, i64 0, i64 0), i32 27)
br label %19
19: ; preds = %10, %3
ret i32 0
}

LLVM IR (-O2):
%struct.sub_command = type { i32 }
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [4 x i8] c"str\00"
@.str.2 = [163 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/JulienBoubechtoulaAmabis/roswell/refs/heads/maBranche/src/cmd-internal.c\00"
define i32 @cmd_which(i32 %0, i8** nocapture %1, %struct.sub_command* nocapture readnone %2) {
%4 = icmp eq i32 %0, 2
br i1 %4, label %5, label %11
5: ; preds = %3
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i8* @which(i8* %7)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @s_internal(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.2, i64 0, i64 0), i32 27)
br label %11
11: ; preds = %5, %3
ret i32 0
}