#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*/ sprintf(char *, char *, ...);
int vadigits(unsigned int);
char *valeft(unsigned n) {
  static char fmt[10];
  if (n == 0)
    sprintf(fmt, "%%.0f");
  else
    sprintf(fmt, "%%-%u.0f", vadigits(n));
  return fmt;
}


x86 assembly (clang, -O0):
<valeft>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    114f <valeft+0x2f>
lea    0x2ef5(%rip),%rdi
lea    0xebd(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    116e <valeft+0x4e>
mov    -0x4(%rbp),%edi
call   1030 <vadigits@plt>
mov    %eax,%edx
lea    0x2ed1(%rip),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    0x2ebc(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<valeft>:
push   %rax
test   %edi,%edi
je     1143 <valeft+0x23>
call   1030 <vadigits@plt>
lea    0x2f00(%rip),%rdi
lea    0xece(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
jmp    1158 <valeft+0x38>
lea    0x2ee7(%rip),%rdi
lea    0xeaf(%rip),%rsi
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0x2ed2(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@valeft.fmt = internal global [10 x i8] zeroinitializer
@.str = [6 x i8] c"%%.0f\00"
@.str.1 = [9 x i8] c"%%-%u.0f\00"
define i8* @valeft(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @valeft.fmt, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %11
7: ; preds = %1
%8 = load i32, i32* %2
%9 = call i32 @vadigits(i32 %8)
%10 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @valeft.fmt, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %7, %5
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @valeft.fmt, i64 0, i64 0)
}

LLVM IR (-O2):
@valeft.fmt = internal global [10 x i8] zeroinitializer
@.str = [6 x i8] c"%%.0f\00"
@.str.1 = [9 x i8] c"%%-%u.0f\00"
define i8* @valeft(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @valeft.fmt, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %8
5: ; preds = %1
%6 = tail call i32 @vadigits(i32 %0)
%7 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @valeft.fmt, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %5, %3
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @valeft.fmt, i64 0, i64 0)
}