#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 */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ tiwlan_get_signal(int *, char **);
void show_signal(void) {
  char buf[256];
  int strength = -1;
  char *msg = NULL;
  if (tiwlan_get_signal(&strength, &msg) == 0) {
    snprintf(buf, sizeof(buf), "%d - %s", strength, msg);
  } else {
    strcpy(buf, "No Signal");
  }
  printf("Signal Strength: %s\n", buf);
}


x86 assembly (clang, -O0):
<show_signal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0xffffffff,-0x104(%rbp)
ff ff ff
movq   $0x0,-0x110(%rbp)
lea    -0x104(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   1060 <tiwlan_get_signal@plt>
cmp    $0x0,%rax
jne    11a7 <show_signal+0x67>
lea    -0x100(%rbp),%rdi
mov    -0x104(%rbp),%ecx
mov    -0x110(%rbp),%r8
mov    $0x100,%esi
lea    0xe63(%rip),%rdx
call   1050 <snprintf@plt>
jmp    11ba <show_signal+0x7a>
lea    -0x100(%rbp),%rdi
lea    0xe53(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x100(%rbp),%rsi
lea    0xe4a(%rip),%rdi
call   1040 <printf@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_signal>:
sub    $0x118,%rsp
movl   $0xffffffff,0x4(%rsp)
ff
movq   $0x0,0x8(%rsp)
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1060 <tiwlan_get_signal@plt>
test   %rax,%rax
je     117f <show_signal+0x3f>
lea    0xe95(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1030 <strcpy@plt>
jmp    119e <show_signal+0x5e>
mov    0x4(%rsp),%ecx
mov    0x8(%rsp),%r8
lea    0xe71(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0x100,%esi
call   1050 <snprintf@plt>
lea    0xe6d(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1040 <printf@plt>
add    $0x118,%rsp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%d - %s\00"
@.str.1 = [10 x i8] c"No Signal\00"
@.str.2 = [21 x i8] c"Signal Strength: %s\0A\00"
define void @show_signal() {
%1 = alloca [256 x i8]
%2 = alloca i32
%3 = alloca i8*
store i32 -1, i32* %2
store i8* null, i8** %3
%4 = call i64 @tiwlan_get_signal(i32* %2, i8** %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %0
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%8 = load i32, i32* %2
%9 = load i8*, i8** %3
%10 = call i32 @snprintf(i8* %7, i32 256, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %8, i8* %9)
br label %14
11: ; preds = %0
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%13 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %11, %6
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%16 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %15)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%d - %s\00"
@.str.1 = [10 x i8] c"No Signal\00"
@.str.2 = [21 x i8] c"Signal Strength: %s\0A\00"
define void @show_signal() {
%1 = alloca [256 x i8]
%2 = alloca i32
%3 = alloca i8*
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%5 = bitcast i32* %2 to i8*
store i32 -1, i32* %2
%6 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%7 = call i64 @tiwlan_get_signal(i32* %2, i8** %3)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %0
%10 = load i32, i32* %2
%11 = load i8*, i8** %3
%12 = call i32 @snprintf(i8* %4, i32 256, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %10, i8* %11)
br label %15
13: ; preds = %0
%14 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %9
%16 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %4)
ret void
}