#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 *malloc(int);
int /*<<< orphan*/ roadmap_check_allocated_with_source_line(char *, int,
                                                            char *);
int /*<<< orphan*/ strncpy(char *, char const *, int);
char *roadmap_object_string(const char *data, int length) {
  char *p = malloc(length + 1);
  roadmap_check_allocated_with_source_line(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/maximuska/Freemap-waze/refs/heads/master/"
      "roadmap_screen_obj.c",
      126, p);
  strncpy(p, data, length);
  p[length] = 0;
  return p;
}


x86 assembly (clang, -O0):
<roadmap_object_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdx
lea    0xea7(%rip),%rdi
mov    $0x7e,%esi
call   1040 <roadmap_check_allocated_with_source_line@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roadmap_object_string>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%r15d
mov    %rdi,%r14
lea    0x1(%r15),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xeb2(%rip),%rdi
mov    $0x7e,%esi
mov    %rax,%rdx
call   1040 <roadmap_check_allocated_with_source_line@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <strncpy@plt>
movslq %r15d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [152 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/maximuska/Freemap-waze/refs/heads/master/roadmap_screen_obj.c\00"
define i8* @roadmap_object_string(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = add nsw i32 %6, 1
%8 = call i8* @malloc(i32 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = call i32 @roadmap_check_allocated_with_source_line(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str, i64 0, i64 0), i32 126, i8* %9)
%11 = load i8*, i8** %5
%12 = load i8*, i8** %3
%13 = load i32, i32* %4
%14 = call i32 @strncpy(i8* %11, i8* %12, i32 %13)
%15 = load i8*, i8** %5
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
store i8 0, i8* %18
%19 = load i8*, i8** %5
ret i8* %19
}

LLVM IR (-O2):
@.str = [152 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/maximuska/Freemap-waze/refs/heads/master/roadmap_screen_obj.c\00"
define i8* @roadmap_object_string(i8* %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 @roadmap_check_allocated_with_source_line(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str, i64 0, i64 0), i32 126, i8* %4)
%6 = tail call i32 @strncpy(i8* %4, i8* %0, i32 %1)
%7 = sext i32 %1 to i64
%8 = getelementptr inbounds i8, i8* %4, i64 %7
store i8 0, i8* %8
ret i8* %4
}