#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ strcmp(char *, char *);
char *url_decode(char *);
int main(int argc, char **argv) {
  if (argc != 3)
    return 1;
  char *input = *(argv + 1);
  char *expected = *(argv + 2);
  char *output = url_decode(input);
  if (!output)
    return EXIT_FAILURE;
  int success = !strcmp(output, expected);
  free(output);
  output = NULL;
  return success ? EXIT_SUCCESS : EXIT_FAILURE;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     115c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    11f8 <main+0xc8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <url_decode@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    119d <main+0x6d>
mov    0x2e4d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11f8 <main+0xc8>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x28(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     11e6 <main+0xb6>
mov    0x2dfc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
jmp    11f2 <main+0xc2>
mov    0x2df3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%eax
cmp    $0x3,%edi
jne    117e <main+0x4e>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%r14
call   1040 <url_decode@plt>
test   %rax,%rax
je     1175 <main+0x45>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
test   %ebp,%ebp
jne    1175 <main+0x45>
mov    0x2e65(%rip),%rax
jmp    117c <main+0x4c>
mov    0x2e64(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 3
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 1, i32* %3
br label %43
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
store i8* %16, i8** %6
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
store i8* %19, i8** %7
%20 = load i8*, i8** %6
%21 = call i8* @url_decode(i8* %20)
store i8* %21, i8** %8
%22 = load i8*, i8** %8
%23 = icmp ne i8* %22, null
br i1 %23, label %26, label %24
24: ; preds = %13
%25 = load i32, i32* @EXIT_FAILURE
store i32 %25, i32* %3
br label %43
26: ; preds = %13
%27 = load i8*, i8** %8
%28 = load i8*, i8** %7
%29 = call i32 @strcmp(i8* %27, i8* %28)
%30 = icmp ne i32 %29, 0
%31 = xor i1 %30, true
%32 = zext i1 %31 to i32
store i32 %32, i32* %9
%33 = load i8*, i8** %8
%34 = call i32 @free(i8* %33)
store i8* null, i8** %8
%35 = load i32, i32* %9
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %26
%38 = load i32, i32* @EXIT_SUCCESS
br label %41
39: ; preds = %26
%40 = load i32, i32* @EXIT_FAILURE
br label %41
41: ; preds = %39, %37
%42 = phi i32 [ %38, %37 ], [ %40, %39 ]
store i32 %42, i32* %3
br label %43
43: ; preds = %41, %24, %12
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %4, label %20
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = tail call i8* @url_decode(i8* %6)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %4
%12 = load i32, i32* @EXIT_FAILURE
br label %20
13: ; preds = %4
%14 = tail call i32 @strcmp(i8* %9, i8* dereferenceable(1) %8)
%15 = icmp eq i32 %14, 0
%16 = tail call i32 @free(i8* %9)
%17 = load i32, i32* @EXIT_SUCCESS
%18 = load i32, i32* @EXIT_FAILURE
%19 = select i1 %15, i32 %17, i32 %18
br label %20
20: ; preds = %11, %13, %2
%21 = phi i32 [ 1, %2 ], [ %19, %13 ], [ %12, %11 ]
ret i32 %21
}