#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
char *getenv(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
scalar_t__ strlen(char *);
int /*<<< orphan*/ twitc_oauth_authorize_token(char *, char **);
int /*<<< orphan*/ twitc_oauth_request_token(char *, char *, char **, char **);
char *test_twitc_oauth_authorize_token_integration(void) {
  printf("\nChecking test_twitc_oauth_authorize_token...\n\n");
  char *token = NULL;
  char *secret = NULL;
  char *c_key = getenv("TWITC_KEY");
  char *c_secret = getenv("TWITC_SECRET");
  char *pin = malloc(1);
  if (pin == NULL) {
    fprintf(stderr, "malloc failed");
    exit(1);
  }
  twitc_oauth_request_token(c_key, c_secret, &token, &secret);
  twitc_oauth_authorize_token(token, &pin);
  do {
    if (!(strlen(pin) > 0))
      return "should be able to authorize a token";
  } while (0);
  free(pin);
  if (secret) {
    free(secret);
  }
  if (token) {
    free(token);
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_twitc_oauth_authorize_token_integration>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xe61(%rip),%rdi
call   1080 <printf@plt>
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    0xe75(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
lea    0xe6f(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x28(%rbp)
mov    $0x1,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    120c <test_twitc_oauth_authorize_token_integration+0x7c>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
lea    0xe4a(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1050 <twitc_oauth_request_token@plt>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1060 <twitc_oauth_authorize_token@plt>
mov    -0x30(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0x0,%rax
jg     1251 <test_twitc_oauth_authorize_token_integration+0xc1>
lea    0xe0d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    128f <test_twitc_oauth_authorize_token_integration+0xff>
jmp    1256 <test_twitc_oauth_authorize_token_integration+0xc6>
mov    -0x30(%rbp),%rdi
call   1040 <free@plt>
cmpq   $0x0,-0x18(%rbp)
je     1273 <test_twitc_oauth_authorize_token_integration+0xe3>
mov    -0x18(%rbp),%rdi
call   1040 <free@plt>
cmpq   $0x0,-0x10(%rbp)
je     1287 <test_twitc_oauth_authorize_token_integration+0xf7>
mov    -0x10(%rbp),%rdi
call   1040 <free@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_twitc_oauth_authorize_token_integration>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xeab(%rip),%rdi
call   1050 <puts@plt>
movq   $0x0,(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xe45(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%r14
lea    0xe40(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
mov    $0x1,%edi
call   10a0 <malloc@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     1251 <test_twitc_oauth_authorize_token_integration+0xc1>
mov    %rsp,%rdx
lea    0x10(%rsp),%rcx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <twitc_oauth_request_token@plt>
mov    (%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1070 <twitc_oauth_authorize_token@plt>
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1080 <strlen@plt>
test   %rax,%rax
jle    1242 <test_twitc_oauth_authorize_token_integration+0xb2>
mov    %rbx,%rdi
call   1040 <free@plt>
mov    0x10(%rsp),%rdi
test   %rdi,%rdi
je     1230 <test_twitc_oauth_authorize_token_integration+0xa0>
call   1040 <free@plt>
mov    (%rsp),%rdi
test   %rdi,%rdi
je     123e <test_twitc_oauth_authorize_token_integration+0xae>
call   1040 <free@plt>
xor    %eax,%eax
jmp    1249 <test_twitc_oauth_authorize_token_integration+0xb9>
lea    0xddc(%rip),%rax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2d88(%rip),%rax
mov    (%rax),%edi
lea    0xdb6(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"\0AChecking test_twitc_oauth_authorize_token...\0A\0A\00"
@.str.1 = [10 x i8] c"TWITC_KEY\00"
@.str.2 = [13 x i8] c"TWITC_SECRET\00"
@stderr = global i32 0
@.str.3 = [14 x i8] c"malloc failed\00"
@.str.4 = [36 x i8] c"should be able to authorize a token\00"
define i8* @test_twitc_oauth_authorize_token_integration() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
store i8* null, i8** %2
store i8* null, i8** %3
%8 = call i8* @getenv(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
store i8* %8, i8** %4
%9 = call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i8* %9, i8** %5
%10 = call i8* @malloc(i32 1)
store i8* %10, i8** %6
%11 = load i8*, i8** %6
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %17
13: ; preds = %0
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %0
%18 = load i8*, i8** %4
%19 = load i8*, i8** %5
%20 = call i32 @twitc_oauth_request_token(i8* %18, i8* %19, i8** %2, i8** %3)
%21 = load i8*, i8** %2
%22 = call i32 @twitc_oauth_authorize_token(i8* %21, i8** %6)
br label %23
23: ; preds = %17
%24 = load i8*, i8** %6
%25 = call i64 @strlen(i8* %24)
%26 = icmp sgt i64 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %23
store i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i8** %1
br label %44
28: ; preds = %23
br label %29
29: ; preds = %28
%30 = load i8*, i8** %6
%31 = call i32 @free(i8* %30)
%32 = load i8*, i8** %3
%33 = icmp ne i8* %32, null
br i1 %33, label %34, label %37
34: ; preds = %29
%35 = load i8*, i8** %3
%36 = call i32 @free(i8* %35)
br label %37
37: ; preds = %34, %29
%38 = load i8*, i8** %2
%39 = icmp ne i8* %38, null
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = load i8*, i8** %2
%42 = call i32 @free(i8* %41)
br label %43
43: ; preds = %40, %37
store i8* null, i8** %1
br label %44
44: ; preds = %43, %27
%45 = load i8*, i8** %1
ret i8* %45
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"TWITC_KEY\00"
@.str.2 = [13 x i8] c"TWITC_SECRET\00"
@stderr = global i32 0
@.str.3 = [14 x i8] c"malloc failed\00"
@.str.4 = [36 x i8] c"should be able to authorize a token\00"
@str = [47 x i8] c"\0AChecking test_twitc_oauth_authorize_token...\0A\00"
define i8* @test_twitc_oauth_authorize_token_integration() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%5 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%6 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%7 = tail call i8* @getenv(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%9 = bitcast i8** %3 to i8*
%10 = tail call dereferenceable_or_null(1) i8* @malloc(i32 1)
store i8* %10, i8** %3
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %16
12: ; preds = %0
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %0
%17 = call i32 @twitc_oauth_request_token(i8* %7, i8* %8, i8** %1, i8** %2)
%18 = load i8*, i8** %1
%19 = call i32 @twitc_oauth_authorize_token(i8* %18, i8** %3)
%20 = load i8*, i8** %3
%21 = call i64 @strlen(i8* dereferenceable(1) %20)
%22 = icmp sgt i64 %21, 0
br i1 %22, label %23, label %34
23: ; preds = %16
%24 = call i32 @free(i8* %20)
%25 = load i8*, i8** %2
%26 = icmp eq i8* %25, null
br i1 %26, label %29, label %27
27: ; preds = %23
%28 = call i32 @free(i8* %25)
br label %29
29: ; preds = %27, %23
%30 = load i8*, i8** %1
%31 = icmp eq i8* %30, null
br i1 %31, label %34, label %32
32: ; preds = %29
%33 = call i32 @free(i8* %30)
br label %34
34: ; preds = %29, %32, %16
%35 = phi i8* [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), %16 ], [ null, %32 ], [ null, %29 ]
ret i8* %35
}