#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 *, long);
void test() {
  int justRight = 1;
  long tooLong = 2;
  printf("%D", justRight);
  printf("%D", tooLong);
  printf("%U", justRight);
  printf("%U", tooLong);
  printf("%O", justRight);
  printf("%O", tooLong);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
movq   $0x2,-0x10(%rbp)
movslq -0x4(%rbp),%rsi
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
movslq -0x4(%rbp),%rsi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
movslq -0x4(%rbp),%rsi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    $0x1,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    $0x2,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xeca(%rip),%rbx
mov    $0x1,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    $0x2,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xeac(%rip),%rbx
mov    $0x1,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    $0x2,%esi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%D\00"
@.str.1 = [3 x i8] c"%U\00"
@.str.2 = [3 x i8] c"%O\00"
define void @test() {
%1 = alloca i32
%2 = alloca i64
store i32 1, i32* %1
store i64 2, i64* %2
%3 = load i32, i32* %1
%4 = sext i32 %3 to i64
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 %4)
%6 = load i64, i64* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 %6)
%8 = load i32, i32* %1
%9 = sext i32 %8 to i64
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 %9)
%11 = load i64, i64* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 %11)
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 %14)
%16 = load i64, i64* %2
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 %16)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%D\00"
@.str.1 = [3 x i8] c"%U\00"
@.str.2 = [3 x i8] c"%O\00"
define void @test() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 2)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 2)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 1)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 2)
ret void
}