#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 determine_string(char *);
int /*<<< orphan*/ sscanf(char *, char *, unsigned long *);
unsigned long get_stepcount(int argc, char **argv) {
  unsigned long count = 0;
  if (argc == 1) {
    return 0;
  } else if (determine_string(argv[1]) == 1) {
    sscanf(argv[1], "%lu", &count);
  }
  return count;
}


x86 assembly (clang, -O0):
<get_stepcount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    114e <get_stepcount+0x2e>
movq   $0x0,-0x8(%rbp)
jmp    1189 <get_stepcount+0x69>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <determine_string@plt>
cmp    $0x1,%eax
jne    117c <get_stepcount+0x5c>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe8d(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1040 <sscanf@plt>
jmp    1181 <get_stepcount+0x61>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_stepcount>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
cmp    $0x1,%edi
je     1160 <get_stepcount+0x40>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1030 <determine_string@plt>
cmp    $0x1,%eax
jne    1160 <get_stepcount+0x40>
mov    0x8(%rbx),%rdi
lea    0xeb1(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1040 <sscanf@plt>
mov    0x8(%rsp),%rax
jmp    1162 <get_stepcount+0x42>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lu\00"
define i64 @get_stepcount(i32 %0, i8** %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %10
9: ; preds = %2
store i64 0, i64* %3
br label %24
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @determine_string(i8* %13)
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %21
16: ; preds = %10
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %6)
br label %21
21: ; preds = %16, %10
br label %22
22: ; preds = %21
%23 = load i64, i64* %6
store i64 %23, i64* %3
br label %24
24: ; preds = %22, %9
%25 = load i64, i64* %3
ret i64 %25
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lu\00"
define i64 @get_stepcount(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
store i64 0, i64* %3
%5 = icmp eq i32 %0, 1
br i1 %5, label %15, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @determine_string(i8* %8)
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = load i8*, i8** %7
%13 = call i32 @sscanf(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %3)
%14 = load i64, i64* %3
br label %15
15: ; preds = %11, %6, %2
%16 = phi i64 [ 0, %2 ], [ 0, %6 ], [ %14, %11 ]
ret i64 %16
}