#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 curl(char *);
scalar_t__ getCookie(char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int main(int argc, char **argv) {
  char cookie[128];
  memset(cookie, 0, 128);
  if (getCookie(cookie))
    return 0;
  char url[256];
  memset(url, 0, 256);
  sprintf(url, "http://rest:9000/delCart?cookie=%s", cookie);
  int res;
  res = curl(url);
end:
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1030 <memset@plt>
lea    -0x90(%rbp),%rdi
call   1040 <getCookie@plt>
cmp    $0x0,%rax
je     118e <main+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    11d4 <main+0x94>
lea    -0x190(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1030 <memset@plt>
lea    -0x190(%rbp),%rdi
lea    -0x90(%rbp),%rdx
lea    0xe4a(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x190(%rbp),%rdi
call   1050 <curl@plt>
mov    %eax,-0x194(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x180,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1030 <memset@plt>
mov    %rbx,%rdi
call   1040 <getCookie@plt>
test   %rax,%rax
jne    1198 <main+0x58>
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1030 <memset@plt>
lea    0xe7b(%rip),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <curl@plt>
xor    %eax,%eax
add    $0x180,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"http://rest:9000/delCart?cookie=%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [128 x i8]
%7 = alloca [256 x i8]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%10 = call i32 @memset(i8* %9, i32 0, i32 128)
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%12 = call i64 @getCookie(i8* %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %2
store i32 0, i32* %3
br label %24
15: ; preds = %2
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%17 = call i32 @memset(i8* %16, i32 0, i32 256)
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%19 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%20 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%22 = call i32 @curl(i8* %21)
store i32 %22, i32* %8
br label %23
23: ; preds = %15
store i32 0, i32* %3
br label %24
24: ; preds = %23, %14
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@.str = [35 x i8] c"http://rest:9000/delCart?cookie=%s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [128 x i8]
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 128)
%7 = call i64 @getCookie(i8* %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%11 = call i32 @memset(i8* %10, i32 0, i32 256)
%12 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %5)
%13 = call i32 @curl(i8* %10)
br label %14
14: ; preds = %2, %9
ret i32 0
}