#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 */
scalar_t__ utl_calloc(int, int, char *, int);
int utl_check(char *, char *, int);
int /*<<< orphan*/ utl_free(char *, char *, int);
int /*<<< orphan*/ utl_log_check(int, char *, char *, int);
int /*<<< orphan*/ utl_log_close(char *);
int /*<<< orphan*/ utl_log_open(char *, char *);
scalar_t__ utl_malloc(int, char *, int);
int utl_mem_used();
int main(int argc, char *argv[]) {
  char *ptr_a;
  int valid;
  int k;
  utl_log_open("l_mem.log", "w");
  ptr_a = (char *)utl_malloc(32,
                             "/scratch/repos/new/home/jordi_armengol_estape/"
                             "c-scraper/outputs/2022-01-22/02-19-57/repos/"
                             "rdentato/clibutl/refs/heads/master/test/ut_mem.c",
                             35);
  utl_log_check(
      !!(0 == utl_check(ptr_a,
                        "/scratch/repos/new/home/jordi_armengol_estape/"
                        "c-scraper/outputs/2022-01-22/02-19-57/repos/rdentato/"
                        "clibutl/refs/heads/master/test/ut_mem.c",
                        36)),
      "memVALID == memcheck(ptr_a)",
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/rdentato/clibutl/refs/heads/master/test/"
      "ut_mem.c",
      36);
  utl_log_check(!!(32 == utl_mem_used()), "32 == memused()",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/rdentato/clibutl/refs/heads/"
                "master/test/ut_mem.c",
                37);
  utl_free(ptr_a,
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/rdentato/clibutl/refs/heads/master/test/"
           "ut_mem.c",
           39);
  utl_log_check(
      !!(0 != utl_check(ptr_a,
                        "/scratch/repos/new/home/jordi_armengol_estape/"
                        "c-scraper/outputs/2022-01-22/02-19-57/repos/rdentato/"
                        "clibutl/refs/heads/master/test/ut_mem.c",
                        40)),
      "memVALID != memcheck(ptr_a)",
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/rdentato/clibutl/refs/heads/master/test/"
      "ut_mem.c",
      40);
  utl_log_check(!!(0 == utl_mem_used()), "0 == memused()",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/rdentato/clibutl/refs/heads/"
                "master/test/ut_mem.c",
                41);
  utl_free(ptr_a,
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/rdentato/clibutl/refs/heads/master/test/"
           "ut_mem.c",
           43);
  utl_log_check(
      !!(0 != utl_check(ptr_a,
                        "/scratch/repos/new/home/jordi_armengol_estape/"
                        "c-scraper/outputs/2022-01-22/02-19-57/repos/rdentato/"
                        "clibutl/refs/heads/master/test/ut_mem.c",
                        44)),
      "memVALID != memcheck(ptr_a)",
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/rdentato/clibutl/refs/heads/master/test/"
      "ut_mem.c",
      44);
  ptr_a = (char *)utl_malloc(0,
                             "/scratch/repos/new/home/jordi_armengol_estape/"
                             "c-scraper/outputs/2022-01-22/02-19-57/repos/"
                             "rdentato/clibutl/refs/heads/master/test/ut_mem.c",
                             46);
  utl_log_check(
      !!(0 == utl_check(ptr_a,
                        "/scratch/repos/new/home/jordi_armengol_estape/"
                        "c-scraper/outputs/2022-01-22/02-19-57/repos/rdentato/"
                        "clibutl/refs/heads/master/test/ut_mem.c",
                        47)),
      "memVALID == memcheck(ptr_a)",
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/rdentato/clibutl/refs/heads/master/test/"
      "ut_mem.c",
      47);
  utl_free(ptr_a,
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/rdentato/clibutl/refs/heads/master/test/"
           "ut_mem.c",
           49);
  ptr_a = (char *)utl_calloc(8, 4,
                             "/scratch/repos/new/home/jordi_armengol_estape/"
                             "c-scraper/outputs/2022-01-22/02-19-57/repos/"
                             "rdentato/clibutl/refs/heads/master/test/ut_mem.c",
                             50);
  utl_log_check(
      !!(0 == utl_check(ptr_a,
                        "/scratch/repos/new/home/jordi_armengol_estape/"
                        "c-scraper/outputs/2022-01-22/02-19-57/repos/rdentato/"
                        "clibutl/refs/heads/master/test/ut_mem.c",
                        51)),
      "memVALID == memcheck(ptr_a)",
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/rdentato/clibutl/refs/heads/master/test/"
      "ut_mem.c",
      51);
  for (k = 0, valid = 0; k < 32; k++)
    valid += ptr_a[k];
  utl_log_check(!!(0 == valid), "0 == valid",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/rdentato/clibutl/refs/heads/"
                "master/test/ut_mem.c",
                54);
  utl_free(ptr_a,
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/rdentato/clibutl/refs/heads/master/test/"
           "ut_mem.c",
           55);
  ptr_a = (char *)utl_malloc(16,
                             "/scratch/repos/new/home/jordi_armengol_estape/"
                             "c-scraper/outputs/2022-01-22/02-19-57/repos/"
                             "rdentato/clibutl/refs/heads/master/test/ut_mem.c",
                             57);
  utl_log_check(
      !!(0 == utl_check(ptr_a,
                        "/scratch/repos/new/home/jordi_armengol_estape/"
                        "c-scraper/outputs/2022-01-22/02-19-57/repos/rdentato/"
                        "clibutl/refs/heads/master/test/ut_mem.c",
                        58)),
      "memVALID == memcheck(ptr_a)",
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/rdentato/clibutl/refs/heads/master/test/"
      "ut_mem.c",
      58);
  utl_log_check(!!(16 == utl_mem_used()), "16 == memused()",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/rdentato/clibutl/refs/heads/"
                "master/test/ut_mem.c",
                59);
  ptr_a[16] = '\0';
  utl_log_check(
      !!(-1 == utl_check(ptr_a,
                         "/scratch/repos/new/home/jordi_armengol_estape/"
                         "c-scraper/outputs/2022-01-22/02-19-57/repos/rdentato/"
                         "clibutl/refs/heads/master/test/ut_mem.c",
                         62)),
      "memOVERFLOW == memcheck(ptr_a)",
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/rdentato/clibutl/refs/heads/master/test/"
      "ut_mem.c",
      62);
  utl_free(ptr_a,
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/rdentato/clibutl/refs/heads/master/test/"
           "ut_mem.c",
           63);
  utl_log_close("LOG STOP");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe63(%rip),%rdi
lea    0xe66(%rip),%rsi
call   10a0 <utl_log_open@plt>
mov    $0x20,%edi
lea    0xe57(%rip),%rsi
mov    $0x23,%edx
call   1080 <utl_malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe3e(%rip),%rsi
mov    $0x24,%edx
call   1050 <utl_check@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xea6(%rip),%rsi
lea    0xe14(%rip),%rdx
mov    $0x24,%ecx
call   1030 <utl_log_check@plt>
mov    $0x0,%al
call   1090 <utl_mem_used@plt>
mov    %eax,%ecx
mov    $0x20,%eax
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xe8e(%rip),%rsi
lea    0xde0(%rip),%rdx
mov    $0x25,%ecx
call   1030 <utl_log_check@plt>
mov    -0x18(%rbp),%rdi
lea    0xdcb(%rip),%rsi
mov    $0x27,%edx
call   1060 <utl_free@plt>
mov    -0x18(%rbp),%rdi
lea    0xdb6(%rip),%rsi
mov    $0x28,%edx
call   1050 <utl_check@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xe4a(%rip),%rsi
lea    0xd8c(%rip),%rdx
mov    $0x28,%ecx
call   1030 <utl_log_check@plt>
mov    $0x0,%al
call   1090 <utl_mem_used@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xe35(%rip),%rsi
lea    0xd5b(%rip),%rdx
mov    $0x29,%ecx
call   1030 <utl_log_check@plt>
mov    -0x18(%rbp),%rdi
lea    0xd46(%rip),%rsi
mov    $0x2b,%edx
call   1060 <utl_free@plt>
mov    -0x18(%rbp),%rdi
lea    0xd31(%rip),%rsi
mov    $0x2c,%edx
call   1050 <utl_check@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xdc5(%rip),%rsi
lea    0xd07(%rip),%rdx
mov    $0x2c,%ecx
call   1030 <utl_log_check@plt>
xor    %edi,%edi
lea    0xcf4(%rip),%rsi
mov    $0x2e,%edx
call   1080 <utl_malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xcdb(%rip),%rsi
mov    $0x2f,%edx
call   1050 <utl_check@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xd43(%rip),%rsi
lea    0xcb1(%rip),%rdx
mov    $0x2f,%ecx
call   1030 <utl_log_check@plt>
mov    -0x18(%rbp),%rdi
lea    0xc9c(%rip),%rsi
mov    $0x31,%edx
call   1060 <utl_free@plt>
mov    $0x8,%edi
mov    $0x4,%esi
lea    0xc81(%rip),%rdx
mov    $0x32,%ecx
call   1070 <utl_calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xc68(%rip),%rsi
mov    $0x33,%edx
call   1050 <utl_check@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xcd0(%rip),%rsi
lea    0xc3e(%rip),%rdx
mov    $0x33,%ecx
call   1030 <utl_log_check@plt>
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x20,-0x20(%rbp)
jge    1410 <main+0x290>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    13e6 <main+0x266>
xor    %eax,%eax
cmp    -0x1c(%rbp),%eax
sete   %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xcc6(%rip),%rsi
lea    0xbdd(%rip),%rdx
mov    $0x36,%ecx
call   1030 <utl_log_check@plt>
mov    -0x18(%rbp),%rdi
lea    0xbc8(%rip),%rsi
mov    $0x37,%edx
call   1060 <utl_free@plt>
mov    $0x10,%edi
lea    0xbb2(%rip),%rsi
mov    $0x39,%edx
call   1080 <utl_malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xb99(%rip),%rsi
mov    $0x3a,%edx
call   1050 <utl_check@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xc01(%rip),%rsi
lea    0xb6f(%rip),%rdx
mov    $0x3a,%ecx
call   1030 <utl_log_check@plt>
mov    $0x0,%al
call   1090 <utl_mem_used@plt>
mov    %eax,%ecx
mov    $0x10,%eax
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xc2f(%rip),%rsi
lea    0xb3b(%rip),%rdx
mov    $0x3b,%ecx
call   1030 <utl_log_check@plt>
mov    -0x18(%rbp),%rax
movb   $0x0,0x10(%rax)
mov    -0x18(%rbp),%rdi
lea    0xb1e(%rip),%rsi
mov    $0x3e,%edx
call   1050 <utl_check@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
sete   %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xbf5(%rip),%rsi
lea    0xaf1(%rip),%rdx
mov    $0x3e,%ecx
call   1030 <utl_log_check@plt>
mov    -0x18(%rbp),%rdi
lea    0xadc(%rip),%rsi
mov    $0x3f,%edx
call   1060 <utl_free@plt>
lea    0xbe7(%rip),%rdi
call   1040 <utl_log_close@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xe71(%rip),%rdi
lea    0xe74(%rip),%rsi
call   10a0 <utl_log_open@plt>
lea    0xe6a(%rip),%r15
mov    $0x20,%edi
mov    %r15,%rsi
mov    $0x23,%edx
call   1080 <utl_malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    $0x24,%edx
call   1050 <utl_check@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
lea    0xec1(%rip),%r14
mov    %r14,%rsi
mov    %r15,%rdx
mov    $0x24,%ecx
call   1030 <utl_log_check@plt>
xor    %eax,%eax
call   1090 <utl_mem_used@plt>
xor    %edi,%edi
cmp    $0x20,%eax
sete   %dil
lea    0xeb6(%rip),%rsi
mov    %r15,%rdx
mov    $0x25,%ecx
call   1030 <utl_log_check@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x27,%edx
call   1060 <utl_free@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x28,%edx
call   1050 <utl_check@plt>
xor    %edi,%edi
test   %eax,%eax
setne  %dil
lea    0xe8a(%rip),%r12
mov    %r12,%rsi
mov    %r15,%rdx
mov    $0x28,%ecx
call   1030 <utl_log_check@plt>
xor    %eax,%eax
call   1090 <utl_mem_used@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
lea    0xe80(%rip),%rsi
mov    %r15,%rdx
mov    $0x29,%ecx
call   1030 <utl_log_check@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x2b,%edx
call   1060 <utl_free@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x2c,%edx
call   1050 <utl_check@plt>
xor    %edi,%edi
test   %eax,%eax
setne  %dil
mov    %r12,%rsi
mov    %r15,%rdx
mov    $0x2c,%ecx
call   1030 <utl_log_check@plt>
xor    %edi,%edi
mov    %r15,%rsi
mov    $0x2e,%edx
call   1080 <utl_malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    $0x2f,%edx
call   1050 <utl_check@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
mov    %r14,%rsi
mov    %r15,%rdx
mov    $0x2f,%ecx
call   1030 <utl_log_check@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x31,%edx
call   1060 <utl_free@plt>
mov    $0x8,%edi
mov    $0x4,%esi
mov    %r15,%rdx
mov    $0x32,%ecx
call   1070 <utl_calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    $0x33,%edx
call   1050 <utl_check@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
mov    %r14,%rsi
mov    %r15,%rdx
mov    $0x33,%ecx
call   1030 <utl_log_check@plt>
movdqu (%rbx),%xmm0
punpckhbw %xmm0,%xmm1
punpcklwd %xmm1,%xmm2
psrad  $0x18,%xmm2
punpcklbw %xmm0,%xmm0
punpcklwd %xmm0,%xmm3
psrad  $0x18,%xmm3
paddd  %xmm2,%xmm3
punpckhwd %xmm1,%xmm1
psrad  $0x18,%xmm1
punpckhwd %xmm0,%xmm0
psrad  $0x18,%xmm0
paddd  %xmm1,%xmm0
paddd  %xmm3,%xmm0
movq   0x10(%rbx),%xmm1
punpcklbw %xmm1,%xmm1
punpckhwd %xmm1,%xmm2
psrad  $0x18,%xmm2
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm2,%xmm1
movsbl 0x18(%rbx),%eax
movsbl 0x19(%rbx),%ecx
movsbl 0x1a(%rbx),%edx
movsbl 0x1b(%rbx),%r11d
movsbl 0x1c(%rbx),%r10d
movsbl 0x1d(%rbx),%r8d
movsbl 0x1e(%rbx),%r9d
pshufd $0xee,%xmm0,%xmm2
paddd  %xmm0,%xmm2
pshufd $0x55,%xmm2,%xmm0
paddd  %xmm2,%xmm0
movd   %xmm0,%edi
pshufd $0xee,%xmm1,%xmm0
paddd  %xmm1,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%esi
add    %edi,%esi
add    %eax,%esi
add    %ecx,%esi
add    %edx,%esi
add    %r11d,%esi
add    %r10d,%esi
add    %r8d,%esi
add    %r9d,%esi
movsbl 0x1f(%rbx),%eax
xor    %edi,%edi
add    %esi,%eax
sete   %dil
lea    0xcf0(%rip),%rsi
mov    %r15,%rdx
mov    $0x36,%ecx
call   1030 <utl_log_check@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x37,%edx
call   1060 <utl_free@plt>
mov    $0x10,%edi
mov    %r15,%rsi
mov    $0x39,%edx
call   1080 <utl_malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    $0x3a,%edx
call   1050 <utl_check@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
mov    %r14,%rsi
mov    %r15,%rdx
mov    $0x3a,%ecx
call   1030 <utl_log_check@plt>
xor    %eax,%eax
call   1090 <utl_mem_used@plt>
xor    %edi,%edi
cmp    $0x10,%eax
sete   %dil
lea    0xc8a(%rip),%rsi
mov    %r15,%rdx
mov    $0x3b,%ecx
call   1030 <utl_log_check@plt>
movb   $0x0,0x10(%rbx)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x3e,%edx
call   1050 <utl_check@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
lea    0xc69(%rip),%rsi
mov    %r15,%rdx
mov    $0x3e,%ecx
call   1030 <utl_log_check@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x3f,%edx
call   1060 <utl_free@plt>
lea    0xc64(%rip),%rdi
call   1040 <utl_log_close@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"l_mem.log\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [139 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/rdentato/clibutl/refs/heads/master/test/ut_mem.c\00"
@.str.3 = [28 x i8] c"memVALID == memcheck(ptr_a)\00"
@.str.4 = [16 x i8] c"32 == memused()\00"
@.str.5 = [28 x i8] c"memVALID != memcheck(ptr_a)\00"
@.str.6 = [15 x i8] c"0 == memused()\00"
@.str.7 = [11 x i8] c"0 == valid\00"
@.str.8 = [16 x i8] c"16 == memused()\00"
@.str.9 = [31 x i8] c"memOVERFLOW == memcheck(ptr_a)\00"
@.str.10 = [9 x i8] c"LOG STOP\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @utl_log_open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = call i64 @utl_malloc(i32 32, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 35)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %6
%12 = load i8*, i8** %6
%13 = call i32 @utl_check(i8* %12, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 36)
%14 = icmp eq i32 0, %13
%15 = xor i1 %14, true
%16 = xor i1 %15, true
%17 = zext i1 %16 to i32
%18 = call i32 @utl_log_check(i32 %17, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 36)
%19 = call i32 (...) @utl_mem_used()
%20 = icmp eq i32 32, %19
%21 = xor i1 %20, true
%22 = xor i1 %21, true
%23 = zext i1 %22 to i32
%24 = call i32 @utl_log_check(i32 %23, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 37)
%25 = load i8*, i8** %6
%26 = call i32 @utl_free(i8* %25, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 39)
%27 = load i8*, i8** %6
%28 = call i32 @utl_check(i8* %27, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 40)
%29 = icmp ne i32 0, %28
%30 = xor i1 %29, true
%31 = xor i1 %30, true
%32 = zext i1 %31 to i32
%33 = call i32 @utl_log_check(i32 %32, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 40)
%34 = call i32 (...) @utl_mem_used()
%35 = icmp eq i32 0, %34
%36 = xor i1 %35, true
%37 = xor i1 %36, true
%38 = zext i1 %37 to i32
%39 = call i32 @utl_log_check(i32 %38, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 41)
%40 = load i8*, i8** %6
%41 = call i32 @utl_free(i8* %40, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 43)
%42 = load i8*, i8** %6
%43 = call i32 @utl_check(i8* %42, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 44)
%44 = icmp ne i32 0, %43
%45 = xor i1 %44, true
%46 = xor i1 %45, true
%47 = zext i1 %46 to i32
%48 = call i32 @utl_log_check(i32 %47, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 44)
%49 = call i64 @utl_malloc(i32 0, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 46)
%50 = inttoptr i64 %49 to i8*
store i8* %50, i8** %6
%51 = load i8*, i8** %6
%52 = call i32 @utl_check(i8* %51, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 47)
%53 = icmp eq i32 0, %52
%54 = xor i1 %53, true
%55 = xor i1 %54, true
%56 = zext i1 %55 to i32
%57 = call i32 @utl_log_check(i32 %56, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 47)
%58 = load i8*, i8** %6
%59 = call i32 @utl_free(i8* %58, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 49)
%60 = call i64 @utl_calloc(i32 8, i32 4, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 50)
%61 = inttoptr i64 %60 to i8*
store i8* %61, i8** %6
%62 = load i8*, i8** %6
%63 = call i32 @utl_check(i8* %62, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 51)
%64 = icmp eq i32 0, %63
%65 = xor i1 %64, true
%66 = xor i1 %65, true
%67 = zext i1 %66 to i32
%68 = call i32 @utl_log_check(i32 %67, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 51)
store i32 0, i32* %8
store i32 0, i32* %7
br label %69
69: ; preds = %81, %2
%70 = load i32, i32* %8
%71 = icmp slt i32 %70, 32
br i1 %71, label %72, label %84
72: ; preds = %69
%73 = load i8*, i8** %6
%74 = load i32, i32* %8
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8, i8* %73, i64 %75
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = load i32, i32* %7
%80 = add nsw i32 %79, %78
store i32 %80, i32* %7
br label %81
81: ; preds = %72
%82 = load i32, i32* %8
%83 = add nsw i32 %82, 1
store i32 %83, i32* %8
br label %69
84: ; preds = %69
%85 = load i32, i32* %7
%86 = icmp eq i32 0, %85
%87 = xor i1 %86, true
%88 = xor i1 %87, true
%89 = zext i1 %88 to i32
%90 = call i32 @utl_log_check(i32 %89, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 54)
%91 = load i8*, i8** %6
%92 = call i32 @utl_free(i8* %91, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 55)
%93 = call i64 @utl_malloc(i32 16, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 57)
%94 = inttoptr i64 %93 to i8*
store i8* %94, i8** %6
%95 = load i8*, i8** %6
%96 = call i32 @utl_check(i8* %95, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 58)
%97 = icmp eq i32 0, %96
%98 = xor i1 %97, true
%99 = xor i1 %98, true
%100 = zext i1 %99 to i32
%101 = call i32 @utl_log_check(i32 %100, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 58)
%102 = call i32 (...) @utl_mem_used()
%103 = icmp eq i32 16, %102
%104 = xor i1 %103, true
%105 = xor i1 %104, true
%106 = zext i1 %105 to i32
%107 = call i32 @utl_log_check(i32 %106, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 59)
%108 = load i8*, i8** %6
%109 = getelementptr inbounds i8, i8* %108, i64 16
store i8 0, i8* %109
%110 = load i8*, i8** %6
%111 = call i32 @utl_check(i8* %110, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 62)
%112 = icmp eq i32 -1, %111
%113 = xor i1 %112, true
%114 = xor i1 %113, true
%115 = zext i1 %114 to i32
%116 = call i32 @utl_log_check(i32 %115, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 62)
%117 = load i8*, i8** %6
%118 = call i32 @utl_free(i8* %117, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 63)
%119 = call i32 @utl_log_close(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"l_mem.log\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [139 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/rdentato/clibutl/refs/heads/master/test/ut_mem.c\00"
@.str.3 = [28 x i8] c"memVALID == memcheck(ptr_a)\00"
@.str.4 = [16 x i8] c"32 == memused()\00"
@.str.5 = [28 x i8] c"memVALID != memcheck(ptr_a)\00"
@.str.6 = [15 x i8] c"0 == memused()\00"
@.str.7 = [11 x i8] c"0 == valid\00"
@.str.8 = [16 x i8] c"16 == memused()\00"
@.str.9 = [31 x i8] c"memOVERFLOW == memcheck(ptr_a)\00"
@.str.10 = [9 x i8] c"LOG STOP\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @utl_log_open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i64 @utl_malloc(i32 32, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 35)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @utl_check(i8* %5, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 36)
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @utl_log_check(i32 %8, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 36)
%10 = tail call i32 (...) @utl_mem_used()
%11 = icmp eq i32 %10, 32
%12 = zext i1 %11 to i32
%13 = tail call i32 @utl_log_check(i32 %12, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 37)
%14 = tail call i32 @utl_free(i8* %5, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 39)
%15 = tail call i32 @utl_check(i8* %5, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 40)
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i32
%18 = tail call i32 @utl_log_check(i32 %17, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 40)
%19 = tail call i32 (...) @utl_mem_used()
%20 = icmp eq i32 %19, 0
%21 = zext i1 %20 to i32
%22 = tail call i32 @utl_log_check(i32 %21, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 41)
%23 = tail call i32 @utl_free(i8* %5, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 43)
%24 = tail call i32 @utl_check(i8* %5, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 44)
%25 = icmp ne i32 %24, 0
%26 = zext i1 %25 to i32
%27 = tail call i32 @utl_log_check(i32 %26, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 44)
%28 = tail call i64 @utl_malloc(i32 0, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 46)
%29 = inttoptr i64 %28 to i8*
%30 = tail call i32 @utl_check(i8* %29, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 47)
%31 = icmp eq i32 %30, 0
%32 = zext i1 %31 to i32
%33 = tail call i32 @utl_log_check(i32 %32, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 47)
%34 = tail call i32 @utl_free(i8* %29, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 49)
%35 = tail call i64 @utl_calloc(i32 8, i32 4, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 50)
%36 = inttoptr i64 %35 to i8*
%37 = tail call i32 @utl_check(i8* %36, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 51)
%38 = icmp eq i32 %37, 0
%39 = zext i1 %38 to i32
%40 = tail call i32 @utl_log_check(i32 %39, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 51)
%41 = inttoptr i64 %35 to <16 x i8>*
%42 = load <16 x i8>, <16 x i8>* %41
%43 = sext <16 x i8> %42 to <16 x i32>
%44 = getelementptr inbounds i8, i8* %36, i64 16
%45 = bitcast i8* %44 to <8 x i8>*
%46 = load <8 x i8>, <8 x i8>* %45
%47 = sext <8 x i8> %46 to <8 x i32>
%48 = getelementptr inbounds i8, i8* %36, i64 24
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = getelementptr inbounds i8, i8* %36, i64 25
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = getelementptr inbounds i8, i8* %36, i64 26
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = getelementptr inbounds i8, i8* %36, i64 27
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = getelementptr inbounds i8, i8* %36, i64 28
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = getelementptr inbounds i8, i8* %36, i64 29
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = getelementptr inbounds i8, i8* %36, i64 30
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %43)
%70 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %47)
%71 = add nsw i32 %69, %70
%72 = add nsw i32 %71, %50
%73 = add nsw i32 %72, %53
%74 = add nsw i32 %73, %56
%75 = add nsw i32 %74, %59
%76 = add nsw i32 %75, %62
%77 = add nsw i32 %76, %65
%78 = add nsw i32 %77, %68
%79 = getelementptr inbounds i8, i8* %36, i64 31
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
%82 = sub nsw i32 0, %81
%83 = icmp eq i32 %78, %82
%84 = zext i1 %83 to i32
%85 = tail call i32 @utl_log_check(i32 %84, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 54)
%86 = tail call i32 @utl_free(i8* %36, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 55)
%87 = tail call i64 @utl_malloc(i32 16, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 57)
%88 = inttoptr i64 %87 to i8*
%89 = tail call i32 @utl_check(i8* %88, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 58)
%90 = icmp eq i32 %89, 0
%91 = zext i1 %90 to i32
%92 = tail call i32 @utl_log_check(i32 %91, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 58)
%93 = tail call i32 (...) @utl_mem_used()
%94 = icmp eq i32 %93, 16
%95 = zext i1 %94 to i32
%96 = tail call i32 @utl_log_check(i32 %95, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 59)
%97 = getelementptr inbounds i8, i8* %88, i64 16
store i8 0, i8* %97
%98 = tail call i32 @utl_check(i8* %88, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 62)
%99 = icmp eq i32 %98, -1
%100 = zext i1 %99 to i32
%101 = tail call i32 @utl_log_check(i32 %100, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 62)
%102 = tail call i32 @utl_free(i8* %88, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.2, i64 0, i64 0), i32 63)
%103 = tail call i32 @utl_log_close(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0))
ret i32 0
}