#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*/ printf(char *, ...);
void pippo() {
  unsigned char foo[4];
  int i;
  printf("%64u%n", 1, (int *)foo);
  printf("%1$16u%2$n"
         "%1$16u%3$n"
         "%1$32u%4$n"
         "%1$64u%5$n",
         1, (int *)&foo[0], (int *)&foo[1], (int *)&foo[2], (int *)&foo[3]);
  printf("\n");
  for (i = 0; i < 4; i++)
    printf("%x", foo[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<pippo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdx
lea    0xedd(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x4(%rbp),%rdx
lea    -0x4(%rbp),%rcx
add    $0x1,%rcx
lea    -0x4(%rbp),%r8
add    $0x2,%r8
lea    -0x4(%rbp),%r9
add    $0x3,%r9
lea    0xeb5(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11a2 <pippo+0x92>
movslq -0x8(%rbp),%rax
movzbl -0x4(%rbp,%rax,1),%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1173 <pippo+0x63>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pippo>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    $0x1,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd(%rsp),%rcx
lea    0xe(%rsp),%r8
lea    0xf(%rsp),%r9
lea    0xeb1(%rip),%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movzbl 0xc(%rsp),%esi
lea    0xeb5(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xd(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xe(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xf(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%64u%n\00"
@.str.1 = [41 x i8] c"%1$16u%2$n%1$16u%3$n%1$32u%4$n%1$64u%5$n\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [3 x i8] c"%x\00"
define void @pippo() {
%1 = alloca [4 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%4 = bitcast i8* %3 to i32*
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 1, i32* %4)
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%7 = bitcast i8* %6 to i32*
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 1
%9 = bitcast i8* %8 to i32*
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 2
%11 = bitcast i8* %10 to i32*
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 3
%13 = bitcast i8* %12 to i32*
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 1, i32* %7, i32* %9, i32* %11, i32* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
br label %16
16: ; preds = %26, %0
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 4
br i1 %18, label %19, label %29
19: ; preds = %16
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %19
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %16
29: ; preds = %16
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%64u%n\00"
@.str.1 = [41 x i8] c"%1$16u%2$n%1$16u%3$n%1$32u%4$n%1$64u%5$n\00"
@.str.3 = [3 x i8] c"%x\00"
define void @pippo() {
%1 = alloca i32
%2 = bitcast i32* %1 to [4 x i8]*
%3 = bitcast i32* %1 to i8*
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 1, i32* %1)
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 1, i32* %1, i8* %5, i8* %6, i8* %7)
%9 = call i32 @putchar(i32 10)
%10 = bitcast i32* %1 to i8*
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = load i8, i8* %5
%15 = zext i8 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = load i8, i8* %6
%18 = zext i8 %17 to i32
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = load i8, i8* %7
%21 = zext i8 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = call i32 @putchar(i32 10)
ret void
}