#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*/ assert(int);
int /*<<< orphan*/ getTileString(char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcmp(char *, char *);
void testPadding() {
  printf("testPadding\n");
  char buffer[4];
  getTileString(buffer, 2);
  assert(!strcmp(buffer, "2  "));
  printf(".");
  getTileString(buffer, 32);
  assert(!strcmp(buffer, "32 "));
  printf(".");
  getTileString(buffer, 128);
  assert(!strcmp(buffer, "128"));
  printf(".");
  printf("\ntestPadding successful.\n");
}


x86 assembly (clang, -O0):
<testPadding>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
lea    -0x4(%rbp),%rdi
mov    $0x2,%esi
call   1040 <getTileString@plt>
lea    -0x4(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
lea    -0x4(%rbp),%rdi
mov    $0x20,%esi
call   1040 <getTileString@plt>
lea    -0x4(%rbp),%rdi
lea    0xe6a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xe4a(%rip),%rdi
call   1030 <printf@plt>
lea    -0x4(%rbp),%rdi
mov    $0x80,%esi
call   1040 <getTileString@plt>
lea    -0x4(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xe0e(%rip),%rdi
call   1030 <printf@plt>
lea    0xe0c(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testPadding>:
push   %rbx
sub    $0x10,%rsp
lea    0xec0(%rip),%rdi
call   1040 <puts@plt>
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <getTileString@plt>
xor    %edi,%edi
cmpl   $0x202032,0xc(%rsp)
sete   %dil
call   1060 <assert@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
call   1050 <getTileString@plt>
xor    %edi,%edi
cmpl   $0x203233,0xc(%rsp)
sete   %dil
call   1060 <assert@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x80,%esi
call   1050 <getTileString@plt>
xor    %edi,%edi
cmpl   $0x383231,0xc(%rsp)
sete   %dil
call   1060 <assert@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
lea    0xe3d(%rip),%rdi
call   1040 <puts@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"testPadding\0A\00"
@.str.1 = [4 x i8] c"2 \00"
@.str.2 = [2 x i8] c".\00"
@.str.3 = [4 x i8] c"32 \00"
@.str.4 = [4 x i8] c"128\00"
@.str.5 = [26 x i8] c"\0AtestPadding successful.\0A\00"
define void @testPadding() {
%1 = alloca [4 x i8]
%2 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%4 = call i32 @getTileString(i8* %3, i32 2)
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%6 = call i32 @strcmp(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%13 = call i32 @getTileString(i8* %12, i32 32)
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%21 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%22 = call i32 @getTileString(i8* %21, i32 128)
%23 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%24 = call i32 @strcmp(i8* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%25 = icmp ne i32 %24, 0
%26 = xor i1 %25, true
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%30 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"2 \00"
@.str.3 = [4 x i8] c"32 \00"
@.str.4 = [4 x i8] c"128\00"
@str = [12 x i8] c"testPadding\00"
@str.6 = [25 x i8] c"\0AtestPadding successful.\00"
define void @testPadding() {
%1 = alloca [4 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%4 = call i32 @getTileString(i8* %3, i32 2)
%5 = call i32 @bcmp(i8* dereferenceable(4) %3, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 4)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i32 @putchar(i32 46)
%10 = call i32 @getTileString(i8* %3, i32 32)
%11 = call i32 @bcmp(i8* dereferenceable(4) %3, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i64 4)
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = call i32 @putchar(i32 46)
%16 = call i32 @getTileString(i8* %3, i32 128)
%17 = call i32 @bcmp(i8* dereferenceable(4) %3, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i64 4)
%18 = icmp eq i32 %17, 0
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = call i32 @putchar(i32 46)
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.6, i64 0, i64 0))
ret void
}