#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 /*<<< orphan*/ free(char *);
char *ll_license_default_get();
int ll_license_default_set(char *);
int /*<<< orphan*/ printf(char *, char *, ...);
scalar_t__ strcmp(char *, char *);
void set_and_check(char *license, char *expected) {
  char *response;
  int status;
  status = ll_license_default_set(license);
  printf("Setting default to '%s': %d\n", license, status);
  assert(status == 1);
  response = ll_license_default_get();
  printf("Getting the default: %s\n", response);
  assert((response == expected) || strcmp(response, expected) == 0);
  free(response);
}


x86 assembly (clang, -O0):
<set_and_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <ll_license_default_set@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x1c(%rbp),%edx
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x1,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    $0x0,%al
call   1080 <ll_license_default_get@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rcx
mov    $0x1,%al
cmp    -0x10(%rbp),%rcx
mov    %al,-0x1d(%rbp)
je     11e9 <set_and_check+0x89>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_and_check>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1070 <ll_license_default_set@plt>
mov    %eax,%ebp
lea    0xe88(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
cmp    $0x1,%ebp
sete   %dil
call   1060 <assert@plt>
xor    %eax,%eax
call   1080 <ll_license_default_get@plt>
mov    %rax,%rbx
lea    0xe7a(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r14,%rbx
je     11c8 <set_and_check+0x68>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
jmp    11cd <set_and_check+0x6d>
mov    $0x1,%edi
call   1060 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"Setting default to '%s': %d\0A\00"
@.str.1 = [25 x i8] c"Getting the default: %s\0A\00"
define void @set_and_check(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i32 @ll_license_default_set(i8* %7)
store i32 %8, i32* %6
%9 = load i8*, i8** %3
%10 = load i32, i32* %6
%11 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %9, i32 %10)
%12 = load i32, i32* %6
%13 = icmp eq i32 %12, 1
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = call i8* (...) @ll_license_default_get()
store i8* %16, i8** %5
%17 = load i8*, i8** %5
%18 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i8*, i8** %5
%20 = load i8*, i8** %4
%21 = icmp eq i8* %19, %20
br i1 %21, label %27, label %22
22: ; preds = %2
%23 = load i8*, i8** %5
%24 = load i8*, i8** %4
%25 = call i64 @strcmp(i8* %23, i8* %24)
%26 = icmp eq i64 %25, 0
br label %27
27: ; preds = %22, %2
%28 = phi i1 [ true, %2 ], [ %26, %22 ]
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = load i8*, i8** %5
%32 = call i32 @free(i8* %31)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"Setting default to '%s': %d\0A\00"
@.str.1 = [25 x i8] c"Getting the default: %s\0A\00"
define void @set_and_check(i8* %0, i8* %1) {
%3 = tail call i32 @ll_license_default_set(i8* %0)
%4 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %3)
%5 = icmp eq i32 %3, 1
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = tail call i8* (...) @ll_license_default_get()
%9 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = icmp eq i8* %8, %1
br i1 %10, label %15, label %11
11: ; preds = %2
%12 = tail call i64 @strcmp(i8* %8, i8* %1)
%13 = icmp eq i64 %12, 0
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %11, %2
%16 = phi i32 [ 1, %2 ], [ %14, %11 ]
%17 = tail call i32 @assert(i32 %16)
%18 = tail call i32 @free(i8* %8)
ret void
}