#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;
char *dynamic_cat(char *, size_t *, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ stderr;
void enqueue(char *queue[], size_t *size, char token[]) {
  *queue = dynamic_cat(*queue, size, token);
  if (!*queue) {
    fprintf(stderr,
            "%s:%d: error: "
            "failed to allocate memory\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/locksten/calc/refs/heads/master/src/"
            "shunting_yard.c",
            139);
    exit(EXIT_FAILURE);
  }
  *queue = dynamic_cat(*queue, size, " ");
  if (!*queue) {
    fprintf(stderr,
            "%s:%d: error: "
            "failed to allocate memory\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/locksten/calc/refs/heads/master/src/"
            "shunting_yard.c",
            145);
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<enqueue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <dynamic_cat@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jne    119f <enqueue+0x6f>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    0xe80(%rip),%rsi
lea    0xea2(%rip),%rdx
mov    $0x8b,%ecx
call   1030 <fprintf@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
lea    0xf06(%rip),%rdx
call   1040 <dynamic_cat@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jne    11fd <enqueue+0xcd>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
lea    0xe22(%rip),%rsi
lea    0xe44(%rip),%rdx
mov    $0x91,%ecx
call   1030 <fprintf@plt>
mov    0x2de2(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enqueue>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1040 <dynamic_cat@plt>
mov    %rax,(%rbx)
test   %rax,%rax
je     116c <enqueue+0x3c>
lea    0xf66(%rip),%rdx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <dynamic_cat@plt>
mov    %rax,(%rbx)
test   %rax,%rax
je     118a <enqueue+0x5a>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
lea    0xe84(%rip),%rsi
lea    0xea6(%rip),%rdx
mov    $0x8b,%ecx
jmp    11a6 <enqueue+0x76>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
lea    0xe66(%rip),%rsi
lea    0xe88(%rip),%rdx
mov    $0x91,%ecx
call   1030 <fprintf@plt>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [41 x i8] c"%s:%d: error: failed to allocate memory\0A\00"
@.str.1 = [142 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/locksten/calc/refs/heads/master/src/shunting_yard.c\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [2 x i8] c" \00"
define void @enqueue(i8** %0, i64* %1, i8* %2) {
%4 = alloca i8**
%5 = alloca i64*
%6 = alloca i8*
store i8** %0, i8*** %4
store i64* %1, i64** %5
store i8* %2, i8** %6
%7 = load i8**, i8*** %4
%8 = load i8*, i8** %7
%9 = load i64*, i64** %5
%10 = load i8*, i8** %6
%11 = call i8* @dynamic_cat(i8* %8, i64* %9, i8* %10)
%12 = load i8**, i8*** %4
store i8* %11, i8** %12
%13 = load i8**, i8*** %4
%14 = load i8*, i8** %13
%15 = icmp ne i8* %14, null
br i1 %15, label %21, label %16
16: ; preds = %3
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0), i32 139)
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %3
%22 = load i8**, i8*** %4
%23 = load i8*, i8** %22
%24 = load i64*, i64** %5
%25 = call i8* @dynamic_cat(i8* %23, i64* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%26 = load i8**, i8*** %4
store i8* %25, i8** %26
%27 = load i8**, i8*** %4
%28 = load i8*, i8** %27
%29 = icmp ne i8* %28, null
br i1 %29, label %35, label %30
30: ; preds = %21
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0), i32 145)
%33 = load i32, i32* @EXIT_FAILURE
%34 = call i32 @exit(i32 %33)
unreachable
35: ; preds = %21
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [41 x i8] c"%s:%d: error: failed to allocate memory\0A\00"
@.str.1 = [142 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/locksten/calc/refs/heads/master/src/shunting_yard.c\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [2 x i8] c" \00"
define void @enqueue(i8** nocapture %0, i64* %1, i8* %2) {
%4 = load i8*, i8** %0
%5 = tail call i8* @dynamic_cat(i8* %4, i64* %1, i8* %2)
store i8* %5, i8** %0
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %12
7: ; preds = %3
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0), i32 139)
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %3
%13 = tail call i8* @dynamic_cat(i8* %5, i64* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i8* %13, i8** %0
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0), i32 145)
%18 = load i32, i32* @EXIT_FAILURE
%19 = tail call i32 @exit(i32 %18)
unreachable
20: ; preds = %12
ret void
}