#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);
char *aws_sigv4_create_string_to_sign(char *, char *, char *, char *, char *);
int /*<<< orphan*/ free(char *);
scalar_t__ strcmp(char *, char *);
void test_aws_sigv4_create_string_to_sign(void) {
  char *string_to_sign;
  string_to_sign = aws_sigv4_create_string_to_sign(
      "20110909T233600Z", "20110909", "us-east-1", "iam",
      "3511de7e95d28ecd39e9513b642aee07e54f4941150d8df8bf94b328ef7e55e2");
  assert(strcmp(string_to_sign,
                "AWS4-HMAC-SHA256\n20110909T233600Z\n20110909/us-east-1/iam/"
                "aws4_"
                "request\n3511de7e95d28ecd39e9513b642aee07e54f4941150d8df8bf94b"
                "328ef7e55e2") == 0);
  free(string_to_sign);
}


x86 assembly (clang, -O0):
<test_aws_sigv4_create_string_to_sign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
lea    0xebb(%rip),%rsi
lea    0xebd(%rip),%rdx
lea    0xec0(%rip),%rcx
lea    0xf03(%rip),%r8
call   1060 <aws_sigv4_create_string_to_sign@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_aws_sigv4_create_string_to_sign>:
push   %rbx
lea    0xeb8(%rip),%rdi
lea    0xec2(%rip),%rsi
lea    0xec4(%rip),%rdx
lea    0xec7(%rip),%rcx
lea    0xf0a(%rip),%r8
call   1060 <aws_sigv4_create_string_to_sign@plt>
mov    %rax,%rbx
lea    0xeb5(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"20110909T233600Z\00"
@.str.1 = [9 x i8] c"20110909\00"
@.str.2 = [10 x i8] c"us-east-1\00"
@.str.3 = [4 x i8] c"iam\00"
@.str.4 = [65 x i8] c"3511de7e95d28ecd39e9513b642aee07e54f4941150d8df8bf94b328ef7e55e2\00"
@.str.5 = [135 x i8] c"AWS4-HMAC-SHA256\0A20110909T233600Z\0A20110909/us-east-1/iam/aws4_request\0A3511de7e95d28ecd39e9513b642aee07e54f4941150d8df8bf94b328ef7e55e2\00"
define void @test_aws_sigv4_create_string_to_sign() {
%1 = alloca i8*
%2 = call i8* @aws_sigv4_create_string_to_sign(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.4, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.5, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load i8*, i8** %1
%9 = call i32 @free(i8* %8)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"20110909T233600Z\00"
@.str.1 = [9 x i8] c"20110909\00"
@.str.2 = [10 x i8] c"us-east-1\00"
@.str.3 = [4 x i8] c"iam\00"
@.str.4 = [65 x i8] c"3511de7e95d28ecd39e9513b642aee07e54f4941150d8df8bf94b328ef7e55e2\00"
@.str.5 = [135 x i8] c"AWS4-HMAC-SHA256\0A20110909T233600Z\0A20110909/us-east-1/iam/aws4_request\0A3511de7e95d28ecd39e9513b642aee07e54f4941150d8df8bf94b328ef7e55e2\00"
define void @test_aws_sigv4_create_string_to_sign() {
%1 = tail call i8* @aws_sigv4_create_string_to_sign(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.4, i64 0, i64 0))
%2 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.5, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @free(i8* %1)
ret void
}