#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*/ myprintf_PR_6697(char *, int, ...);
void test_pr_6697() {
  myprintf_PR_6697("%s\n", 1, "foo");
  myprintf_PR_6697("%s\n", 1, (int)0);
  myprintf_PR_6697("%1$s\n", 1, "foo");
  myprintf_PR_6697("%2$s\n", 1, "foo");
  myprintf_PR_6697("%18$s\n", 1, "foo");
  myprintf_PR_6697("%1$s\n", 1, (int)0);
}


x86 assembly (clang, -O0):
<test_pr_6697>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x1,%esi
lea    0xedd(%rip),%rdx
mov    $0x0,%al
call   1030 <myprintf_PR_6697@plt>
lea    0xecb(%rip),%rdi
mov    $0x1,%esi
xor    %edx,%edx
mov    $0x0,%al
call   1030 <myprintf_PR_6697@plt>
lea    0xebe(%rip),%rdi
mov    $0x1,%esi
lea    0xeae(%rip),%rdx
mov    $0x0,%al
call   1030 <myprintf_PR_6697@plt>
lea    0xeaa(%rip),%rdi
mov    $0x1,%esi
lea    0xe94(%rip),%rdx
mov    $0x0,%al
call   1030 <myprintf_PR_6697@plt>
lea    0xe96(%rip),%rdi
mov    $0x1,%esi
lea    0xe7a(%rip),%rdx
mov    $0x0,%al
call   1030 <myprintf_PR_6697@plt>
lea    0xe70(%rip),%rdi
mov    $0x1,%esi
xor    %edx,%edx
mov    $0x0,%al
call   1030 <myprintf_PR_6697@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_pr_6697>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%rbx
lea    0xee2(%rip),%r14
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <myprintf_PR_6697@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1030 <myprintf_PR_6697@plt>
lea    0xebc(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <myprintf_PR_6697@plt>
lea    0xea9(%rip),%rdi
mov    $0x1,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <myprintf_PR_6697@plt>
lea    0xe99(%rip),%rdi
mov    $0x1,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <myprintf_PR_6697@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %edx,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <myprintf_PR_6697@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [4 x i8] c"foo\00"
@.str.2 = [6 x i8] c"%1$s\0A\00"
@.str.3 = [6 x i8] c"%2$s\0A\00"
@.str.4 = [7 x i8] c"%18$s\0A\00"
define void @test_pr_6697() {
%1 = call i32 (i8*, i32, ...) @myprintf_PR_6697(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 (i8*, i32, ...) @myprintf_PR_6697(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1, i32 0)
%3 = call i32 (i8*, i32, ...) @myprintf_PR_6697(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (i8*, i32, ...) @myprintf_PR_6697(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (i8*, i32, ...) @myprintf_PR_6697(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, i32, ...) @myprintf_PR_6697(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [4 x i8] c"foo\00"
@.str.2 = [6 x i8] c"%1$s\0A\00"
@.str.3 = [6 x i8] c"%2$s\0A\00"
@.str.4 = [7 x i8] c"%18$s\0A\00"
define void @test_pr_6697() {
%1 = tail call i32 (i8*, i32, ...) @myprintf_PR_6697(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (i8*, i32, ...) @myprintf_PR_6697(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1, i32 0)
%3 = tail call i32 (i8*, i32, ...) @myprintf_PR_6697(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (i8*, i32, ...) @myprintf_PR_6697(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i8*, i32, ...) @myprintf_PR_6697(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 (i8*, i32, ...) @myprintf_PR_6697(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 0)
ret void
}