#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*/ ptr_is(char *, int, char *, char *, char *);
char *strncpy(char *, char *, int);
void test_ptr() {
  char buffer[16];
  char *res;
setup:
exercise:
  res = strncpy(&buffer[0], "foo", sizeof buffer);
verify:
  ptr_is("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/fperrad/tap4embedded/refs/heads/master/"
         "example/t.windows/11-strncpy.c",
         26, (res), (&buffer[0]), ("returned pointer"));
teardown:
  return;
}


x86 assembly (clang, -O0):
<test_ptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
jmp    112d <test_ptr+0xd>
lea    -0x10(%rbp),%rdi
lea    0xec8(%rip),%rsi
mov    $0x10,%edx
call   1030 <strncpy@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    0xeaf(%rip),%rdi
mov    $0x1a,%esi
lea    0xf43(%rip),%r8
call   1040 <ptr_is@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ptr>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x10,%edx
call   1030 <strncpy@plt>
lea    0xec1(%rip),%rdi
lea    0xf5a(%rip),%r8
mov    $0x1a,%esi
mov    %rax,%rdx
mov    %rbx,%rcx
call   1040 <ptr_is@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"foo\00"
@.str.1 = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fperrad/tap4embedded/refs/heads/master/example/t.windows/11-strncpy.c\00"
@.str.2 = [17 x i8] c"returned pointer\00"
define void @test_ptr() {
%1 = alloca [16 x i8]
%2 = alloca i8*
br label %3
3: ; preds = %0
br label %4
4: ; preds = %3
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%6 = call i8* @strncpy(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 16)
store i8* %6, i8** %2
br label %7
7: ; preds = %4
%8 = load i8*, i8** %2
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%10 = call i32 @ptr_is(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str.1, i64 0, i64 0), i32 26, i8* %8, i8* %9, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %11
11: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"foo\00"
@.str.1 = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fperrad/tap4embedded/refs/heads/master/example/t.windows/11-strncpy.c\00"
@.str.2 = [17 x i8] c"returned pointer\00"
define void @test_ptr() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = call i8* @strncpy(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 16)
%4 = call i32 @ptr_is(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str.1, i64 0, i64 0), i32 26, i8* %3, i8* %2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
ret void
}