#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 string_to_bytes(char *);
void test_string_to_bytes(void) {
  assert(100 == string_to_bytes("100"));
  assert(100 == string_to_bytes("100b"));
  assert(100 == string_to_bytes("100 bytes"));
  assert(1024 == string_to_bytes("1kb"));
  assert(1024 * 1024 == string_to_bytes("1mb"));
  assert(1024 * 1024 * 1024 == string_to_bytes("1gb"));
  assert(2 * 1024 == string_to_bytes("2kb"));
  assert(5 * 1024 * 1024 == string_to_bytes("5mb"));
}


x86 assembly (clang, -O0):
<test_string_to_bytes>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <string_to_bytes@plt>
mov    %eax,%ecx
mov    $0x64,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xeb7(%rip),%rdi
call   1030 <string_to_bytes@plt>
mov    %eax,%ecx
mov    $0x64,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe9a(%rip),%rdi
call   1030 <string_to_bytes@plt>
mov    %eax,%ecx
mov    $0x64,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe82(%rip),%rdi
call   1030 <string_to_bytes@plt>
mov    %eax,%ecx
mov    $0x400,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe64(%rip),%rdi
call   1030 <string_to_bytes@plt>
mov    %eax,%ecx
mov    $0x100000,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe46(%rip),%rdi
call   1030 <string_to_bytes@plt>
mov    %eax,%ecx
mov    $0x40000000,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe28(%rip),%rdi
call   1030 <string_to_bytes@plt>
mov    %eax,%ecx
mov    $0x800,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe0a(%rip),%rdi
call   1030 <string_to_bytes@plt>
mov    %eax,%ecx
mov    $0x500000,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_string_to_bytes>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <string_to_bytes@plt>
xor    %edi,%edi
cmp    $0x64,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xec2(%rip),%rdi
call   1030 <string_to_bytes@plt>
xor    %edi,%edi
cmp    $0x64,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xead(%rip),%rdi
call   1030 <string_to_bytes@plt>
xor    %edi,%edi
cmp    $0x64,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe9d(%rip),%rdi
call   1030 <string_to_bytes@plt>
xor    %edi,%edi
cmp    $0x400,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe85(%rip),%rdi
call   1030 <string_to_bytes@plt>
xor    %edi,%edi
cmp    $0x100000,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe6d(%rip),%rdi
call   1030 <string_to_bytes@plt>
xor    %edi,%edi
cmp    $0x40000000,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe55(%rip),%rdi
call   1030 <string_to_bytes@plt>
xor    %edi,%edi
cmp    $0x800,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe3d(%rip),%rdi
call   1030 <string_to_bytes@plt>
xor    %edi,%edi
cmp    $0x500000,%eax
sete   %dil
pop    %rax
jmp    1040 <assert@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"100\00"
@.str.1 = [5 x i8] c"100b\00"
@.str.2 = [10 x i8] c"100 bytes\00"
@.str.3 = [4 x i8] c"1kb\00"
@.str.4 = [4 x i8] c"1mb\00"
@.str.5 = [4 x i8] c"1gb\00"
@.str.6 = [4 x i8] c"2kb\00"
@.str.7 = [4 x i8] c"5mb\00"
define void @test_string_to_bytes() {
%1 = call i32 @string_to_bytes(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 100, %1
%3 = zext i1 %2 to i32
%4 = call i32 @assert(i32 %3)
%5 = call i32 @string_to_bytes(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 100, %5
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i32 @string_to_bytes(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i32 100, %9
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i32 @string_to_bytes(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i32 1024, %13
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = call i32 @string_to_bytes(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%18 = icmp eq i32 1048576, %17
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = call i32 @string_to_bytes(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%22 = icmp eq i32 1073741824, %21
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
%25 = call i32 @string_to_bytes(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%26 = icmp eq i32 2048, %25
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = call i32 @string_to_bytes(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%30 = icmp eq i32 5242880, %29
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"100\00"
@.str.1 = [5 x i8] c"100b\00"
@.str.2 = [10 x i8] c"100 bytes\00"
@.str.3 = [4 x i8] c"1kb\00"
@.str.4 = [4 x i8] c"1mb\00"
@.str.5 = [4 x i8] c"1gb\00"
@.str.6 = [4 x i8] c"2kb\00"
@.str.7 = [4 x i8] c"5mb\00"
define void @test_string_to_bytes() {
%1 = tail call i32 @string_to_bytes(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 100
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @string_to_bytes(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 100
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @string_to_bytes(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i32 %9, 100
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @string_to_bytes(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i32 %13, 1024
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = tail call i32 @string_to_bytes(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%18 = icmp eq i32 %17, 1048576
%19 = zext i1 %18 to i32
%20 = tail call i32 @assert(i32 %19)
%21 = tail call i32 @string_to_bytes(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%22 = icmp eq i32 %21, 1073741824
%23 = zext i1 %22 to i32
%24 = tail call i32 @assert(i32 %23)
%25 = tail call i32 @string_to_bytes(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%26 = icmp eq i32 %25, 2048
%27 = zext i1 %26 to i32
%28 = tail call i32 @assert(i32 %27)
%29 = tail call i32 @string_to_bytes(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%30 = icmp eq i32 %29, 5242880
%31 = zext i1 %30 to i32
%32 = tail call i32 @assert(i32 %31)
ret void
}