#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 */
char *_nextargv(char **, char *);
int _sizeargv(char *, char *);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
scalar_t__ wrap_malloc(char *, int, int);
char **argv_create(char *cmdline, char *ignore) {
  int argc = _sizeargv(cmdline, ignore);
  char **argv = (char **)wrap_malloc(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/ystk/debian-freeipmi/refs/heads/master/"
      "ipmipower/src/argv.c",
      90, sizeof(char *) * (argc + 1));
  int i;
  for (i = 0; i < argc; i++) {
    argv[i] = _nextargv(&cmdline, ignore);
    assert(argv[i] != NULL);
  }
  argv[i] = NULL;
  return argv;
}


x86 assembly (clang, -O0):
<argv_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <_sizeargv@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edx
lea    0xe8b(%rip),%rdi
mov    $0x5a,%esi
call   1050 <wrap_malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11da <argv_create+0x9a>
mov    -0x10(%rbp),%rsi
lea    -0x8(%rbp),%rdi
call   1060 <_nextargv@plt>
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    118a <argv_create+0x4a>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<argv_create>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,0x8(%rsp)
call   1030 <_sizeargv@plt>
mov    %eax,%r15d
lea    0x8(,%r15,8),%edx
lea    0xe94(%rip),%rdi
mov    $0x5a,%esi
call   1050 <wrap_malloc@plt>
mov    %rax,%r12
test   %r15d,%r15d
jle    11b8 <argv_create+0x78>
mov    %r15d,%r13d
xor    %ebx,%ebx
lea    0x8(%rsp),%r15
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r14,%rsi
call   1060 <_nextargv@plt>
mov    %rax,(%r12,%rbx,8)
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1040 <assert@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1190 <argv_create+0x50>
jmp    11bb <argv_create+0x7b>
xor    %r13d,%r13d
movq   $0x0,(%r12,%r13,8)
mov    %r12,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [150 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ystk/debian-freeipmi/refs/heads/master/ipmipower/src/argv.c\00"
define i8** @argv_create(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = call i32 @_sizeargv(i8* %8, i8* %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = add nsw i32 %11, 1
%13 = sext i32 %12 to i64
%14 = mul i64 8, %13
%15 = trunc i64 %14 to i32
%16 = call i64 @wrap_malloc(i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str, i64 0, i64 0), i32 90, i32 %15)
%17 = inttoptr i64 %16 to i8**
store i8** %17, i8*** %6
store i32 0, i32* %7
br label %18
18: ; preds = %37, %2
%19 = load i32, i32* %7
%20 = load i32, i32* %5
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %40
22: ; preds = %18
%23 = load i8*, i8** %4
%24 = call i8* @_nextargv(i8** %3, i8* %23)
%25 = load i8**, i8*** %6
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
store i8* %24, i8** %28
%29 = load i8**, i8*** %6
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
%33 = load i8*, i8** %32
%34 = icmp ne i8* %33, null
%35 = zext i1 %34 to i32
%36 = call i32 @assert(i32 %35)
br label %37
37: ; preds = %22
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
br label %18
40: ; preds = %18
%41 = load i8**, i8*** %6
%42 = load i32, i32* %7
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %41, i64 %43
store i8* null, i8** %44
%45 = load i8**, i8*** %6
ret i8** %45
}

LLVM IR (-O2):
@.str = [150 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ystk/debian-freeipmi/refs/heads/master/ipmipower/src/argv.c\00"
define i8** @argv_create(i8* %0, i8* %1) {
%3 = alloca i8*
store i8* %0, i8** %3
%4 = tail call i32 @_sizeargv(i8* %0, i8* %1)
%5 = shl i32 %4, 3
%6 = add i32 %5, 8
%7 = tail call i64 @wrap_malloc(i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str, i64 0, i64 0), i32 90, i32 %6)
%8 = inttoptr i64 %7 to i8**
%9 = icmp sgt i32 %4, 0
br i1 %9, label %10, label %23
10: ; preds = %2
%11 = zext i32 %4 to i64
br label %12
12: ; preds = %10, %12
%13 = phi i64 [ 0, %10 ], [ %19, %12 ]
%14 = call i8* @_nextargv(i8** %3, i8* %1)
%15 = getelementptr inbounds i8*, i8** %8, i64 %13
store i8* %14, i8** %15
%16 = icmp ne i8* %14, null
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = add nuw nsw i64 %13, 1
%20 = icmp eq i64 %19, %11
br i1 %20, label %21, label %12
21: ; preds = %12
%22 = zext i32 %4 to i64
br label %23
23: ; preds = %2, %21
%24 = phi i64 [ %22, %21 ], [ 0, %2 ]
%25 = getelementptr inbounds i8*, i8** %8, i64 %24
store i8* null, i8** %25
ret i8** %8
}