#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 *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
scalar_t__ strcmp(char *, char *);
void rfg1(void) {
  char buf[100];
  sprintf(buf, "%5.s", "xyz");
  if (strcmp(buf, "     ") != 0)
    printf("got: '%s', expected: '%s'\n", buf, "     ");
  sprintf(buf, "%5.f", 33.3);
  if (strcmp(buf, "   33") != 0)
    printf("got: '%s', expected: '%s'\n", buf, "   33");
  sprintf(buf, "%8.e", 33.3e7);
  if (strcmp(buf, "   3e+08") != 0)
    printf("got: '%s', expected: '%s'\n", buf, "   3e+08");
  sprintf(buf, "%8.E", 33.3e7);
  if (strcmp(buf, "   3E+08") != 0)
    printf("got: '%s', expected: '%s'\n", buf, "   3E+08");
  sprintf(buf, "%.g", 33.3);
  if (strcmp(buf, "3e+01") != 0)
    printf("got: '%s', expected: '%s'\n", buf, "3e+01");
  sprintf(buf, "%.G", 33.3);
  if (strcmp(buf, "3E+01") != 0)
    printf("got: '%s', expected: '%s'\n", buf, "3E+01");
}


x86 assembly (clang, -O0):
<rfg1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x70(%rbp),%rdi
lea    0xecd(%rip),%rsi
lea    0xecb(%rip),%rdx
mov    $0x0,%al
call   1050 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1182 <rfg1+0x52>
lea    -0x70(%rbp),%rsi
lea    0xea9(%rip),%rdi
lea    0xe9c(%rip),%rdx
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
lea    0xead(%rip),%rsi
movsd  0xe6b(%rip),%xmm0
mov    $0x1,%al
call   1050 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11cd <rfg1+0x9d>
lea    -0x70(%rbp),%rsi
lea    0xe5e(%rip),%rdi
lea    0xe77(%rip),%rdx
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe6d(%rip),%rsi
movsd  0xe28(%rip),%xmm0
mov    $0x1,%al
call   1050 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe58(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1218 <rfg1+0xe8>
lea    -0x70(%rbp),%rsi
lea    0xe13(%rip),%rdi
lea    0xe37(%rip),%rdx
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe30(%rip),%rsi
movsd  0xddd(%rip),%xmm0
mov    $0x1,%al
call   1050 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe1b(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1263 <rfg1+0x133>
lea    -0x70(%rbp),%rsi
lea    0xdc8(%rip),%rdi
lea    0xdfa(%rip),%rdx
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
lea    0xdf3(%rip),%rsi
movsd  0xd8a(%rip),%xmm0
mov    $0x1,%al
call   1050 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xddd(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     12ae <rfg1+0x17e>
lea    -0x70(%rbp),%rsi
lea    0xd7d(%rip),%rdi
lea    0xdbc(%rip),%rdx
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
lea    0xdb2(%rip),%rsi
movsd  0xd3f(%rip),%xmm0
mov    $0x1,%al
call   1050 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    0xd9c(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     12f9 <rfg1+0x1c9>
lea    -0x70(%rbp),%rsi
lea    0xd32(%rip),%rdi
lea    0xd7b(%rip),%rdx
call   1030 <printf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rfg1>:
push   %rbx
sub    $0x70,%rsp
lea    0xed4(%rip),%rsi
lea    0xed2(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <sprintf@plt>
lea    0xec2(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     117a <rfg1+0x4a>
lea    0xeb4(%rip),%rdi
lea    0xea7(%rip),%rdx
mov    %rsp,%rsi
call   1030 <printf@plt>
lea    0xeb9(%rip),%rsi
mov    %rsp,%rbx
movsd  0xe74(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <sprintf@plt>
lea    0xea2(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11c0 <rfg1+0x90>
lea    0xe6e(%rip),%rdi
lea    0xe87(%rip),%rdx
mov    %rsp,%rsi
call   1030 <printf@plt>
lea    0xe7e(%rip),%rsi
mov    %rsp,%rbx
movsd  0xe36(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <sprintf@plt>
lea    0xe67(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1206 <rfg1+0xd6>
lea    0xe28(%rip),%rdi
lea    0xe4c(%rip),%rdx
mov    %rsp,%rsi
call   1030 <printf@plt>
lea    0xe46(%rip),%rsi
mov    %rsp,%rbx
movsd  0xdf0(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <sprintf@plt>
lea    0xe2f(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     124c <rfg1+0x11c>
lea    0xde2(%rip),%rdi
lea    0xe14(%rip),%rdx
mov    %rsp,%rsi
call   1030 <printf@plt>
lea    0xe0e(%rip),%rsi
mov    %rsp,%rbx
movsd  0xda2(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <sprintf@plt>
lea    0xdf6(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1292 <rfg1+0x162>
lea    0xd9c(%rip),%rdi
lea    0xddb(%rip),%rdx
mov    %rsp,%rsi
call   1030 <printf@plt>
lea    0xdd2(%rip),%rsi
mov    %rsp,%rbx
movsd  0xd5c(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <sprintf@plt>
lea    0xdba(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12d8 <rfg1+0x1a8>
lea    0xd56(%rip),%rdi
lea    0xd9f(%rip),%rdx
mov    %rsp,%rsi
call   1030 <printf@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%5.s\00"
@.str.1 = [4 x i8] c"xyz\00"
@.str.2 = [6 x i8] c" \00"
@.str.3 = [27 x i8] c"got: '%s', expected: '%s'\0A\00"
@.str.4 = [5 x i8] c"%5.f\00"
@.str.5 = [6 x i8] c" 33\00"
@.str.6 = [5 x i8] c"%8.e\00"
@.str.7 = [9 x i8] c" 3e+08\00"
@.str.8 = [5 x i8] c"%8.E\00"
@.str.9 = [9 x i8] c" 3E+08\00"
@.str.10 = [4 x i8] c"%.g\00"
@.str.11 = [6 x i8] c"3e+01\00"
@.str.12 = [4 x i8] c"%.G\00"
@.str.13 = [6 x i8] c"3E+01\00"
define void @rfg1() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %7, %0
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%12 = call i32 (i8*, i8*, ...) @sprintf(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), double 3.330000e+01)
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %10
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%18 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %19
19: ; preds = %16, %10
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%21 = call i32 (i8*, i8*, ...) @sprintf(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), double 3.330000e+08)
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %19
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%27 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %26, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
br label %28
28: ; preds = %25, %19
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%30 = call i32 (i8*, i8*, ...) @sprintf(i8* %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), double 3.330000e+08)
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %28
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%36 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %35, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
br label %37
37: ; preds = %34, %28
%38 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%39 = call i32 (i8*, i8*, ...) @sprintf(i8* %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), double 3.330000e+01)
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%41 = call i64 @strcmp(i8* %40, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%42 = icmp ne i64 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %37
%44 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%45 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %44, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
br label %46
46: ; preds = %43, %37
%47 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%48 = call i32 (i8*, i8*, ...) @sprintf(i8* %47, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double 3.330000e+01)
%49 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0))
%51 = icmp ne i64 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %46
%53 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%54 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %53, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0))
br label %55
55: ; preds = %52, %46
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%5.s\00"
@.str.1 = [4 x i8] c"xyz\00"
@.str.2 = [6 x i8] c" \00"
@.str.3 = [27 x i8] c"got: '%s', expected: '%s'\0A\00"
@.str.4 = [5 x i8] c"%5.f\00"
@.str.5 = [6 x i8] c" 33\00"
@.str.6 = [5 x i8] c"%8.e\00"
@.str.7 = [9 x i8] c" 3e+08\00"
@.str.8 = [5 x i8] c"%8.E\00"
@.str.9 = [9 x i8] c" 3E+08\00"
@.str.10 = [4 x i8] c"%.g\00"
@.str.11 = [6 x i8] c"3e+01\00"
@.str.12 = [4 x i8] c"%.G\00"
@.str.13 = [6 x i8] c"3E+01\00"
define void @rfg1() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
%9 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), double 3.330000e+01)
%10 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %14
14: ; preds = %12, %8
%15 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), double 3.330000e+08)
%16 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %14
%19 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
br label %20
20: ; preds = %18, %14
%21 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), double 3.330000e+08)
%22 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %20
%25 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
br label %26
26: ; preds = %24, %20
%27 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), double 3.330000e+01)
%28 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %26
%31 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
br label %32
32: ; preds = %30, %26
%33 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double 3.330000e+01)
%34 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %38, label %36
36: ; preds = %32
%37 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0))
br label %38
38: ; preds = %36, %32
ret void
}