#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_hashed_canonical_request(char *, char *, char *, char *,
                                                char *, char *);
int /*<<< orphan*/ free(char *);
scalar_t__ strcmp(char *, char *);
void test_aws_sigv4_create_hashed_canonical_request(void) {
  char *hashed_canonical_request;
  hashed_canonical_request = aws_sigv4_create_hashed_canonical_request(
      "POST", "/", "",
      "content-type:application/x-www-form-urlencoded; "
      "charset=utf-8\nhost:iam.amazonaws.com\nx-amz-date:20110909T233600Z\n",
      "content-type;host;x-amz-date", "Action=ListUsers&Version=2010-05-08");
  assert(
      strcmp(
          hashed_canonical_request,
          "3511de7e95d28ecd39e9513b642aee07e54f4941150d8df8bf94b328ef7e55e2") ==
      0);
  free(hashed_canonical_request);
}


x86 assembly (clang, -O0):
<test_aws_sigv4_create_hashed_canonical_request>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
lea    0xeaf(%rip),%rsi
lea    0xf1b(%rip),%rdx
lea    0xea3(%rip),%rcx
lea    0xf0e(%rip),%r8
lea    0xf24(%rip),%r9
call   1060 <aws_sigv4_create_hashed_canonical_request@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xf34(%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_hashed_canonical_request>:
push   %rbx
lea    0xeb8(%rip),%rdi
lea    0xeb6(%rip),%rsi
lea    0xf22(%rip),%rdx
lea    0xeaa(%rip),%rcx
lea    0xf15(%rip),%r8
lea    0xf2b(%rip),%r9
call   1060 <aws_sigv4_create_hashed_canonical_request@plt>
mov    %rax,%rbx
lea    0xf40(%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 = [5 x i8] c"POST\00"
@.str.1 = [2 x i8] c"/\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [114 x i8] c"content-type:application/x-www-form-urlencoded; charset=utf-8\0Ahost:iam.amazonaws.com\0Ax-amz-date:20110909T233600Z\0A\00"
@.str.4 = [29 x i8] c"content-type;host;x-amz-date\00"
@.str.5 = [36 x i8] c"Action=ListUsers&Version=2010-05-08\00"
@.str.6 = [65 x i8] c"3511de7e95d28ecd39e9513b642aee07e54f4941150d8df8bf94b328ef7e55e2\00"
define void @test_aws_sigv4_create_hashed_canonical_request() {
%1 = alloca i8*
%2 = call i8* @aws_sigv4_create_hashed_canonical_request(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.6, 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 = [5 x i8] c"POST\00"
@.str.1 = [2 x i8] c"/\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [114 x i8] c"content-type:application/x-www-form-urlencoded; charset=utf-8\0Ahost:iam.amazonaws.com\0Ax-amz-date:20110909T233600Z\0A\00"
@.str.4 = [29 x i8] c"content-type;host;x-amz-date\00"
@.str.5 = [36 x i8] c"Action=ListUsers&Version=2010-05-08\00"
@.str.6 = [65 x i8] c"3511de7e95d28ecd39e9513b642aee07e54f4941150d8df8bf94b328ef7e55e2\00"
define void @test_aws_sigv4_create_hashed_canonical_request() {
%1 = tail call i8* @aws_sigv4_create_hashed_canonical_request(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
%2 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.6, 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
}