#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 */
scalar_t__ EncodeSMS(char *, char *, char *, int, int /*<<< orphan*/ *,
                     int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int test_check_buffer_size() {
  if (EncodeSMS("001234567", "1234567", "hellohello", 10, NULL, 0) >= 0) {
    printf("SMS check buffer size failed!\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_check_buffer_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    0xecc(%rip),%rsi
lea    0xecd(%rip),%rdx
mov    $0xa,%ecx
xor    %eax,%eax
mov    %eax,%r8d
xor    %r9d,%r9d
call   1030 <EncodeSMS@plt>
cmp    $0x0,%rax
jl     1171 <test_check_buffer_size+0x51>
lea    0xeb5(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1178 <test_check_buffer_size+0x58>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_check_buffer_size>:
push   %rbx
lea    0xed8(%rip),%rdi
lea    0xed3(%rip),%rsi
lea    0xed4(%rip),%rdx
xor    %ebx,%ebx
mov    $0xa,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <EncodeSMS@plt>
test   %rax,%rax
js     115e <test_check_buffer_size+0x3e>
lea    0xec1(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"001234567\00"
@.str.1 = [8 x i8] c"1234567\00"
@.str.2 = [11 x i8] c"hellohello\00"
@.str.3 = [31 x i8] c"SMS check buffer size failed!\0A\00"
define i32 @test_check_buffer_size() {
%1 = alloca i32
%2 = call i64 @EncodeSMS(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 10, i32* null, i32 0)
%3 = icmp sge i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %1
br label %7
6: ; preds = %0
store i32 0, i32* %1
br label %7
7: ; preds = %6, %4
%8 = load i32, i32* %1
ret i32 %8
}

LLVM IR (-O2):
@.str = [10 x i8] c"001234567\00"
@.str.1 = [8 x i8] c"1234567\00"
@.str.2 = [11 x i8] c"hellohello\00"
@str = [30 x i8] c"SMS check buffer size failed!\00"
define i32 @test_check_buffer_size() {
%1 = tail call i64 @EncodeSMS(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 10, i32* null, i32 0)
%2 = icmp sgt i64 %1, -1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %0, %3
%6 = phi i32 [ -1, %3 ], [ 0, %0 ]
ret i32 %6
}